diff options
Diffstat (limited to 'auth-pam.c')
-rw-r--r-- | auth-pam.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/auth-pam.c b/auth-pam.c index 490990dec..6bf10d2f9 100644 --- a/auth-pam.c +++ b/auth-pam.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | extern char *__progname; | 37 | extern char *__progname; |
38 | 38 | ||
39 | RCSID("$Id: auth-pam.c,v 1.46 2002/05/08 02:27:56 djm Exp $"); | 39 | RCSID("$Id: auth-pam.c,v 1.47 2002/07/02 07:08:24 djm Exp $"); |
40 | 40 | ||
41 | #define NEW_AUTHTOK_MSG \ | 41 | #define NEW_AUTHTOK_MSG \ |
42 | "Warning: Your password has expired, please change it now" | 42 | "Warning: Your password has expired, please change it now" |
@@ -100,9 +100,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg, | |||
100 | char buf[1024]; | 100 | char buf[1024]; |
101 | 101 | ||
102 | /* PAM will free this later */ | 102 | /* PAM will free this later */ |
103 | reply = malloc(num_msg * sizeof(*reply)); | 103 | reply = xmalloc(num_msg * sizeof(*reply)); |
104 | if (reply == NULL) | ||
105 | return PAM_CONV_ERR; | ||
106 | 104 | ||
107 | for (count = 0; count < num_msg; count++) { | 105 | for (count = 0; count < num_msg; count++) { |
108 | if (pamstate == INITIAL_LOGIN) { | 106 | if (pamstate == INITIAL_LOGIN) { |
@@ -112,11 +110,11 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg, | |||
112 | */ | 110 | */ |
113 | switch(PAM_MSG_MEMBER(msg, count, msg_style)) { | 111 | switch(PAM_MSG_MEMBER(msg, count, msg_style)) { |
114 | case PAM_PROMPT_ECHO_ON: | 112 | case PAM_PROMPT_ECHO_ON: |
115 | free(reply); | 113 | xfree(reply); |
116 | return PAM_CONV_ERR; | 114 | return PAM_CONV_ERR; |
117 | case PAM_PROMPT_ECHO_OFF: | 115 | case PAM_PROMPT_ECHO_OFF: |
118 | if (__pampasswd == NULL) { | 116 | if (__pampasswd == NULL) { |
119 | free(reply); | 117 | xfree(reply); |
120 | return PAM_CONV_ERR; | 118 | return PAM_CONV_ERR; |
121 | } | 119 | } |
122 | reply[count].resp = xstrdup(__pampasswd); | 120 | reply[count].resp = xstrdup(__pampasswd); |
@@ -124,7 +122,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg, | |||
124 | break; | 122 | break; |
125 | case PAM_ERROR_MSG: | 123 | case PAM_ERROR_MSG: |
126 | case PAM_TEXT_INFO: | 124 | case PAM_TEXT_INFO: |
127 | if ((*msg)[count].msg != NULL) { | 125 | if (PAM_MSG_MEMBER(msg, count, msg) != NULL) { |
128 | message_cat(&__pam_msg, | 126 | message_cat(&__pam_msg, |
129 | PAM_MSG_MEMBER(msg, count, msg)); | 127 | PAM_MSG_MEMBER(msg, count, msg)); |
130 | } | 128 | } |
@@ -132,7 +130,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg, | |||
132 | reply[count].resp_retcode = PAM_SUCCESS; | 130 | reply[count].resp_retcode = PAM_SUCCESS; |
133 | break; | 131 | break; |
134 | default: | 132 | default: |
135 | free(reply); | 133 | xfree(reply); |
136 | return PAM_CONV_ERR; | 134 | return PAM_CONV_ERR; |
137 | } | 135 | } |
138 | } else { | 136 | } else { |
@@ -161,7 +159,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg, | |||
161 | reply[count].resp_retcode = PAM_SUCCESS; | 159 | reply[count].resp_retcode = PAM_SUCCESS; |
162 | break; | 160 | break; |
163 | default: | 161 | default: |
164 | free(reply); | 162 | xfree(reply); |
165 | return PAM_CONV_ERR; | 163 | return PAM_CONV_ERR; |
166 | } | 164 | } |
167 | } | 165 | } |