summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-04-11 17:19:06 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-04-11 17:19:06 +0000
commitbdfe1e3884ad855eeec021d5dca8c2c246078ef3 (patch)
tree796a42dd9fa56608ab4bdc20e15b46d9ff282750 /hcid
parentfb27732e05fb7b69c3b784ed8a6aaed2d9d939ae (diff)
Plugin auth: use device's agent when it is available
Diffstat (limited to 'hcid')
-rw-r--r--hcid/plugin.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hcid/plugin.c b/hcid/plugin.c
index 3fcbf126..29f11714 100644
--- a/hcid/plugin.c
+++ b/hcid/plugin.c
@@ -198,6 +198,7 @@ int plugin_req_auth(bdaddr_t *src, bdaddr_t *dst,
struct plugin_auth *auth;
struct adapter *adapter;
struct device *device;
+ struct agent *agent;
char address[18];
adapter = ba2adapter(src);
@@ -222,7 +223,8 @@ int plugin_req_auth(bdaddr_t *src, bdaddr_t *dst,
* UUID128 in the trusted file.
*/
- if (!adapter->agent)
+ agent = (device->agent ? : adapter->agent);
+ if (!agent)
return -EPERM;
auth = g_try_new0(struct plugin_auth, 1);
@@ -232,7 +234,7 @@ int plugin_req_auth(bdaddr_t *src, bdaddr_t *dst,
auth->cb = cb;
auth->user_data = user_data;
- return agent_authorize(adapter->agent, device->path, uuid, agent_auth_cb, auth);
+ return agent_authorize(agent, device->path, uuid, agent_auth_cb, auth);
}
int plugin_cancel_auth(bdaddr_t *src)