]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: when the user types a overly long password, beep and refuse
authorLennart Poettering <lennart@poettering.net>
Tue, 25 Mar 2014 00:27:05 +0000 (01:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 25 Mar 2014 00:27:45 +0000 (01:27 +0100)
Based on a similar patch from David Härdeman.

src/shared/ask-password-api.c

index 117f0c668747c15669154e2b4a764c69a124e8d3..96f16cc7f8358eb2a25835a687f66f20a3409d58 100644 (file)
@@ -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)