summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2019-09-19 15:18:18 +0200
committerFranck Bui <fbui@suse.com>2019-10-05 08:08:24 +0200
commitd325f2443eceb423a02b26852065a25ed21a992c (patch)
tree0f3044a0cfd9a3dac082979093ee5b3ff175b710 /src/shared
parent1503bcb12ec9ae775a0b3435c9f2dfdd5204e09e (diff)
downloadsystemd-d325f2443eceb423a02b26852065a25ed21a992c.tar.gz
tty-ask-pwd-agent: give the possiblity to skip a password prompt
If multiple passwords are waiting the agent will prompt for each of them. Give the possiblity to the user to skip some of them by pressing 'C-d'.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ask-password-api.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index c41fa2dea6..46f06fe99b 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -371,6 +371,13 @@ int ask_password_tty(
if (n == 0 || c == '\n' || c == 0)
break;
+ if (c == 4) { /* C-d also known as EOT */
+ if (ttyfd >= 0)
+ (void) loop_write(ttyfd, "(skipped)", 9, false);
+
+ goto skipped;
+ }
+
if (c == 21) { /* C-u */
if (!(flags & ASK_PASSWORD_SILENT))
@@ -467,6 +474,7 @@ int ask_password_tty(
if (r < 0)
goto finish;
+skipped:
if (keyname)
(void) add_to_keyring_and_log(keyname, flags, l);