Copy the user ACL rules from the source user 'src' to the destination * user 'dst' so that at the end of the process they'll have exactly the * same rules (but the names will continue to be the original ones). */
| 335 | * user 'dst' so that at the end of the process they'll have exactly the |
| 336 | * same rules (but the names will continue to be the original ones). */ |
| 337 | void ACLCopyUser(user *dst, user *src) { |
| 338 | listRelease(dst->passwords); |
| 339 | listRelease(dst->patterns); |
| 340 | listRelease(dst->channels); |
| 341 | dst->passwords = listDup(src->passwords); |
| 342 | dst->patterns = listDup(src->patterns); |
| 343 | dst->channels = listDup(src->channels); |
| 344 | memcpy(dst->allowed_commands,src->allowed_commands, |
| 345 | sizeof(dst->allowed_commands)); |
| 346 | dst->flags = src->flags; |
| 347 | ACLResetSubcommands(dst); |
| 348 | /* Copy the allowed subcommands array of array of SDS strings. */ |
| 349 | if (src->allowed_subcommands) { |
| 350 | for (int j = 0; j < USER_COMMAND_BITS_COUNT; j++) { |
| 351 | if (src->allowed_subcommands[j]) { |
| 352 | for (int i = 0; src->allowed_subcommands[j][i]; i++) |
| 353 | { |
| 354 | ACLAddAllowedSubcommand(dst, j, |
| 355 | src->allowed_subcommands[j][i]); |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | /* Free all the users registered in the radix tree 'users' and free the |
| 363 | * radix tree itself. */ |
no test coverage detected