--- sh-utils-2.0/src/su.c.orig Wed Mar 31 07:36:01 1999
+++ sh-utils-2.0/src/su.c Tue Sep 19 15:44:42 2000
@@ -67,6 +67,10 @@
-DSYSLOG_NON_ROOT Log all su's, not just those to root (UID 0).
Never logs attempted su's to nonexistent accounts.
+ -DPARANOID_PATH set root's path to DEFAULT_ROOT_LOGIN_PATH when the
+ user does a simple 'su' to superuser
+ (not the simulated login)
+
Written by David MacKenzie
. */
#include
@@ -326,7 +330,8 @@
else
{
/* Set HOME, SHELL, and if not becoming a super-user,
- USER and LOGNAME. */
+ USER and LOGNAME. But if paranoid setting, then also change
+ super-user's PATH */
if (change_environment)
{
xputenv (concat ("HOME", "=", pw->pw_dir));
@@ -335,6 +340,15 @@
{
xputenv (concat ("USER", "=", pw->pw_name));
xputenv (concat ("LOGNAME", "=", pw->pw_name));
+ }
+ else
+ {
+# if defined (PARANOID_PATH)
+ /* but in this case we set the path for superuser */
+ {
+ xputenv (concat ("PATH", "=", DEFAULT_ROOT_LOGIN_PATH));
+ }
+# endif
}
}
}