Rewrite the user option. */
| 1651 | |
| 1652 | /* Rewrite the user option. */ |
| 1653 | void rewriteConfigUserOption(struct rewriteConfigState *state) { |
| 1654 | /* If there is a user file defined we just mark this configuration |
| 1655 | * directive as processed, so that all the lines containing users |
| 1656 | * inside the config file gets discarded. */ |
| 1657 | if (g_pserver->acl_filename[0] != '\0') { |
| 1658 | rewriteConfigMarkAsProcessed(state,"user"); |
| 1659 | return; |
| 1660 | } |
| 1661 | |
| 1662 | /* Otherwise scan the list of users and rewrite every line. Note that |
| 1663 | * in case the list here is empty, the effect will just be to comment |
| 1664 | * all the users directive inside the config file. */ |
| 1665 | raxIterator ri; |
| 1666 | raxStart(&ri,Users); |
| 1667 | raxSeek(&ri,"^",NULL,0); |
| 1668 | while(raxNext(&ri)) { |
| 1669 | user *u = (user*)ri.data; |
| 1670 | sds line = sdsnew("user "); |
| 1671 | line = sdscatsds(line,u->name); |
| 1672 | line = sdscatlen(line," ",1); |
| 1673 | sds descr = ACLDescribeUser(u); |
| 1674 | line = sdscatsds(line,descr); |
| 1675 | sdsfree(descr); |
| 1676 | rewriteConfigRewriteLine(state,"user",line,1); |
| 1677 | } |
| 1678 | raxStop(&ri); |
| 1679 | |
| 1680 | /* Mark "user" as processed in case there are no defined users. */ |
| 1681 | rewriteConfigMarkAsProcessed(state,"user"); |
| 1682 | } |
| 1683 | |
| 1684 | /* Rewrite the dir option, always using absolute paths.*/ |
| 1685 | void rewriteConfigDirOption(struct rewriteConfigState *state) { |
no test coverage detected