aboutsummaryrefslogtreecommitdiff
blob: 5db08fd5fd731fdd482b47044fc0969b3fb3c6d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
The patch from upstream (shadow-4.0.11.1-SUPATH.patch) sets environ too
early when using PAM, so move it to !USE_PAM.  Also set USER and SHELL.

--- shadow-4.0.11.1/src/su.c	2005-08-04 12:34:35.000000000 +0200
+++ shadow-4.0.11.1.az/src/su.c	2005-08-04 12:38:57.000000000 +0200
@@ -594,11 +594,6 @@
 		addenv ("PATH", cp);
 	}

-#ifndef USE_PAM
-	/* setup the environment for PAM later on, else we run into auth problems */
-	environ = newenvp;	/* make new environment active */
-#endif
-
 	if (getenv ("IFS"))	/* don't export user IFS ... */
 		addenv ("IFS= \t\n", NULL);	/* ... instead, set a safe IFS */
 
@@ -666,6 +664,8 @@
 		exit (1);
 	}
 #else				/* !USE_PAM */
+	environ = newenvp;	/* make new environment active */
+	
 	if (!amroot)		/* no limits if su from root */
 		setup_limits (&pwent);
 
@@ -676,8 +676,11 @@
 	if (fakelogin)
 		setup_env (&pwent);
 #if 1				/* Suggested by Joey Hess. XXX - is this right?  */
-	else
+	else {
 		addenv ("HOME", pwent.pw_dir);
+		addenv ("USER", pwent.pw_name);
+		addenv ("SHELL", pwent.pw_shell);
+	}
 #endif
 
 	/*