1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

resolvectl: introduce --no-ask-password option

This commit is contained in:
Yu Watanabe 2024-08-19 11:36:22 +09:00
parent 1d7fa67789
commit 5703301ada
4 changed files with 20 additions and 1 deletions

View File

@ -495,6 +495,16 @@
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem>
<para>Do not query the user for authentication for privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="json" />
<xi:include href="standard-options.xml" xpointer="j" />
<xi:include href="standard-options.xml" xpointer="no-pager" />

View File

@ -38,7 +38,7 @@ _resolvectl() {
[STANDALONE]='-h --help --version -4 -6 --legend=no --cname=no
--validate=no --synthesize=no --cache=no --relax-single-label=no --zone=no
--trust-anchor=no --network=no --service-address=no
--service-txt=no --search=no --stale-data=no --no-pager'
--service-txt=no --search=no --stale-data=no --no-pager --no-ask-password'
[ARG]='-t --type -c --class -i --interface -p --protocol --raw --json'
)
local -A VERBS=(

View File

@ -94,4 +94,6 @@ _arguments \
'--search=[Do not use search domains]:BOOL:(yes no)' \
'--raw=[Dump the answer as binary data]:RAW:(payload packet)' \
'--json=[Output as JSON]:JSON:(pretty short off)' \
'--no-pager[Do not pipe output into a pager]' \
'--no-ask-password[Do not prompt for password]' \
'*::default: _resolvectl_commands'

View File

@ -3352,6 +3352,7 @@ static int native_help(void) {
" -h --help Show this help\n"
" --version Show package version\n"
" --no-pager Do not pipe output into a pager\n"
" --no-ask-password Do not prompt for password\n"
" -4 Resolve IPv4 addresses\n"
" -6 Resolve IPv6 addresses\n"
" -i --interface=INTERFACE Look on interface\n"
@ -3724,6 +3725,7 @@ static int native_parse_argv(int argc, char *argv[]) {
ARG_RAW,
ARG_SEARCH,
ARG_NO_PAGER,
ARG_NO_ASK_PASSWORD,
ARG_JSON,
ARG_STALE_DATA,
ARG_RELAX_SINGLE_LABEL,
@ -3749,6 +3751,7 @@ static int native_parse_argv(int argc, char *argv[]) {
{ "raw", optional_argument, NULL, ARG_RAW },
{ "search", required_argument, NULL, ARG_SEARCH },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
{ "json", required_argument, NULL, ARG_JSON },
{ "stale-data", required_argument, NULL, ARG_STALE_DATA },
{ "relax-single-label", required_argument, NULL, ARG_RELAX_SINGLE_LABEL },
@ -3949,6 +3952,10 @@ static int native_parse_argv(int argc, char *argv[]) {
arg_pager_flags |= PAGER_DISABLE;
break;
case ARG_NO_ASK_PASSWORD:
arg_ask_password = false;
break;
case ARG_JSON:
r = parse_json_argument(optarg, &arg_json_format_flags);
if (r <= 0)