| 424 | } |
| 425 | |
| 426 | void validate_choice_vs_env(int ntype, int num1, int num2) |
| 427 | { |
| 428 | struct name_num_obj *nno = ntype == NSTR_COMPRESS ? &valid_compressions : &valid_checksums; |
| 429 | const char *list_str = getenv_nstr(ntype); |
| 430 | char tmpbuf[MAX_NSTR_STRLEN]; |
| 431 | |
| 432 | if (!list_str) |
| 433 | return; |
| 434 | |
| 435 | while (isSpace(list_str)) list_str++; |
| 436 | |
| 437 | if (!*list_str) |
| 438 | return; |
| 439 | |
| 440 | init_nno_saw(nno, 0); |
| 441 | parse_nni_str(nno, list_str, tmpbuf, MAX_NSTR_STRLEN); |
| 442 | |
| 443 | if (ntype == NSTR_CHECKSUM) /* If "md4" is in the env list, all the old MD4 choices are OK too. */ |
| 444 | nno->saw[CSUM_MD4_ARCHAIC] = nno->saw[CSUM_MD4_BUSTED] = nno->saw[CSUM_MD4_OLD] = nno->saw[CSUM_MD4]; |
| 445 | |
| 446 | if (!nno->saw[num1] || (num2 >= 0 && !nno->saw[num2])) { |
| 447 | rprintf(FERROR, "Your --%s-choice value (%s) was refused by the server.\n", |
| 448 | ntype == NSTR_COMPRESS ? "compress" : "checksum", |
| 449 | ntype == NSTR_COMPRESS ? compress_choice : checksum_choice); |
| 450 | exit_cleanup(RERR_UNSUPPORTED); |
| 451 | } |
| 452 | |
| 453 | free(nno->saw); |
| 454 | nno->saw = NULL; |
| 455 | } |
| 456 | |
| 457 | /* The saw buffer is initialized and used to store ordinal values from 1 to N |
| 458 | * for the order of the args in the array. If dup_markup == '\0', duplicates |
no test coverage detected