~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to auth-pam.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-09-30 23:09:58 UTC
  • mfrom: (1.13.3 upstream) (29 hardy)
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20080930230958-o6vsgn8c4mm959s0
Tags: 1:5.1p1-3
* Remove unnecessary ssh-vulnkey output in non-verbose mode when no
  compromised or unknown keys were found (closes: #496495).
* Configure with --disable-strip; dh_strip will deal with stripping
  binaries and will honour DEB_BUILD_OPTIONS (thanks, Bernhard R. Link;
  closes: #498681).
* Fix handling of zero-length server banners (thanks, Tomas Mraz; closes:
  #497026).

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
            WTERMSIG(sshpam_thread_status) == SIGTERM)
162
162
                return; /* terminated by pthread_cancel */
163
163
        if (!WIFEXITED(sshpam_thread_status))
164
 
                fatal("PAM: authentication thread exited unexpectedly");
 
164
                sigdie("PAM: authentication thread exited unexpectedly");
165
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
169
/* ARGSUSED */
598
598
void
599
599
sshpam_cleanup(void)
600
600
{
 
601
        if (sshpam_handle == NULL || (use_privsep && !mm_is_monitor()))
 
602
                return;
601
603
        debug("PAM: cleanup");
602
 
        if (sshpam_handle == NULL)
603
 
                return;
604
604
        pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv);
605
605
        if (sshpam_cred_established) {
 
606
                debug("PAM: deleting credentials");
606
607
                pam_setcred(sshpam_handle, PAM_DELETE_CRED);
607
608
                sshpam_cred_established = 0;
608
609
        }
609
610
        if (sshpam_session_open) {
 
611
                debug("PAM: closing session");
610
612
                pam_close_session(sshpam_handle, PAM_SILENT);
611
613
                sshpam_session_open = 0;
612
614
        }
686
688
                return (NULL);
687
689
        }
688
690
 
689
 
        ctxt = xmalloc(sizeof *ctxt);
690
 
        memset(ctxt, 0, sizeof(*ctxt));
 
691
        ctxt = xcalloc(1, sizeof *ctxt);
691
692
 
692
693
        /* Start the authentication thread */
693
694
        if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
985
986
                        break;
986
987
                case PAM_PROMPT_ECHO_ON:
987
988
                        fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg));
988
 
                        fgets(input, sizeof input, stdin);
 
989
                        if (fgets(input, sizeof input, stdin) == NULL)
 
990
                                input[0] = '\0';
989
991
                        if ((reply[i].resp = strdup(input)) == NULL)
990
992
                                goto fail;
991
993
                        reply[i].resp_retcode = PAM_SUCCESS;
1130
1132
        if (n <= 0 || n > PAM_MAX_NUM_MSG)
1131
1133
                return (PAM_CONV_ERR);
1132
1134
 
1133
 
        if ((reply = malloc(n * sizeof(*reply))) == NULL)
 
1135
        if ((reply = calloc(n, sizeof(*reply))) == NULL)
1134
1136
                return (PAM_CONV_ERR);
1135
 
        memset(reply, 0, n * sizeof(*reply));
1136
1137
 
1137
1138
        for (i = 0; i < n; ++i) {
1138
1139
                switch (PAM_MSG_MEMBER(msg, i, msg_style)) {