Bluetooth: GATT: Split Authorization Permission for Read and Write
According to Core Specification 4.2 Vol 3, Part G, 3.3.3.4, Server Characteristic Configuration descriptor shall be: "Readable with no authentication or authorization. Writable with authentication and authorization defined by a higher layer specification or is implementation specific." So there shall be separate authorization permissions for write and read access. Change-Id: Ia2850acbb976571743bf96cf9cbe0c1128534073 Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
parent
3f667a45f8
commit
4e5d6581c0
2 changed files with 17 additions and 6 deletions
|
@ -48,15 +48,17 @@
|
|||
#define BT_GATT_PERM_READ_MASK (BT_GATT_PERM_READ | \
|
||||
BT_GATT_PERM_READ_ENCRYPT | \
|
||||
BT_GATT_PERM_READ_AUTHEN | \
|
||||
BT_GATT_PERM_AUTHOR)
|
||||
BT_GATT_PERM_READ_AUTHOR)
|
||||
#define BT_GATT_PERM_WRITE_MASK (BT_GATT_PERM_WRITE | \
|
||||
BT_GATT_PERM_WRITE_ENCRYPT | \
|
||||
BT_GATT_PERM_WRITE_AUTHEN | \
|
||||
BT_GATT_PERM_AUTHOR)
|
||||
BT_GATT_PERM_WRITE_AUTHOR)
|
||||
#define BT_GATT_PERM_ENCRYPT_MASK (BT_GATT_PERM_READ_ENCRYPT | \
|
||||
BT_GATT_PERM_WRITE_ENCRYPT)
|
||||
#define BT_GATT_PERM_AUTHEN_MASK (BT_GATT_PERM_READ_AUTHEN | \
|
||||
BT_GATT_PERM_WRITE_AUTHEN)
|
||||
#define BT_GATT_PERM_AUTHOR_MASK (BT_GATT_PERM_READ_AUTHOR | \
|
||||
BT_GATT_PERM_WRITE_AUTHOR)
|
||||
#define BT_ATT_OP_CMD_FLAG 0x40
|
||||
|
||||
/* ATT request context */
|
||||
|
@ -537,7 +539,8 @@ static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
#endif /* CONFIG_BLUETOOTH_SMP */
|
||||
}
|
||||
|
||||
if (mask & BT_GATT_PERM_AUTHOR) {
|
||||
if (mask & BT_GATT_PERM_AUTHOR_MASK) {
|
||||
/* TODO Authorization handled by application */
|
||||
return BT_ATT_ERR_AUTHORIZATION;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue