summaryrefslogtreecommitdiffstats
path: root/auth-pam.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-07-02 17:08:23 +1000
committerDamien Miller <djm@mindrot.org>2002-07-02 17:08:23 +1000
commit23fe57c51caeacf58c24cc4efc8d701db3cb0fdc (patch)
tree9a5a0fa1bb54f7de0cc5440e5e8136e4e3df812b /auth-pam.c
parentde07cbf1edd4bd1b012905c5c54aea37c6db80eb (diff)
- (djm) Use PAM_MSG_MEMBER for PAM_TEXT_INFO messages, use xmalloc &
friends consistently. Spotted by Solar Designer <solar@openwall.com>
Diffstat (limited to 'auth-pam.c')
-rw-r--r--auth-pam.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/auth-pam.c b/auth-pam.c
index 490990de..6bf10d2f 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -36,7 +36,7 @@
extern char *__progname;
-RCSID("$Id: auth-pam.c,v 1.46 2002/05/08 02:27:56 djm Exp $");
+RCSID("$Id: auth-pam.c,v 1.47 2002/07/02 07:08:24 djm Exp $");
#define NEW_AUTHTOK_MSG \
"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,
char buf[1024];
/* PAM will free this later */
- reply = malloc(num_msg * sizeof(*reply));
- if (reply == NULL)
- return PAM_CONV_ERR;
+ reply = xmalloc(num_msg * sizeof(*reply));
for (count = 0; count < num_msg; count++) {
if (pamstate == INITIAL_LOGIN) {
@@ -112,11 +110,11 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg,
*/
switch(PAM_MSG_MEMBER(msg, count, msg_style)) {
case PAM_PROMPT_ECHO_ON:
- free(reply);
+ xfree(reply);
return PAM_CONV_ERR;
case PAM_PROMPT_ECHO_OFF:
if (__pampasswd == NULL) {
- free(reply);
+ xfree(reply);
return PAM_CONV_ERR;
}
reply[count].resp = xstrdup(__pampasswd);
@@ -124,7 +122,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg,
break;
case PAM_ERROR_MSG:
case PAM_TEXT_INFO:
- if ((*msg)[count].msg != NULL) {
+ if (PAM_MSG_MEMBER(msg, count, msg) != NULL) {
message_cat(&__pam_msg,
PAM_MSG_MEMBER(msg, count, msg));
}
@@ -132,7 +130,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg,
reply[count].resp_retcode = PAM_SUCCESS;
break;
default:
- free(reply);
+ xfree(reply);
return PAM_CONV_ERR;
}
} else {
@@ -161,7 +159,7 @@ static int do_pam_conversation(int num_msg, const struct pam_message **msg,
reply[count].resp_retcode = PAM_SUCCESS;
break;
default:
- free(reply);
+ xfree(reply);
return PAM_CONV_ERR;
}
}