[Pkg-shadow-commits] r2005 - in upstream/trunk: . libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sat May 24 14:11:35 UTC 2008


Author: nekral-guest
Date: 2008-05-24 14:11:31 +0000 (Sat, 24 May 2008)
New Revision: 2005

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/pwdcheck.c
Log:
Simply passwd_check since it's never used when configured with PAM support.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-05-24 14:09:35 UTC (rev 2004)
+++ upstream/trunk/ChangeLog	2008-05-24 14:11:31 UTC (rev 2005)
@@ -1,5 +1,10 @@
 2008-05-24  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/pwdcheck.c: Simply passwd_check since it's never used
+	when configured with PAM support.
+
+2008-05-24  Nicolas François  <nicolas.francois at centraliens.net>
+
 	Fix compiler warnings:
 	* libmisc/audit_help.c: Include prototypes.h to get the prototype
 	of audit_help_open.

Modified: upstream/trunk/libmisc/pwdcheck.c
===================================================================
--- upstream/trunk/libmisc/pwdcheck.c	2008-05-24 14:09:35 UTC (rev 2004)
+++ upstream/trunk/libmisc/pwdcheck.c	2008-05-24 14:11:31 UTC (rev 2005)
@@ -32,55 +32,29 @@
 
 #ident "$Id$"
 
+#ifndef USE_PAM
+
 #include <stdio.h>
+#include <shadow.h>
 #include "prototypes.h"
 #include "defines.h"
-#ifdef USE_PAM
-#include "pam_defs.h"
-#else
-#include <shadow.h>
 #include "pwauth.h"
-#endif
-#define WRONGPWD2	"incorrect password for `%s'"
+
 void passwd_check (const char *user, const char *passwd, const char *progname)
 {
-#ifdef USE_PAM
-	pam_handle_t *pamh = NULL;
-	int retcode;
-
-	if (pam_start (progname, user, &conv, &pamh)) {
-	      bailout:
-		SYSLOG ((LOG_WARN, WRONGPWD2, user));
-		sleep (1);
-		fprintf (stderr, _("Incorrect password for %s.\n"), user);
-		exit (1);
-	}
-	if (pam_authenticate (pamh, 0))
-		goto bailout;
-
-	retcode = pam_acct_mgmt (pamh, 0);
-	if (retcode == PAM_NEW_AUTHTOK_REQD)
-		retcode = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
-	if (retcode)
-		goto bailout;
-
-	if (pam_setcred (pamh, 0))
-		goto bailout;
-
-	/* no need to establish a session; this isn't a session-oriented
-	 * activity... */
-
-#else				/* !USE_PAM */
-
 	struct spwd *sp;
 
-	if ((sp = getspnam (user))) /* !USE_PAM, no need for xgetspnam */
+	sp = getspnam (user); /* !USE_PAM, no need for xgetspnam */
+	if (NULL != sp) {
 		passwd = sp->sp_pwdp;
+	}
 	if (pw_auth (passwd, user, PW_LOGIN, (char *) 0) != 0) {
-		SYSLOG ((LOG_WARN, WRONGPWD2, user));
+		SYSLOG ((LOG_WARN, "incorrect password for `%s'", user));
 		sleep (1);
 		fprintf (stderr, _("Incorrect password for %s.\n"), user);
 		exit (1);
 	}
-#endif				/* !USE_PAM */
 }
+#else			/* USE_PAM */
+extern int errno;	/* warning: ANSI C forbids an empty source file */
+#endif			/* USE_PAM */




More information about the Pkg-shadow-commits mailing list