From: Art Cancro Date: Sun, 26 Jun 2005 22:19:22 +0000 (+0000) Subject: * auth.c: applied fleeb's patch to validpw() to clean up FreeBSD compatibility X-Git-Tag: v7.86~4815 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=ddeb0195c4ba638cf886c108319545bea2b66b59 * auth.c: applied fleeb's patch to validpw() to clean up FreeBSD compatibility --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 55ceb7a8d..825481a34 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ +Revision 651.4 2005/06/26 22:19:20 ajc +* auth.c: applied fleeb's patch to validpw() to clean up FreeBSD compatibility + Revision 651.3 2005/06/22 03:45:17 ajc * Documented the auto-log-cull as it relates to backup strategies @@ -6888,4 +6891,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/auth.c b/citadel/auth.c index a62d6003c..a11d9c767 100644 --- a/citadel/auth.c +++ b/citadel/auth.c @@ -3,6 +3,7 @@ * * system-level password checking for autologin * by Nathan Bryant, March 1999 + * updated by Trey van Riper, June 2005 * */ @@ -79,6 +80,7 @@ static int conv(int num_msg, const struct pam_message **msg, } #endif /* HAVE_PAM_START */ + /* * validpw(): check that `pass' is the correct password for `uid' * returns zero if no, nonzero if yes @@ -87,46 +89,51 @@ static int conv(int num_msg, const struct pam_message **msg, int validpw(uid_t uid, const char *pass) { #ifdef HAVE_PAM_START - struct pam_conv pc; - struct appdata data; - pam_handle_t *ph; - int i; + struct pam_conv pc; + struct appdata data; + pam_handle_t *ph; + int i; #else - char *crypted_pwd; + char *crypted_pwd; #ifdef HAVE_GETSPNAM - struct spwd *sp; + struct spwd *sp; #endif #endif - struct passwd *pw; - int retval = 0; + struct passwd *pw; + int retval = 0; + int flags = 0; - if ((pw = getpwuid(uid)) == NULL) - return retval; +#ifdef PAM_DATA_SILENT + flags = flags | PAM_DATA_SILENT +#endif /* PAM_DATA_SILENT */ + if ((pw = getpwuid(uid)) == NULL) + return retval; #ifdef HAVE_PAM_START - pc.conv = conv; - pc.appdata_ptr = &data; - data.name = pw->pw_name; - data.pw = pass; - if (pam_start("citadel", pw->pw_name, &pc, &ph) != PAM_SUCCESS) - return retval; - - if ((i = pam_authenticate(ph, PAM_SILENT)) == PAM_SUCCESS) - if ((i = pam_acct_mgmt(ph, PAM_SILENT)) == PAM_SUCCESS) - retval = -1; - - pam_end(ph, i | PAM_DATA_SILENT); + pc.conv = conv; + pc.appdata_ptr = &data; + data.name = pw->pw_name; + data.pw = pass; + if (pam_start("citadel", pw->pw_name, &pc, &ph) != PAM_SUCCESS) + return retval; + + if ((i = pam_authenticate(ph, flags)) == PAM_SUCCESS) + if ((i = pam_acct_mgmt(ph, flags)) == PAM_SUCCESS) + retval = -1; + + pam_end(ph, i | flags); #else - crypted_pwd = pw->pw_passwd; + crypted_pwd = pw->pw_passwd; #ifdef HAVE_GETSPNAM - if ((sp = getspnam(pw->pw_name)) != NULL) - crypted_pwd = sp->sp_pwdp; + if ((sp = getspnam(pw->pw_name)) != NULL) + crypted_pwd = sp->sp_pwdp; #endif - if (!strcmp(crypt(pass, crypted_pwd), crypted_pwd)) - retval = -1; -#endif /* HAVE_PAM_START */ + if (!strcmp(crypt(pass, crypted_pwd), crypted_pwd)) + retval = -1; +#endif /* HAVE_PAM_START */ - return retval; + return retval; } + diff --git a/citadel/docs/citadel.html b/citadel/docs/citadel.html index b05698e08..a9d668acb 100644 --- a/citadel/docs/citadel.html +++ b/citadel/docs/citadel.html @@ -102,6 +102,12 @@ design
assistance with project management
+ + Trey Van Riper
+ + portability enhancements
+
+ John Walker