34 lines
1.1 KiB
Diff
34 lines
1.1 KiB
Diff
|
From 036eeac5a1799fa2c0ae11a14d8c667b5d303189 Mon Sep 17 00:00:00 2001
|
||
|
From: Lennart Poettering <lennart@poettering.net>
|
||
|
Date: Tue, 25 Mar 2014 01:27:05 +0100
|
||
|
Subject: [PATCH] ask-password: when the user types a overly long password,
|
||
|
beep and refuse
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Based on a similar patch from David Härdeman.
|
||
|
---
|
||
|
src/shared/ask-password-api.c | 5 +++++
|
||
|
1 file changed, 5 insertions(+)
|
||
|
|
||
|
diff --git src/shared/ask-password-api.c src/shared/ask-password-api.c
|
||
|
index 117f0c6..96f16cc 100644
|
||
|
--- src/shared/ask-password-api.c
|
||
|
+++ 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)
|
||
|
--
|
||
|
1.7.9.2
|
||
|
|