Flush the entire table of subcommands. This is useful on +@all, -@all * or similar to return back to the minimal memory usage (and checks to do) * for the user. */
| 704 | * or similar to return back to the minimal memory usage (and checks to do) |
| 705 | * for the user. */ |
| 706 | void ACLResetSubcommands(user *u) { |
| 707 | if (u->allowed_subcommands == NULL) return; |
| 708 | for (int j = 0; j < USER_COMMAND_BITS_COUNT; j++) { |
| 709 | if (u->allowed_subcommands[j]) { |
| 710 | for (int i = 0; u->allowed_subcommands[j][i]; i++) |
| 711 | sdsfree(u->allowed_subcommands[j][i]); |
| 712 | zfree(u->allowed_subcommands[j]); |
| 713 | } |
| 714 | } |
| 715 | zfree(u->allowed_subcommands); |
| 716 | u->allowed_subcommands = NULL; |
| 717 | } |
| 718 | |
| 719 | /* Add a subcommand to the list of subcommands for the user 'u' and |
| 720 | * the command id specified. */ |
no test coverage detected