From e2dedae72472e411f4bc420755f1c38b2f71b834 Mon Sep 17 00:00:00 2001 From: dtucker Date: Sun, 20 May 2007 05:26:07 +0000 Subject: [PATCH] - (dtucker) [auth-pam.c] Return empty string if fgets fails in sshpam_tty_conv. Patch from ldv at altlinux.org. --- ChangeLog | 2 ++ auth-pam.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2a8670ca..365345c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,8 @@ djm owes me a vb and a tism cd for breaking ssh compilation - (dtucker) [auth-pam.c] malloc+memset -> calloc. Patch from ldv at altlinux.org. + - (dtucker) [auth-pam.c] Return empty string if fgets fails in + sshpam_tty_conv. Patch from ldv at altlinux.org. 20070509 - (tim) [configure.ac] Bug #1287: Add missing test for ucred.h. diff --git a/auth-pam.c b/auth-pam.c index bfd8f327..35aecbdb 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -984,7 +984,8 @@ sshpam_tty_conv(int n, sshpam_const struct pam_message **msg, break; case PAM_PROMPT_ECHO_ON: fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg)); - fgets(input, sizeof input, stdin); + if (fgets(input, sizeof input, stdin) == NULL) + input[0] = '\0'; if ((reply[i].resp = strdup(input)) == NULL) goto fail; reply[i].resp_retcode = PAM_SUCCESS; -- 2.45.1