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

Function rewriteConfigUserOption

app/redis-6.2.6/src/config.c:1402–1431  ·  view source on GitHub ↗

Rewrite the user option. */

Source from the content-addressed store, hash-verified

1400
1401/* Rewrite the user option. */
1402void rewriteConfigUserOption(struct rewriteConfigState *state) {
1403 /* If there is a user file defined we just mark this configuration
1404 * directive as processed, so that all the lines containing users
1405 * inside the config file gets discarded. */
1406 if (server.acl_filename[0] != '\0') {
1407 rewriteConfigMarkAsProcessed(state,"user");
1408 return;
1409 }
1410
1411 /* Otherwise scan the list of users and rewrite every line. Note that
1412 * in case the list here is empty, the effect will just be to comment
1413 * all the users directive inside the config file. */
1414 raxIterator ri;
1415 raxStart(&ri,Users);
1416 raxSeek(&ri,"^",NULL,0);
1417 while(raxNext(&ri)) {
1418 user *u = ri.data;
1419 sds line = sdsnew("user ");
1420 line = sdscatsds(line,u->name);
1421 line = sdscatlen(line," ",1);
1422 sds descr = ACLDescribeUser(u);
1423 line = sdscatsds(line,descr);
1424 sdsfree(descr);
1425 rewriteConfigRewriteLine(state,"user",line,1);
1426 }
1427 raxStop(&ri);
1428
1429 /* Mark "user" as processed in case there are no defined users. */
1430 rewriteConfigMarkAsProcessed(state,"user");
1431}
1432
1433/* Rewrite the dir option, always using absolute paths.*/
1434void rewriteConfigDirOption(struct rewriteConfigState *state) {

Callers 1

rewriteConfigFunction · 0.85

Calls 11

raxStartFunction · 0.85
raxSeekFunction · 0.85
raxNextFunction · 0.85
sdsnewFunction · 0.85
sdscatsdsFunction · 0.85
sdscatlenFunction · 0.85
ACLDescribeUserFunction · 0.85
sdsfreeFunction · 0.85
rewriteConfigRewriteLineFunction · 0.85
raxStopFunction · 0.85

Tested by

no test coverage detected