diff options
Diffstat (limited to 'auth-pam.c')
-rw-r--r-- | auth-pam.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/auth-pam.c b/auth-pam.c index c08d47229..a07f1fe77 100644 --- a/auth-pam.c +++ b/auth-pam.c | |||
@@ -161,9 +161,9 @@ sshpam_sigchld_handler(int sig) | |||
161 | WTERMSIG(sshpam_thread_status) == SIGTERM) | 161 | WTERMSIG(sshpam_thread_status) == SIGTERM) |
162 | return; /* terminated by pthread_cancel */ | 162 | return; /* terminated by pthread_cancel */ |
163 | if (!WIFEXITED(sshpam_thread_status)) | 163 | if (!WIFEXITED(sshpam_thread_status)) |
164 | fatal("PAM: authentication thread exited unexpectedly"); | 164 | sigdie("PAM: authentication thread exited unexpectedly"); |
165 | if (WEXITSTATUS(sshpam_thread_status) != 0) | 165 | if (WEXITSTATUS(sshpam_thread_status) != 0) |
166 | fatal("PAM: authentication thread exited uncleanly"); | 166 | sigdie("PAM: authentication thread exited uncleanly"); |
167 | } | 167 | } |
168 | 168 | ||
169 | /* ARGSUSED */ | 169 | /* ARGSUSED */ |
@@ -686,8 +686,7 @@ sshpam_init_ctx(Authctxt *authctxt) | |||
686 | return (NULL); | 686 | return (NULL); |
687 | } | 687 | } |
688 | 688 | ||
689 | ctxt = xmalloc(sizeof *ctxt); | 689 | ctxt = xcalloc(1, sizeof *ctxt); |
690 | memset(ctxt, 0, sizeof(*ctxt)); | ||
691 | 690 | ||
692 | /* Start the authentication thread */ | 691 | /* Start the authentication thread */ |
693 | if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) { | 692 | if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) { |
@@ -985,7 +984,8 @@ sshpam_tty_conv(int n, sshpam_const struct pam_message **msg, | |||
985 | break; | 984 | break; |
986 | case PAM_PROMPT_ECHO_ON: | 985 | case PAM_PROMPT_ECHO_ON: |
987 | fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg)); | 986 | fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg)); |
988 | fgets(input, sizeof input, stdin); | 987 | if (fgets(input, sizeof input, stdin) == NULL) |
988 | input[0] = '\0'; | ||
989 | if ((reply[i].resp = strdup(input)) == NULL) | 989 | if ((reply[i].resp = strdup(input)) == NULL) |
990 | goto fail; | 990 | goto fail; |
991 | reply[i].resp_retcode = PAM_SUCCESS; | 991 | reply[i].resp_retcode = PAM_SUCCESS; |
@@ -1130,9 +1130,8 @@ sshpam_passwd_conv(int n, sshpam_const struct pam_message **msg, | |||
1130 | if (n <= 0 || n > PAM_MAX_NUM_MSG) | 1130 | if (n <= 0 || n > PAM_MAX_NUM_MSG) |
1131 | return (PAM_CONV_ERR); | 1131 | return (PAM_CONV_ERR); |
1132 | 1132 | ||
1133 | if ((reply = malloc(n * sizeof(*reply))) == NULL) | 1133 | if ((reply = calloc(n, sizeof(*reply))) == NULL) |
1134 | return (PAM_CONV_ERR); | 1134 | return (PAM_CONV_ERR); |
1135 | memset(reply, 0, n * sizeof(*reply)); | ||
1136 | 1135 | ||
1137 | for (i = 0; i < n; ++i) { | 1136 | for (i = 0; i < n; ++i) { |
1138 | switch (PAM_MSG_MEMBER(msg, i, msg_style)) { | 1137 | switch (PAM_MSG_MEMBER(msg, i, msg_style)) { |