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

Function RM_CreateModuleUser

app/redis-6.2.6/src/module.c:6493–6501  ·  view source on GitHub ↗

Creates a Redis ACL user that the module can use to authenticate a client. * After obtaining the user, the module should set what such user can do * using the RM_SetUserACL() function. Once configured, the user * can be used in order to authenticate a connection, with the specified * ACL rules, using the RedisModule_AuthClientWithUser() function. * * Note that: * * * Users created here are

Source from the content-addressed store, hash-verified

6491 * wants to invalidate the user to define a new one with different
6492 * capabilities. */
6493RedisModuleUser *RM_CreateModuleUser(const char *name) {
6494 RedisModuleUser *new_user = zmalloc(sizeof(RedisModuleUser));
6495 new_user->user = ACLCreateUnlinkedUser();
6496
6497 /* Free the previous temporarily assigned name to assign the new one */
6498 sdsfree(new_user->user->name);
6499 new_user->user->name = sdsnew(name);
6500 return new_user;
6501}
6502
6503/* Frees a given user and disconnects all of the clients that have been
6504 * authenticated with it. See RM_CreateModuleUser for detailed usage.*/

Callers

nothing calls this directly

Calls 4

zmallocFunction · 0.85
ACLCreateUnlinkedUserFunction · 0.85
sdsfreeFunction · 0.85
sdsnewFunction · 0.85

Tested by

no test coverage detected