From a68d1fe4a409288aa1e52a19c8b3cd7ac54e7bb1 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 22 Mar 2011 17:51:21 -0300 Subject: [PATCH] Fix ATT error code response for authentication This patch fix the error code in the Error Response PDU. If an attribute requires authentication and the link security level doesn't meet the requirements the server should reply Insufficient Authentication(0x05). --- src/attrib-server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/attrib-server.c b/src/attrib-server.c index 74a1c8d80..9543da6de 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -167,11 +167,12 @@ static uint8_t att_check_reqs(struct gatt_channel *channel, uint8_t opcode, { /* FIXME: currently, it is assumed an encrypted link is enough for * authentication. This will allow to enable the SMP negotiation once - * it is on upstream kernel. */ + * it is on upstream kernel. High security level should be mapped + * to authentication and medium to encryption permission. */ if (!channel->encrypted) channel->encrypted = g_attrib_is_encrypted(channel->attrib); if (reqs == ATT_AUTHENTICATION && !channel->encrypted) - return ATT_ECODE_INSUFF_ENC; + return ATT_ECODE_INSUFF_AUTHEN; switch (opcode) { case ATT_OP_READ_BY_GROUP_REQ: -- 2.47.3