diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-05-02 20:56:40 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-05-02 20:56:40 +0000 |
commit | 93123d3eccdb503246f10b40ef2b62418bda6e8f (patch) | |
tree | f32bee6cc069760a3ca1c3cda2752adbd4acc399 /hcid | |
parent | 9491a544f622e40453265c30f24ce44a61440cc1 (diff) |
Check trusted device list before request authorization
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus-service.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index c446a6e4..69accf87 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -1236,6 +1236,7 @@ static void agent_auth_cb(struct agent *agent, DBusError *derr, void *user_data) g_free(auth); } + int service_req_auth(bdaddr_t *src, bdaddr_t *dst, const char *uuid, service_auth_cb cb, void *user_data) { @@ -1243,7 +1244,9 @@ int service_req_auth(bdaddr_t *src, bdaddr_t *dst, struct adapter *adapter; struct device *device; struct agent *agent; + struct service *service; char address[18]; + gboolean trusted; adapter = ba2adapter(src); if (!adapter) @@ -1259,10 +1262,18 @@ int service_req_auth(bdaddr_t *src, bdaddr_t *dst, if (!device) return -EPERM; - if (!search_service_by_uuid(uuid)) + service = search_service_by_uuid(uuid); + if (!service) return -EPERM; - /* FIXME: Missing check trusted file entries */ + trusted = read_trust(src, address, GLOBAL_TRUST); + if (!trusted) + trusted = read_trust(BDADDR_ANY, address, service->ident); + + if (trusted) { + cb(NULL, user_data); + return 0; + } agent = (device->agent ? : adapter->agent); if (!agent) |