[Pkg-shadow-devel] patches for su synchronisation

Nicolas François nicolas.francois at centraliens.net
Sat Dec 17 17:40:26 UTC 2005


Hi,

This is probably the last patch related to su.

without it, $(su - user -c "echo \$SHELL") wont return the good value, but
$(su user -c "echo \$SHELL") will.

I think LOGNAME can also be set (this is done in setup_env, in the
fakelogin case).

-- 
Nekral
-------------- next part --------------
--- src/su.c.4	2005-12-17 18:34:15.000000000 +0100
+++ src/su.c	2005-12-17 18:34:43.000000000 +0100
@@ -791,11 +791,13 @@
 #endif				/* !USE_PAM */
 
 	if (change_environment) {
-		if (fakelogin)
+		if (fakelogin) {
+			pwent.pw_shell = shellstr;
 			setup_env (&pwent);
-		else {
+		} else {
 			addenv ("HOME", pwent.pw_dir);
 			addenv ("USER", pwent.pw_name);
+			addenv ("LOGNAME", pwent.pw_name);
 			addenv ("SHELL", shellstr);
 		}
 	}


More information about the Pkg-shadow-devel mailing list