diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-04-04 21:45:43 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-04-04 21:45:43 +0000 |
commit | 0eede007ad95a1d972b43e860164d32effcde9c9 (patch) | |
tree | e851fb870eb15adaf26e0923fc5f7d76ab9e3a5e /input/server.c | |
parent | 1826edb5d4e3998ba026d2d0436bbbae9047ed3a (diff) |
input: send CancelAuthorizationRequest if there is a pending authorization
Diffstat (limited to 'input/server.c')
-rw-r--r-- | input/server.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/input/server.c b/input/server.c index e08bee22..b3bde829 100644 --- a/input/server.c +++ b/input/server.c @@ -128,6 +128,27 @@ cleanup: g_free(session); } +static void cancel_authorization(const char *addr) +{ + DBusMessage *msg; + const char *uuid = ""; + + msg = dbus_message_new_method_call("org.bluez", "/org/bluez", + "org.bluez.Database", + "CancelAuthorizationRequest"); + if (!msg) { + error("Unable to allocate new method call"); + return; + } + + dbus_message_append_args(msg, + DBUS_TYPE_STRING, &addr, + DBUS_TYPE_STRING, &uuid, + DBUS_TYPE_INVALID); + + send_message_and_unref(connection, msg); +} + static void authorization_callback(DBusPendingCall *pcall, void *data) { struct session_data *session = data; @@ -138,7 +159,10 @@ static void authorization_callback(DBusPendingCall *pcall, void *data) if (dbus_set_error_from_message(&derr, reply)) { error("Access denied: %s", derr.message); if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY)) { - debug("FIXME: Cancel authorization request"); + char addr[18]; + memset(addr, 0, sizeof(addr)); + ba2str(&session->dst, addr); + cancel_authorization(addr); } dbus_error_free(&derr); |