1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00

ask-password: when the user types a overly long password, beep and refuse

Based on a similar patch from David Härdeman.
This commit is contained in:
Lennart Poettering 2014-03-25 01:27:05 +01:00
parent af7424af70
commit 036eeac5a1
Notes: Lennart Poettering 2014-03-25 04:09:46 +01:00
Backport: bugfix

View File

@ -207,6 +207,11 @@ int ask_password_tty(
if (ttyfd >= 0) if (ttyfd >= 0)
loop_write(ttyfd, "(no echo) ", 10, false); loop_write(ttyfd, "(no echo) ", 10, false);
} else { } else {
if (p >= sizeof(passphrase)-1) {
loop_write(ttyfd, "\a", 1, false);
continue;
}
passphrase[p++] = c; passphrase[p++] = c;
if (!silent_mode && ttyfd >= 0) if (!silent_mode && ttyfd >= 0)