2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

fix: usr: Restore values when dig prints command line

Options of the form `[+-]option=<value>` failed to display the value on the printed command line. This has been fixed.

Closes #4993

Merge branch '4993-dig-restore-command-line-values' into 'main'

See merge request isc-projects/bind9!9653
This commit is contained in:
Mark Andrews
2024-10-18 02:09:38 +00:00

View File

@@ -1824,9 +1824,12 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
"specified");
goto exit_or_usage;
}
extra = strtok_r(NULL, "\0",
extra = strtok_r(NULL, "",
&last);
save_opt(lookup, code, extra);
if (extra != NULL) {
extra[-1] = ':';
}
break;
default:
goto invalid_option;
@@ -2555,6 +2558,9 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
fprintf(stderr, "Invalid option: +%s\n", option);
usage();
}
if (value != NULL) {
value[-1] = '=';
}
return (lookup);
#if !TARGET_OS_IPHONE
@@ -2814,8 +2820,8 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
* secret */
usage();
}
if ((ptr3 = strtok_r(NULL, ":", &last)) != NULL) { /* secret or
* NULL */
if ((ptr3 = strtok_r(NULL, "", &last)) != NULL) { /* secret or
* NULL */
parse_hmac(ptr);
ptr = ptr2;
ptr2 = ptr3;
@@ -2826,6 +2832,10 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
/* XXXONDREJ: FIXME */
strlcpy(keynametext, ptr, sizeof(keynametext));
strlcpy(keysecret, ptr2, sizeof(keysecret));
if (ptr3 != NULL) {
ptr[-1] = ':';
}
ptr2[-1] = ':';
return (value_from_next);
case 'x':
if (*need_clone) {