Skip to content

Commit

Permalink
Stop sending status responses from inside findUserIndexByCredential. (#…
Browse files Browse the repository at this point in the history
…25026)

A utility function to look up information shoud not be sending status responses
that would override what its callers might want to do with that information.

findUserIndexByCredential has the following callers:

* getCredentialStatusCommandHandler: this sends an error response if
  findUserIndexByCredential returns false.
* modifyProgrammingPIN: this returns a failure status if
  findUserIndexByCredential returns false, and its only callsite in
  DoorLockServer::setCredentialCommandHandler then sends a status response.
* DoorLockServer::clearCredential: this returns a failure status if
  findUserIndexByCredential returns false, and its callers in
  DoorLockServer::clearCredentialCommandHandler then send a status response.
* DoorLockServer::HandleRemoteLockOperation: this sends an error response if
  findUserIndexByCredential returns false.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Nov 14, 2023
1 parent 55fb6ec commit b071085
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,6 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred
if (!emberAfPluginDoorLockGetUser(endpointId, i, user))
{
ChipLogError(Zcl, "[GetCredentialStatus] Unable to get user: app error [userIndex=%d]", i);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return false;
}

Expand Down Expand Up @@ -1701,7 +1700,6 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred
if (!emberAfPluginDoorLockGetUser(endpointId, i, user))
{
ChipLogError(Zcl, "[findUserIndexByCredential] Unable to get user: app error [userIndex=%d]", i);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return false;
}

Expand All @@ -1725,7 +1723,6 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred
"[findUserIndexByCredential] Unable to get credential: app error "
"[userIndex=%d,credentialIndex=%d,credentialType=%u]",
i, credential.CredentialIndex, to_underlying(credentialType));
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return false;
}

Expand All @@ -1736,7 +1733,6 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred
"not occupied "
"[userIndex=%d,credentialIndex=%d,credentialType=%u]",
i, credential.CredentialIndex, to_underlying(credentialType));
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE);
return false;
}

Expand Down

0 comments on commit b071085

Please sign in to comment.