summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJohn Terpstra <jht@samba.org>1997-10-16 05:33:24 +0000
committerJohn Terpstra <jht@samba.org>1997-10-16 05:33:24 +0000
commitb676826bec7cef3a1c324e0e655588195e80c1c5 (patch)
tree14e26f039d84d874777f3cc7b7b2d01d4d7632d5 /source3/smbd
parent69eea4fcf818ce976060e31432a6a415ab191d64 (diff)
downloadsamba-b676826bec7cef3a1c324e0e655588195e80c1c5.tar.gz
samba-b676826bec7cef3a1c324e0e655588195e80c1c5.tar.bz2
samba-b676826bec7cef3a1c324e0e655588195e80c1c5.zip
Added Michael Johnsons' PAM modifications <johnsonm@redhat.com>
This patch has been checked over. JHT (This used to be commit c84a043f89ccba001597962cd03e2f2a634c4b08)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/password.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 1b1bd34bcc..9f4f0abcae 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -416,33 +416,33 @@ static int PAM_conv (int num_msg,
struct pam_message **msg,
struct pam_response **resp,
void *appdata_ptr) {
- int count = 0, replies = 0;
+ int replies = 0;
struct pam_response *reply = NULL;
- int size = sizeof(struct pam_response);
- #define GET_MEM if (reply) realloc(reply, size); else reply = malloc(size); \
- if (!reply) return PAM_CONV_ERR; \
- size += sizeof(struct pam_response)
#define COPY_STRING(s) (s) ? strdup(s) : NULL
- for (count = 0; count < num_msg; count++) {
- switch (msg[count]->msg_style) {
+ reply = malloc(sizeof(struct pam_response) * num_msg);
+ if (!reply) return PAM_CONV_ERR;
+
+ for (replies = 0; replies < num_msg; replies++) {
+ switch (msg[replies]->msg_style) {
case PAM_PROMPT_ECHO_ON:
- GET_MEM;
reply[replies].resp_retcode = PAM_SUCCESS;
- reply[replies++].resp = COPY_STRING(PAM_username);
+ reply[replies].resp = COPY_STRING(PAM_username);
/* PAM frees resp */
break;
case PAM_PROMPT_ECHO_OFF:
- GET_MEM;
reply[replies].resp_retcode = PAM_SUCCESS;
- reply[replies++].resp = COPY_STRING(PAM_password);
+ reply[replies].resp = COPY_STRING(PAM_password);
/* PAM frees resp */
break;
case PAM_TEXT_INFO:
+ /* fall through */
+ case PAM_ERROR_MSG:
/* ignore it... */
+ reply[replies].resp_retcode = PAM_SUCCESS;
+ reply[replies].resp = NULL;
break;
- case PAM_ERROR_MSG:
default:
/* Must be an error of some sort... */
free (reply);