Skip to content

Commit

Permalink
Remove ACL extension entry on RemoveFabric (#21617)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Aug 9, 2022
1 parent be1e2d2 commit 5902334
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,24 @@ class Server

// Remove access control entries in reverse order (it could be any order, but reverse order
// will cause less churn in persistent storage).

// TODO(#19899): The fabric removal not remove ACL extensions
CHIP_ERROR aclErr = Access::GetAccessControl().DeleteAllEntriesForFabric(fabricIndex);
if (aclErr != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "Warning, failed to delete access control state for fabric index 0x%x: %" CHIP_ERROR_FORMAT,
static_cast<unsigned>(fabricIndex), aclErr.Format());
}

// Remove ACL extension entry for the given fabricIndex.
auto & storage = mServer->GetPersistentStorage();
DefaultStorageKeyAllocator key;
aclErr = storage.SyncDeleteKeyValue(key.AccessControlExtensionEntry(fabricIndex));

if (aclErr != CHIP_NO_ERROR && aclErr != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
ChipLogError(AppServer, "Warning, failed to delete ACL extension entry for fabric index 0x%x: %" CHIP_ERROR_FORMAT,
static_cast<unsigned>(fabricIndex), aclErr.Format());
}

mServer->GetCommissioningWindowManager().OnFabricRemoved(fabricIndex);
}

Expand Down

0 comments on commit 5902334

Please sign in to comment.