summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-03-02 16:04:18 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-03-03 13:44:08 +0200
commit064f48ad6dd0eb4becb94f5492b6c78218065f19 (patch)
tree131208ae6ef09984f0108e2c886f8ec3be3152ff
parent8e493e8416e5525042b8b4a34eb2b7084725438b (diff)
downloadbluez-064f48ad6dd0eb4becb94f5492b6c78218065f19.tar.gz
shared/gatt-client: Fix not detecting BT_ATT_SECURITY_AUTO
Using bt_gatt_security cannot detect if BT_ATT_SECURITY_AUTO is enabled since it actually checks the current level when operating over L2CAP, so instead use io_sec_level internal field to detect the security level in which ATT is supposed to be operating.
-rw-r--r--src/shared/att.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/att.c b/src/shared/att.c
index 3a84783b6..7b2075733 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -573,10 +573,11 @@ static bool change_security(struct bt_att *att, uint8_t ecode)
{
int security;
- security = bt_att_get_security(att);
- if (security != BT_ATT_SECURITY_AUTO)
+ if (att->io_sec_level != BT_ATT_SECURITY_AUTO)
return false;
+ security = bt_att_get_security(att);
+
if (ecode == BT_ATT_ERROR_INSUFFICIENT_ENCRYPTION &&
security < BT_ATT_SECURITY_MEDIUM)
security = BT_ATT_SECURITY_MEDIUM;
@@ -979,7 +980,7 @@ struct bt_att *bt_att_new(int fd, bool ext_signed)
att->io_on_l2cap = is_io_l2cap_based(att->fd);
if (!att->io_on_l2cap)
- att->io_sec_level = BT_SECURITY_LOW;
+ att->io_sec_level = BT_ATT_SECURITY_LOW;
return bt_att_ref(att);