Skip to content

Commit 5902334

Browse files
yufengwangcapull[bot]
authored andcommitted
Remove ACL extension entry on RemoveFabric (#21617)
1 parent be1e2d2 commit 5902334

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/app/server/Server.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,24 @@ class Server
437437

438438
// Remove access control entries in reverse order (it could be any order, but reverse order
439439
// will cause less churn in persistent storage).
440-
441-
// TODO(#19899): The fabric removal not remove ACL extensions
442440
CHIP_ERROR aclErr = Access::GetAccessControl().DeleteAllEntriesForFabric(fabricIndex);
443441
if (aclErr != CHIP_NO_ERROR)
444442
{
445443
ChipLogError(AppServer, "Warning, failed to delete access control state for fabric index 0x%x: %" CHIP_ERROR_FORMAT,
446444
static_cast<unsigned>(fabricIndex), aclErr.Format());
447445
}
448446

447+
// Remove ACL extension entry for the given fabricIndex.
448+
auto & storage = mServer->GetPersistentStorage();
449+
DefaultStorageKeyAllocator key;
450+
aclErr = storage.SyncDeleteKeyValue(key.AccessControlExtensionEntry(fabricIndex));
451+
452+
if (aclErr != CHIP_NO_ERROR && aclErr != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
453+
{
454+
ChipLogError(AppServer, "Warning, failed to delete ACL extension entry for fabric index 0x%x: %" CHIP_ERROR_FORMAT,
455+
static_cast<unsigned>(fabricIndex), aclErr.Format());
456+
}
457+
449458
mServer->GetCommissioningWindowManager().OnFabricRemoved(fabricIndex);
450459
}
451460

0 commit comments

Comments
 (0)