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. */
| 695 | * or similar to return back to the minimal memory usage (and checks to do) |
| 696 | * for the user. */ |
| 697 | void ACLResetSubcommands(user *u) { |
| 698 | if (u->allowed_subcommands == NULL) return; |
| 699 | for (int j = 0; j < USER_COMMAND_BITS_COUNT; j++) { |
| 700 | if (u->allowed_subcommands[j]) { |
| 701 | for (int i = 0; u->allowed_subcommands[j][i]; i++) |
| 702 | sdsfree(u->allowed_subcommands[j][i]); |
| 703 | zfree(u->allowed_subcommands[j]); |
| 704 | } |
| 705 | } |
| 706 | zfree(u->allowed_subcommands); |
| 707 | u->allowed_subcommands = NULL; |
| 708 | } |
| 709 | |
| 710 | /* Add a subcommand to the list of subcommands for the user 'u' and |
| 711 | * the command id specified. */ |
no test coverage detected