[PATCH 2/6] auth-pam.c (sshpam_tty_conv): Check fgets() return code

Dmitry V. Levin ldv at altlinux.org
Wed Apr 11 09:39:34 EST 2007


---
 openssh/auth-pam.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

--- a/openssh/auth-pam.c
+++ b/openssh/auth-pam.c
@@ -985,7 +985,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;

-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/4e1a92ff/attachment.bin 


More information about the openssh-unix-dev mailing list