From 23fe57c51caeacf58c24cc4efc8d701db3cb0fdc Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 2 Jul 2002 17:08:23 +1000 Subject: - (djm) Use PAM_MSG_MEMBER for PAM_TEXT_INFO messages, use xmalloc & friends consistently. Spotted by Solar Designer --- ChangeLog | 6 +++++- auth-pam.c | 16 +++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36d14dd3d..4b67628c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20020702 + - (djm) Use PAM_MSG_MEMBER for PAM_TEXT_INFO messages, use xmalloc & + friends consistently. Spotted by Solar Designer + 20020629 - (bal) fix to auth2-pam.c to swap fatal() arguments, A bit of style clean up while I'm near it. @@ -1201,4 +1205,4 @@ - (stevesk) entropy.c: typo in debug message - (djm) ssh-keygen -i needs seeded RNG; report from markus@ -$Id: ChangeLog,v 1.2312 2002/06/28 16:48:11 mouring Exp $ +$Id: ChangeLog,v 1.2313 2002/07/02 07:08:23 djm Exp $ 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 @@ 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; } } -- cgit v1.2.3