Bluetooth: GATT: Add connection authentication check
If attribute requires authentication to be read or written, we check if current security level (should be BT_SECURITY_HIGH or higher) allows to perform such operations on this attribute. Change-Id: Ibba542ac96af00722370eba77d6c929cda520fd8 Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
parent
a141da9756
commit
967776deed
1 changed files with 6 additions and 1 deletions
|
@ -654,8 +654,13 @@ static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
|
||||
mask &= attr->perm;
|
||||
if (mask & BT_GATT_PERM_AUTHEN_MASK) {
|
||||
/* TODO: Check conn authentication */
|
||||
#if defined(CONFIG_BLUETOOTH_SMP)
|
||||
if (conn->sec_level < BT_SECURITY_HIGH) {
|
||||
return BT_ATT_ERR_AUTHENTICATION;
|
||||
}
|
||||
#else
|
||||
return BT_ATT_ERR_AUTHENTICATION;
|
||||
#endif /* CONFIG_BLUETOOTH_SMP */
|
||||
}
|
||||
|
||||
if ((mask & BT_GATT_PERM_ENCRYPT_MASK)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue