summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-06-12 08:39:17 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-06-12 08:39:17 +0000
commitc842fb8295afaaa86dcd7cf9c5e62f6ca4c51b9b (patch)
tree77510d62054e69361479c154a1dacacdd3cf1dab /hcid
parentc2fc073bc5d41b4a693680bcc2f7fb9713607017 (diff)
Make hcid_dbus_new_auth_request private to dbus-hci.c
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-hci.c33
-rw-r--r--hcid/dbus-hci.h1
-rw-r--r--hcid/security.c10
3 files changed, 23 insertions, 21 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index 451de7ca..c9880445 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -841,17 +841,11 @@ int auth_req_cmp(const void *p1, const void *p2)
return bda ? bacmp(&pb1->bdaddr, bda) : -1;
}
-void hcid_dbus_new_auth_request(bdaddr_t *sba, bdaddr_t *dba, auth_type_t type)
+static void hcid_dbus_new_auth_request(struct adapter *adapter, bdaddr_t *dba,
+ auth_type_t type)
{
- struct adapter *adapter;
struct pending_auth_info *info;
- adapter = manager_find_adapter(sba);
- if (!adapter) {
- error("No matching adapter found");
- return;
- }
-
debug("hcid_dbus_new_auth_request");
info = g_new0(struct pending_auth_info, 1);
@@ -913,6 +907,7 @@ int hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci)
struct adapter *adapter;
struct device *device;
struct agent *agent;
+ int ret;
adapter = manager_find_adapter(sba);
if (!adapter) {
@@ -936,13 +931,23 @@ int hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci)
return -ENODEV;
}
- return agent_request_pincode(agent, device,
+ ret = agent_request_pincode(agent, device,
(agent_pincode_cb) pincode_cb,
device);
+ if (ret == 0)
+ hcid_dbus_new_auth_request(adapter, &ci->bdaddr,
+ AUTH_TYPE_PINCODE);
+
+ return ret;
old_fallback:
- return handle_passkey_request_old(connection, dev, adapter,
- sba, &ci->bdaddr);
+ ret = handle_passkey_request_old(connection, dev, adapter, sba,
+ &ci->bdaddr);
+ if (ret == 0)
+ hcid_dbus_new_auth_request(adapter, &ci->bdaddr,
+ AUTH_TYPE_PINCODE);
+
+ return ret;
}
static void confirm_cb(struct agent *agent, DBusError *err, void *user_data)
@@ -1099,6 +1104,8 @@ int hcid_dbus_user_confirm(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey)
return -1;
}
+ hcid_dbus_new_auth_request(adapter, dba, AUTH_TYPE_CONFIRM);
+
return 0;
}
@@ -1133,6 +1140,8 @@ int hcid_dbus_user_passkey(bdaddr_t *sba, bdaddr_t *dba)
return -1;
}
+ hcid_dbus_new_auth_request(adapter, dba, AUTH_TYPE_PASSKEY);
+
return 0;
}
@@ -1167,6 +1176,8 @@ int hcid_dbus_user_notify(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey)
return -1;
}
+ hcid_dbus_new_auth_request(adapter, dba, AUTH_TYPE_NOTIFY);
+
return 0;
}
diff --git a/hcid/dbus-hci.h b/hcid/dbus-hci.h
index 1c5bca90..f4dfa018 100644
--- a/hcid/dbus-hci.h
+++ b/hcid/dbus-hci.h
@@ -36,7 +36,6 @@ int hcid_dbus_register_device(uint16_t id);
int hcid_dbus_unregister_device(uint16_t id);
int hcid_dbus_start_device(uint16_t id);
int hcid_dbus_stop_device(uint16_t id);
-void hcid_dbus_new_auth_request(bdaddr_t *sba, bdaddr_t *dba, auth_type_t type);
int hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci);
void hcid_dbus_inquiry_start(bdaddr_t *local);
diff --git a/hcid/security.c b/hcid/security.c
index 9a1b373b..c5cfdb65 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -385,9 +385,6 @@ static void user_confirm_request(int dev, bdaddr_t *sba, void *ptr)
btohl(req->passkey)) < 0)
hci_send_cmd(dev, OGF_LINK_CTL,
OCF_USER_CONFIRM_NEG_REPLY, 6, ptr);
- else
- hcid_dbus_new_auth_request(sba, &req->bdaddr,
- AUTH_TYPE_CONFIRM);
}
static void user_passkey_request(int dev, bdaddr_t *sba, void *ptr)
@@ -397,17 +394,13 @@ static void user_passkey_request(int dev, bdaddr_t *sba, void *ptr)
if (hcid_dbus_user_passkey(sba, &req->bdaddr) < 0)
hci_send_cmd(dev, OGF_LINK_CTL,
OCF_USER_PASSKEY_NEG_REPLY, 6, ptr);
- else
- hcid_dbus_new_auth_request(sba, &req->bdaddr,
- AUTH_TYPE_PASSKEY);
}
static void user_passkey_notify(int dev, bdaddr_t *sba, void *ptr)
{
evt_user_passkey_notify *req = ptr;
- if (hcid_dbus_user_notify(sba, &req->bdaddr, btohl(req->passkey)) == 0)
- hcid_dbus_new_auth_request(sba, &req->bdaddr, AUTH_TYPE_NOTIFY);
+ hcid_dbus_user_notify(sba, &req->bdaddr, btohl(req->passkey));
}
static void remote_oob_data_request(int dev, bdaddr_t *sba, void *ptr)
@@ -522,7 +515,6 @@ static void pin_code_request(int dev, bdaddr_t *sba, bdaddr_t *dba)
/* Request PIN from passkey agent */
if (hcid_dbus_request_pin(dev, sba, ci) < 0)
goto reject;
- hcid_dbus_new_auth_request(sba, dba, AUTH_TYPE_PINCODE);
}
}