* Tweak the option table to disable all options that the rsyncd.conf * file has told us to refuse. **/
| 942 | * file has told us to refuse. |
| 943 | **/ |
| 944 | static void set_refuse_options(void) |
| 945 | { |
| 946 | struct poptOption *op, *list_end = NULL; |
| 947 | char *cp, *ref = lp_refuse_options(module_id); |
| 948 | int negated; |
| 949 | |
| 950 | if (!ref) |
| 951 | ref = ""; |
| 952 | |
| 953 | if (!am_daemon) |
| 954 | ref = ""; |
| 955 | |
| 956 | /* We abuse the descrip field in poptOption to make it easy to flag which options |
| 957 | * are refused (since we don't use it otherwise). Start by marking all options |
| 958 | * as "a"ccepted with a few options also marked as non-wild. */ |
| 959 | for (op = long_options; ; op++) { |
| 960 | const char *longName = op->longName ? op->longName : ""; |
| 961 | if (!op->longName && !op->shortName) { |
| 962 | list_end = op; |
| 963 | break; |
| 964 | } |
| 965 | if (!am_daemon |
| 966 | || op->shortName == 'e' /* Required for compatibility flags */ |
| 967 | || op->shortName == '0' /* --from0 just modifies --files-from, so refuse that instead (or not) */ |
| 968 | || op->shortName == 's' /* --secluded-args is always OK */ |
| 969 | || op->shortName == 'n' /* --dry-run is always OK */ |
| 970 | || strcmp("iconv", longName) == 0 |
| 971 | || strcmp("no-iconv", longName) == 0 |
| 972 | || strcmp("checksum-seed", longName) == 0 |
| 973 | || strcmp("copy-devices", longName) == 0 /* disable wild-match (it gets refused below) */ |
| 974 | || strcmp("write-devices", longName) == 0 /* disable wild-match (it gets refused below) */ |
| 975 | || strcmp("log-format", longName) == 0 /* aka out-format (NOT log-file-format) */ |
| 976 | || strcmp("sender", longName) == 0 |
| 977 | || strcmp("server", longName) == 0) |
| 978 | op->descrip = "a="; /* exact-match only */ |
| 979 | else |
| 980 | op->descrip = "a*"; /* wild-card-able */ |
| 981 | } |
| 982 | assert(list_end != NULL); |
| 983 | |
| 984 | if (am_daemon) { /* Refused by default, but can be accepted via a negated exact match. */ |
| 985 | parse_one_refuse_match(0, "copy-devices", list_end); |
| 986 | parse_one_refuse_match(0, "write-devices", list_end); |
| 987 | } |
| 988 | |
| 989 | while (1) { |
| 990 | while (*ref == ' ') ref++; |
| 991 | if (!*ref) |
| 992 | break; |
| 993 | if ((cp = strchr(ref, ' ')) != NULL) |
| 994 | *cp = '\0'; |
| 995 | negated = *ref == '!'; |
| 996 | if (negated && ref[1]) |
| 997 | ref++; |
| 998 | parse_one_refuse_match(negated, ref, list_end); |
| 999 | if (!cp) |
| 1000 | break; |
| 1001 | *cp = ' '; |
no test coverage detected