summaryrefslogtreecommitdiff
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
parentde07cbf1edd4bd1b012905c5c54aea37c6db80eb (diff)
- (djm) Use PAM_MSG_MEMBER for PAM_TEXT_INFO messages, use xmalloc &
friends consistently. Spotted by Solar Designer <solar@openwall.com>
-rw-r--r--ChangeLog6
-rw-r--r--auth-pam.c16
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 @@
120020702
2 - (djm) Use PAM_MSG_MEMBER for PAM_TEXT_INFO messages, use xmalloc &
3 friends consistently. Spotted by Solar Designer <solar@openwall.com>
4
120020629 520020629
2 - (bal) fix to auth2-pam.c to swap fatal() arguments, A bit of style 6 - (bal) fix to auth2-pam.c to swap fatal() arguments, A bit of style
3 clean up while I'm near it. 7 clean up while I'm near it.
@@ -1201,4 +1205,4 @@
1201 - (stevesk) entropy.c: typo in debug message 1205 - (stevesk) entropy.c: typo in debug message
1202 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 1206 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
1203 1207
1204$Id: ChangeLog,v 1.2312 2002/06/28 16:48:11 mouring Exp $ 1208$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 @@
36 36
37extern char *__progname; 37extern char *__progname;
38 38
39RCSID("$Id: auth-pam.c,v 1.46 2002/05/08 02:27:56 djm Exp $"); 39RCSID("$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 }