[Pkg-shadow-commits] r2422 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sat Sep 20 14:17:21 UTC 2008


Author: nekral-guest
Date: 2008-09-20 14:17:20 +0000 (Sat, 20 Sep 2008)
New Revision: 2422

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/login.c
Log:
	* src/login.c: Do not mix USE_PAM and !USE_PAM code.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-09-20 13:20:31 UTC (rev 2421)
+++ upstream/trunk/ChangeLog	2008-09-20 14:17:20 UTC (rev 2422)
@@ -1,5 +1,9 @@
 2008-09-20  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/login.c: Do not mix USE_PAM and !USE_PAM code.
+
+2008-09-20  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/login.c: Use failent_user to log to audit. username is the
 	caller, not the user login tries to authenticate.
 	* src/login.c: Use pwd->pw_name instead of pwd->pw_uid. This might

Modified: upstream/trunk/src/login.c
===================================================================
--- upstream/trunk/src/login.c	2008-09-20 13:20:31 UTC (rev 2421)
+++ upstream/trunk/src/login.c	2008-09-20 14:17:20 UTC (rev 2422)
@@ -811,6 +811,19 @@
 					    hushed (&pwent) ? PAM_SILENT : 0);
 		PAM_FAIL_CHECK;
 
+		pwd = xgetpwnam (pam_user);
+		if (NULL == pwd) {
+			pwent.pw_name = pam_user;
+			strcpy (temp_pw, "!");
+			pwent.pw_passwd = temp_pw;
+			pwent.pw_shell = temp_shell;
+
+			preauth_flag = false;
+			failed = true;
+		} else {
+			pwent = *pwd;
+		}
+
 #else				/* ! USE_PAM */
 		while (true) {	/* repeatedly get login/password pairs */
 			failed = false;	/* haven't failed authentication yet */
@@ -824,17 +837,10 @@
 					      sizeof username);
 				continue;
 			}
-#endif				/* ! USE_PAM */
 
-#ifdef USE_PAM
-		pwd = xgetpwnam (pam_user);
-		if (NULL == pwd) {
-			pwent.pw_name = pam_user;
-#else
 		pwd = xgetpwnam (username);
 		if (NULL == pwd) {
 			pwent.pw_name = username;
-#endif
 			strcpy (temp_pw, "!");
 			pwent.pw_passwd = temp_pw;
 			pwent.pw_shell = temp_shell;
@@ -844,7 +850,7 @@
 		} else {
 			pwent = *pwd;
 		}
-#ifndef USE_PAM
+
 		spwd = NULL;
 		if (   (NULL != pwd)
 		    && (strcmp (pwd->pw_passwd, SHADOW_PASSWD_STRING) == 0)) {
@@ -995,9 +1001,11 @@
 			closelog ();
 			exit (1);
 		}
-	}			/* while (1) */
+	}			/* while (true) */
 #endif				/* ! USE_PAM */
+
 	alarm (0);		/* turn off alarm clock */
+
 #ifndef USE_PAM			/* PAM does this */
 	/*
 	 * porttime checks moved here, after the user has been




More information about the Pkg-shadow-commits mailing list