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

Function ACLCheckPasswordHash

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

Given a hash and the hash length, returns C_OK if it is a valid password * hash, or C_ERR otherwise. */

Source from the content-addressed store, hash-verified

177/* Given a hash and the hash length, returns C_OK if it is a valid password
178 * hash, or C_ERR otherwise. */
179int ACLCheckPasswordHash(unsigned char *hash, int hashlen) {
180 if (hashlen != HASH_PASSWORD_LEN) {
181 return C_ERR;
182 }
183
184 /* Password hashes can only be characters that represent
185 * hexadecimal values, which are numbers and lowercase
186 * characters 'a' through 'f'. */
187 for(int i = 0; i < HASH_PASSWORD_LEN; i++) {
188 char c = hash[i];
189 if ((c < 'a' || c > 'f') && (c < '0' || c > '9')) {
190 return C_ERR;
191 }
192 }
193 return C_OK;
194}
195
196/* =============================================================================
197 * Low level ACL API

Callers 1

ACLSetUserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected