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

Function ACLCopyUser

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

Copy the user ACL rules from the source user 'src' to the destination * user 'dst' so that at the end of the process they'll have exactly the * same rules (but the names will continue to be the original ones). */

Source from the content-addressed store, hash-verified

326 * user 'dst' so that at the end of the process they'll have exactly the
327 * same rules (but the names will continue to be the original ones). */
328void ACLCopyUser(user *dst, user *src) {
329 listRelease(dst->passwords);
330 listRelease(dst->patterns);
331 listRelease(dst->channels);
332 dst->passwords = listDup(src->passwords);
333 dst->patterns = listDup(src->patterns);
334 dst->channels = listDup(src->channels);
335 memcpy(dst->allowed_commands,src->allowed_commands,
336 sizeof(dst->allowed_commands));
337 dst->flags = src->flags;
338 ACLResetSubcommands(dst);
339 /* Copy the allowed subcommands array of array of SDS strings. */
340 if (src->allowed_subcommands) {
341 for (int j = 0; j < USER_COMMAND_BITS_COUNT; j++) {
342 if (src->allowed_subcommands[j]) {
343 for (int i = 0; src->allowed_subcommands[j][i]; i++)
344 {
345 ACLAddAllowedSubcommand(dst, j,
346 src->allowed_subcommands[j][i]);
347 }
348 }
349 }
350 }
351}
352
353/* Free all the users registered in the radix tree 'users' and free the
354 * radix tree itself. */

Callers 2

ACLLoadFromFileFunction · 0.85
aclCommandFunction · 0.85

Calls 5

listReleaseFunction · 0.85
listDupFunction · 0.85
ACLResetSubcommandsFunction · 0.85
ACLAddAllowedSubcommandFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected