From 21064766fb1423ede7977e9068a63a429d861463 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 19 Sep 2006 14:01:56 +0000 Subject: allow only the requestor stop the periodic inquiry --- hcid/dbus-adapter.c | 11 ++++++----- 1 file 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 || -- cgit