MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ACLCreateUnlinkedUser

Function ACLCreateUnlinkedUser

app/redis-6.2.6/src/acl.c:271–282  ·  view source on GitHub ↗

This function should be called when we need an unlinked "fake" user * we can use in order to validate ACL rules or for other similar reasons. * The user will not get linked to the Users radix tree. The returned * user should be released with ACLFreeUser() as usually. */

Source from the content-addressed store, hash-verified

269 * The user will not get linked to the Users radix tree. The returned
270 * user should be released with ACLFreeUser() as usually. */
271user *ACLCreateUnlinkedUser(void) {
272 char username[64];
273 for (int j = 0; ; j++) {
274 snprintf(username,sizeof(username),"__fakeuser:%d__",j);
275 user *fakeuser = ACLCreateUser(username,strlen(username));
276 if (fakeuser == NULL) continue;
277 int retval = raxRemove(Users,(unsigned char*) username,
278 strlen(username),NULL);
279 serverAssert(retval != 0);
280 return fakeuser;
281 }
282}
283
284/* Release the memory used by the user structure. Note that this function
285 * will not remove the user from the Users global radix tree. */

Callers 4

ACLAppendUserForLoadingFunction · 0.85
ACLLoadFromFileFunction · 0.85
aclCommandFunction · 0.85
RM_CreateModuleUserFunction · 0.85

Calls 3

snprintfFunction · 0.85
ACLCreateUserFunction · 0.85
raxRemoveFunction · 0.85

Tested by

no test coverage detected