summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-database.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-01-24 20:56:05 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-01-24 20:56:05 +0000
commit6a57492f40729ceee156d7ff80cb2e99109e1082 (patch)
tree5821e68d3001d845f981ef87075c73dfafb20ce8 /hcid/dbus-database.c
parent0e1bf963709b5fa4a953a7e97d9c343a2b617cd0 (diff)
Remove incorrect g_io_channel_unref call
Diffstat (limited to 'hcid/dbus-database.c')
-rw-r--r--hcid/dbus-database.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c
index fbd79c91..1d10be6e 100644
--- a/hcid/dbus-database.c
+++ b/hcid/dbus-database.c
@@ -45,6 +45,7 @@
#include "dbus-common.h"
#include "dbus-error.h"
#include "dbus-service.h"
+#include "dbus-security.h"
#include "dbus-database.h"
static int sdp_server_enable = 0;
@@ -328,8 +329,8 @@ static DBusHandlerResult unregister_service(DBusConnection *conn,
static DBusHandlerResult request_authorization(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- DBusMessage *reply;
const char *sender, *address, *path;
+ struct service *service;
if (!hcid_dbus_use_experimental())
return error_unknown_method(conn, msg);
@@ -340,18 +341,29 @@ static DBusHandlerResult request_authorization(DBusConnection *conn,
sender = dbus_message_get_sender(msg);
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ service = search_service(conn, sender);
+ if (!service)
+ return error_not_authorized(conn, msg);
- return send_message_and_unref(conn, reply);
+ if (g_slist_find_custom(service->trusted_devices, address,
+ (GCompareFunc) strcasecmp)) {
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ return send_message_and_unref(conn, reply);
+ }
+
+ return handle_authorize_request(conn, msg, service, address, path);
}
static DBusHandlerResult cancel_authorization_request(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- DBusMessage *reply;
const char *sender, *address, *path;
+ struct service *service;
if (!hcid_dbus_use_experimental())
return error_unknown_method(conn, msg);
@@ -362,11 +374,11 @@ static DBusHandlerResult cancel_authorization_request(DBusConnection *conn,
sender = dbus_message_get_sender(msg);
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ service = search_service(conn, sender);
+ if (!service)
+ return error_not_authorized(conn, msg);
- return send_message_and_unref(conn, reply);
+ return cancel_authorize_request(conn, msg, service, address, path);
}
static struct service_data database_services[] = {