Propagating DISPLAY and XAUTHORITY in su when using PAM

"J. Scott Berg" <[email protected]> Tue, 30 Aug 2005 18:48:21 -0400
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
Maybe I'm not understanding how to use PAM properly, but shouldn't su 
propagate DISPLAY and XAUTHORITY when USE_PAM is defined, so that 
pam_xauth works?  Right now, they're only propagated when USE_PAM is not 
defined.  My fix (which does the right thing for me) attached.
shadow-su.diff (text/x-patch, 538 B)
--- src/su.c~	2005-08-09 12:40:07.000000000 -0400
+++ src/su.c	2005-08-30 18:39:44.000000000 -0400
@@ -351,6 +351,7 @@
 		 */
 		if ((cp = getdef_str ("ENV_HZ")))
 			addenv (cp, NULL);	/* set the default $HZ, if one */
+#endif				/* !USE_PAM */
 		/*
 		 * Also leave DISPLAY and XAUTHORITY if present, else
 		 * pam_xauth will not work.
@@ -359,7 +360,6 @@
 			addenv ("DISPLAY", cp);
 		if ((cp = getenv ("XAUTHORITY")))
 			addenv ("XAUTHORITY", cp);
-#endif				/* !USE_PAM */
 	} else {
 		while (*envp)
 			addenv (*envp++, NULL);