summaryrefslogtreecommitdiff
path: root/src/shared/ask-password-api.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-25 01:27:05 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-25 01:27:45 +0100
commit036eeac5a1799fa2c0ae11a14d8c667b5d303189 (patch)
tree5e3976fba77495e734f0472913146a62f3d9c712 /src/shared/ask-password-api.c
parentaf7424af70d063412c09b0125f4d4a39865210dc (diff)
ask-password: when the user types a overly long password, beep and refuse
Based on a similar patch from David Härdeman.
Diffstat (limited to 'src/shared/ask-password-api.c')
-rw-r--r--src/shared/ask-password-api.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 117f0c6687..96f16cc7f8 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -207,6 +207,11 @@ int ask_password_tty(
if (ttyfd >= 0)
loop_write(ttyfd, "(no echo) ", 10, false);
} else {
+ if (p >= sizeof(passphrase)-1) {
+ loop_write(ttyfd, "\a", 1, false);
+ continue;
+ }
+
passphrase[p++] = c;
if (!silent_mode && ttyfd >= 0)