[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: 2.99.51-pre3 available



On Thu, 15 Jul 1999, Magnus Sjoegren wrote:
> Whoops, well untested it was :). Attached is a patch that tries to
> implement support for PAM (it also includes the shadow patch and
> the changes you made). This patch is untested but it compiles. 

Even though the shadow password patch was, strictly speaking, enough
to meet my needs, I decided to try this patch out as well.  I had some
problems with it and a little debugging showed what the problem was.
There was a mix-up in your PAM conversation function about giving the
username where it should give the password and vice-versa.  I also
did a couple of minor cleanups; feel free to throw those away if they
don't look right.  Patch relative to zmailer-2.99.51pre + Magnus'
smtpauth-shadow-pam patch attached below.

Thanks!

-- 
Roy Bixler
The University of Chicago Press
rcb@press-gopher.uchicago.edu

--- smtpserver-mea/zpwmatch.c	Sat Jul 17 14:47:06 1999
+++ smtpserver/zpwmatch.c	Sat Jul 17 14:40:30 1999
@@ -77,11 +77,11 @@
 	switch (msg[count]->msg_style) {
         case PAM_PROMPT_ECHO_OFF:
 	    reply[count].resp_retcode = 0;
-            reply[count].resp = strdup(username);
+	reply[count].resp = strdup(pword);
 	    break;
 	case PAM_PROMPT_ECHO_ON:
 	    reply[count].resp_retcode = 0;
-            reply[count].resp = strdup(pword);
+	reply[count].resp = strdup(username);
 	    break;
         case PAM_TEXT_INFO: /* These cases should never happend */
 	case PAM_ERROR_MSG:
@@ -91,7 +91,6 @@
 	default: /* This should never happend */
 	    clean_reply(num_msg, msg, reply);
 	    return PAM_CONV_ERR;
-		
 	}
     }
     *resp = reply;
@@ -114,7 +113,7 @@
     pword = strdup(password);
     
     runasrootuser();
-    ret = pam_start("zmailer_smtpauth", uname, &pam_c, &ph);
+    ret = pam_start("zmailer_smtpauth", username, &pam_c, &ph);
     if (ret == PAM_SUCCESS)
 	ret = pam_authenticate(ph, 0);
 
@@ -137,10 +136,7 @@
 	pword = NULL;
     }
 
-    if (val == PAM_SUCCESS)
-	return 1;
-    else
-	return 0;
+    return (val == PAM_SUCCESS) ? 1 : 0;
 }
 
 #elif defined(HAVE_SHADOW_H)