Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] sulogin: make getpasswd(...) return NULL on ^D
@ 2016-11-28 16:24 Andreas Henriksson
  2016-11-28 16:24 ` [PATCH] sulogin: bail out from getpasswd(...) on timeout Andreas Henriksson
  2016-12-07 12:34 ` [PATCH] sulogin: make getpasswd(...) return NULL on ^D Karel Zak
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Henriksson @ 2016-11-28 16:24 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

This makes the caller bail out early instead of evaluating the
input as a password.

Reported-by: Bjørn Mork <bjorn@mork.no>
Addresses: http://bugs.debian.org/846112
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 login-utils/sulogin.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 1c4313a..43117b2 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -695,6 +695,7 @@ static char *getpasswd(struct console *con)
 				ptr--;
 			break;
 		case CEOF:
+			ret = NULL;
 			goto quit;
 		default:
 			if ((size_t)(ptr - &pass[0]) >= (sizeof(pass) -1 )) {
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] sulogin: bail out from getpasswd(...) on timeout
  2016-11-28 16:24 [PATCH] sulogin: make getpasswd(...) return NULL on ^D Andreas Henriksson
@ 2016-11-28 16:24 ` Andreas Henriksson
  2016-12-07 12:34 ` [PATCH] sulogin: make getpasswd(...) return NULL on ^D Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Henriksson @ 2016-11-28 16:24 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

If timeout happens while waiting in prompt, bail out instead
of retrying.

Reported-by: Bjørn Mork <bjorn@mork.no>
Addresses: http://bugs.debian.org/846107
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 login-utils/sulogin.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 43117b2..79a9274 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -645,6 +645,10 @@ static char *getpasswd(struct console *con)
 	while (cp->eol == '\0') {
 		if (read(fd, &c, 1) < 1) {
 			if (errno == EINTR || errno == EAGAIN) {
+				if (alarm_rised) {
+					ret = NULL;
+					goto quit;
+				}
 				xusleep(250000);
 				continue;
 			}
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sulogin: make getpasswd(...) return NULL on ^D
  2016-11-28 16:24 [PATCH] sulogin: make getpasswd(...) return NULL on ^D Andreas Henriksson
  2016-11-28 16:24 ` [PATCH] sulogin: bail out from getpasswd(...) on timeout Andreas Henriksson
@ 2016-12-07 12:34 ` Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2016-12-07 12:34 UTC (permalink / raw)
  To: Andreas Henriksson, Bjørn Mork; +Cc: util-linux

On Mon, Nov 28, 2016 at 05:24:49PM +0100, Andreas Henriksson wrote:
> Reported-by: Bjørn Mork <bjorn@mork.no>
> Addresses: http://bugs.debian.org/846112
> Signed-off-by: Andreas Henriksson <andreas@fatal.se>

Applied (both patches), thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-07 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-28 16:24 [PATCH] sulogin: make getpasswd(...) return NULL on ^D Andreas Henriksson
2016-11-28 16:24 ` [PATCH] sulogin: bail out from getpasswd(...) on timeout Andreas Henriksson
2016-12-07 12:34 ` [PATCH] sulogin: make getpasswd(...) return NULL on ^D Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox