Rewrite the user option. */
| 1400 | |
| 1401 | /* Rewrite the user option. */ |
| 1402 | void 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.*/ |
| 1434 | void rewriteConfigDirOption(struct rewriteConfigState *state) { |
no test coverage detected