[patch] dont export default MAIL if MAIL_CHECK_ENAB is disabled

Mike Frysinger <[email protected]> Thu, 4 May 2006 00:08:49 -0400
Newsgroups gmane.linux.pld.shadow.general
Organization wh0rd.org
Message-ID <[email protected]>
if MAIL_CHECK_ENAB is disabled in login.defs, then the MAIL envvar is still 
exported when you log in ... this patch fixes that by only exporting a 
default MAIL setting when MAIL_CHECK_ENAB is enabled
-mike
shadow-no-default-MAIL.patch (text/x-diff, 985 B)
2006-05-04  Mike Frysinger  <[email protected]>

	* libmisc/setupenv.c (setup_env): Only export MAIL when
	MAIL_CHECK_ENAB is enabled.

--- libmisc/setupenv.c
+++ libmisc/setupenv.c
@@ -265,16 +265,18 @@ void setup_env (struct passwd *info)
 	 * knows the prefix.
 	 */
 
-	if ((cp = getdef_str ("MAIL_DIR")))
-		addenv_path ("MAIL", cp, info->pw_name);
-	else if ((cp = getdef_str ("MAIL_FILE")))
-		addenv_path ("MAIL", info->pw_dir, cp);
-	else {
+	if (getdef_bool ("MAIL_CHECK_ENAB")) {
+		if ((cp = getdef_str ("MAIL_DIR")))
+			addenv_path ("MAIL", cp, info->pw_name);
+		else if ((cp = getdef_str ("MAIL_FILE")))
+			addenv_path ("MAIL", info->pw_dir, cp);
+		else {
 #if defined(MAIL_SPOOL_FILE)
-		addenv_path ("MAIL", info->pw_dir, 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);
+			addenv_path ("MAIL", MAIL_SPOOL_DIR, info->pw_name);
 #endif
+		}
 	}
 
 	/*