Skip to content

Commit

Permalink
Resolve issue when adding same index with different credential type. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton36 authored and pull[bot] committed Jan 30, 2024
1 parent a6d9013 commit 5312649
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2085,8 +2085,11 @@ DlStatus DoorLockServer::addCredentialToUser(chip::EndpointId endpointId, chip::

for (size_t i = 0; i < user.credentials.size(); ++i)
{
// appclusters, 5.2.4.40: user should not be already associated with given credentialIndex
if (user.credentials.data()[i].CredentialIndex == credential.CredentialIndex)
// appclusters, 5.2.4.40: CredentialIndex in CredentialStruct provided SHALL be for an available credential slot.
// appclusters, 5.6.3.2: This is the index of the specific credential used to authorize
// the lock operation in the list of credentials identified by CredentialType
if (user.credentials.data()[i].CredentialIndex == credential.CredentialIndex &&
user.credentials.data()[i].CredentialType == credential.CredentialType)
{
emberAfDoorLockClusterPrintln(
"[AddCredentialToUser] Unable to add credential to user: credential with this index is already associated "
Expand Down

0 comments on commit 5312649

Please sign in to comment.