diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-10-27 18:05:01 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-10-27 18:05:01 +0000 |
commit | db6683b32275d2e408c111742d2ed27723457ab8 (patch) | |
tree | 023b48607ed9a45862fd87c1ff99161f4239e6e0 | |
parent | 1c01dbb402afcffd227432ab81dd163dd7b1893e (diff) |
Added RemoveTrusted to Service interface
-rw-r--r-- | hcid/dbus-service.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 5c085fb6..7cb1ef01 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -529,7 +529,33 @@ static DBusHandlerResult is_trusted(DBusConnection *conn, static DBusHandlerResult remove_trust(DBusConnection *conn, DBusMessage *msg, void *data) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + struct service_agent *agent = data; + struct slist *l; + DBusMessage *reply; + const char *address; + void *paddress; + + /* FIXME: Missing define security policy */ + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_STRING, &address, + DBUS_TYPE_INVALID)) + return error_invalid_arguments(conn, msg); + + l = slist_find(agent->trusted_devices, address, (cmp_func_t) strcmp); + if (!l) + return error_invalid_arguments(conn, msg); /* FIXME: find a better error name */ + + reply = dbus_message_new_method_return(msg); + if (!reply) + return DBUS_HANDLER_RESULT_NEED_MEMORY; + + paddress = l->data; + agent->trusted_devices = slist_remove(agent->trusted_devices, l->data); + free(paddress); + + return send_message_and_unref(conn, reply); + } static struct service_data services_methods[] = { |