summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-19 14:01:56 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-19 14:01:56 +0000
commit21064766fb1423ede7977e9068a63a429d861463 (patch)
treeede9fb7e4baa15b9d3098780d5a42af17d9e7c14 /hcid
parentef6a5df5d623b88685dfee801b39d19333e7a206 (diff)
allow only the requestor stop the periodic inquiry
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-adapter.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index 31411578..b938df9f 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -2367,12 +2367,13 @@ static DBusHandlerResult handle_dev_stop_periodic_req(DBusConnection *conn, DBus
if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
return error_invalid_arguments(conn, msg);
- /* allow cancel if the periodic inquiry was requested by a NON D-Bus client */
- if (dbus_data->pdiscovery_requestor && strcmp(dbus_data->pdiscovery_requestor, dbus_message_get_sender(msg)))
+ if (!dbus_data->pinq_active)
return error_not_authorized(conn, msg);
- if (!dbus_data->pinq_active)
- return error_not_authorized(conn, msg); /* find a better name */
+ /* only the requestor can stop the periodic inquiry */
+ if (!dbus_data->pdiscovery_requestor ||
+ strcmp(dbus_data->pdiscovery_requestor, dbus_message_get_sender(msg)))
+ return error_not_authorized(conn, msg);
/*
* Cleanup the discovered devices list and send the cmd to exit
@@ -2485,7 +2486,7 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D
/* is there discover pending? or discovery cancel was requested previously */
if (!dbus_data->inq_active || dbus_data->discovery_cancel)
- return error_not_authorized(conn, msg); /* FIXME: find a better error name */
+ return error_not_authorized(conn, msg);
/* only the discover requestor can cancel the inquiry process */
if (!dbus_data->discovery_requestor ||