DJ Lucas wrote:

> 
> If I read that correctly, however, the proper fix is to
> simply wrap the the mentioned def_find() calls in an #ifdef USE_PAM
>  

Actually it was #ifndef USE_PAM...but it apears to work.  Thanks Greg!
In addition to those suggested in BLFS, you'll need to comment out the
following in /etc/login.defs:

FAILLOG_ENAB, QUOTAS_ENAB, FTMP_FILE, QMAIL_DIR, MAIL_DIR, NOLOGIN_STR,
ENV_HZ, ENV_SUPATH, ENV_PATH, and CHFN_AUTH.

>>From the quoted pld post:
> 
> 
>>>in login.c:main()
>>>ULIMIT
>>>ENV_TZ
>>>ENV_HZ
>>>
>>>in setupenv.c:setupenv()
>>>ENV_SUPATH
>>>ENV_PATH
>>>QMAIL_DIR
>>>MAIL_DIR
>>>MAIL_FILE

The attached patch has been tested on exactly four logins called from an
xterm.  I believe it is sane, but I can't thoroughly test it right now,
so if you try it, you're on your own.  :-)  As always, have a rescue
disk handy.  And yes I over comment on one line endifs...deal!

-- DJ Lucas

diff -Naur shadow-4.0.10/libmisc/setupenv.c shadow-4.0.10-new/libmisc/setupenv.c
--- shadow-4.0.10/libmisc/setupenv.c	2005-06-14 15:27:35.000000000 -0500
+++ shadow-4.0.10-new/libmisc/setupenv.c	2005-06-30 00:09:21.000000000 -0500
@@ -238,7 +238,9 @@
 	 * Create the PATH environmental variable and export it.
 	 */
 
+#ifndef USE_PAM
 	cp = getdef_str ((info->pw_uid == 0) ? "ENV_SUPATH" : "ENV_PATH");
+
 	if (!cp) {
 		/* not specified, use a minimal default */
 		addenv ("PATH=/bin:/usr/bin", NULL);
@@ -249,7 +251,7 @@
 		/* only value specified without "PATH=" */
 		addenv ("PATH", cp);
 	}
-
+#endif /* !USE_PAM */
 	/*
 	 * Export the user name.  For BSD derived systems, it's "USER", for
 	 * all others it's "LOGNAME".  We set both of them.
@@ -258,6 +260,7 @@
 	addenv ("USER", info->pw_name);
 	addenv ("LOGNAME", info->pw_name);
 
+#ifndef USE_PAM
 	/*
 	 * MAILDIR environment variable for Qmail
 	 */
@@ -274,18 +277,20 @@
 	else if ((cp = getdef_str ("MAIL_FILE")))
 		addenv_path ("MAIL", info->pw_dir, cp);
 	else {
+# endif /* !USE_PAM */
+
 #if defined(MAIL_SPOOL_FILE)
 		addenv_path ("MAIL", info->pw_dir, MAIL_SPOOL_FILE);
 #elif defined(MAIL_SPOOL_DIR)
 		addenv_path ("MAIL", MAIL_SPOOL_DIR, info->pw_name);
 #endif
-	}
 
 #ifndef USE_PAM
+	}
 	/*
 	 * Read environment from optional config file.  --marekm
 	 */
 	if ((envf = getdef_str ("ENVIRON_FILE")))
 		read_env_file (envf);
-#endif
+#endif /* !USE_PAM */
 }
diff -Naur shadow-4.0.10/src/login.c shadow-4.0.10-new/src/login.c
--- shadow-4.0.10/src/login.c	2005-06-20 04:36:27.000000000 -0500
+++ shadow-4.0.10-new/src/login.c	2005-06-30 00:10:58.000000000 -0500
@@ -277,9 +277,11 @@
 
 	if ((tmp = getenv ("TZ"))) {
 		addenv ("TZ", tmp);
-	} else if ((cp = getdef_str ("ENV_TZ")))
+	} 
+#ifndef USE_PAM
+		else if ((cp = getdef_str ("ENV_TZ")))
 		addenv (*cp == '/' ? tz (cp) : cp, NULL);
-
+#endif /* !USE_PAM */
 	/* 
 	 * Add the clock frequency so that profiling commands work
 	 * correctly.
@@ -287,8 +289,11 @@
 
 	if ((tmp = getenv ("HZ"))) {
 		addenv ("HZ", tmp);
-	} else if ((cp = getdef_str ("ENV_HZ")))
+	} 
+#ifndef USE_PAM
+		else if ((cp = getdef_str ("ENV_HZ")))
 		addenv (cp, NULL);
+#endif /* !USE_PAM */
 }
 
 
@@ -505,6 +510,7 @@
 
 		umask (getdef_num ("UMASK", 077));
 
+#ifndef USE_PAM
 		{
 			/* 
 			 * Use the ULIMIT in the login.defs file, and if
@@ -518,7 +524,7 @@
 			if (limit != -1)
 				set_filesize_limit (limit);
 		}
-
+#endif /* !USE_PAM */
 		/*
 		 * The entire environment will be preserved if the -p flag
 		 * is used.
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to