MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / ACLAuthenticateUser

Function ACLAuthenticateUser

src/acl.cpp:1119–1129  ·  view source on GitHub ↗

This is like ACLCheckUserCredentials(), however if the user/pass * are correct, the connection is put in authenticated state and the * connection user reference is populated. * * The return value is C_OK or C_ERR with the same meaning as * ACLCheckUserCredentials(). */

Source from the content-addressed store, hash-verified

1117 * The return value is C_OK or C_ERR with the same meaning as
1118 * ACLCheckUserCredentials(). */
1119int ACLAuthenticateUser(client *c, robj *username, robj *password) {
1120 if (ACLCheckUserCredentials(username,password) == C_OK) {
1121 c->authenticated = 1;
1122 c->user = ACLGetUserByName((sds)ptrFromObj(username),sdslen((sds)ptrFromObj(username)));
1123 moduleNotifyUserChanged(c);
1124 return C_OK;
1125 } else {
1126 addACLLogEntry(c,ACL_DENIED_AUTH,0,szFromObj(username));
1127 return C_ERR;
1128 }
1129}
1130
1131/* For ACL purposes, every user has a bitmap with the commands that such
1132 * user is allowed to execute. In order to populate the bitmap, every command

Callers 2

helloCommandFunction · 0.85
authCommandFunction · 0.85

Calls 7

ACLCheckUserCredentialsFunction · 0.85
ACLGetUserByNameFunction · 0.85
ptrFromObjFunction · 0.85
sdslenFunction · 0.85
moduleNotifyUserChangedFunction · 0.85
addACLLogEntryFunction · 0.85
szFromObjFunction · 0.85

Tested by

no test coverage detected