Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/su Set SU_FROM environment variable. This can be use...



details:   https://anonhg.NetBSD.org/src/rev/9d4c504d19ea
branches:  trunk
changeset: 481973:9d4c504d19ea
user:      abs <abs%NetBSD.org@localhost>
date:      Fri Feb 11 00:30:07 2000 +0000

description:
Set SU_FROM environment variable. This can be used to determine a 'su -'
shell from a real login shell (but only if you care).

diffstat:

 usr.bin/su/su.1 |  17 ++++++++++++-----
 usr.bin/su/su.c |   5 +++--
 2 files changed, 15 insertions(+), 7 deletions(-)

diffs (79 lines):

diff -r 0b36c4c4b224 -r 9d4c504d19ea usr.bin/su/su.1
--- a/usr.bin/su/su.1   Fri Feb 11 00:07:36 2000 +0000
+++ b/usr.bin/su/su.1   Fri Feb 11 00:30:07 2000 +0000
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"    from: @(#)su.1  8.2 (Berkeley) 4/18/94
-.\"    $NetBSD: su.1,v 1.17 2000/01/14 02:39:14 mjl Exp $
+.\"    $NetBSD: su.1,v 1.18 2000/02/11 00:30:07 abs Exp $
 .\"
 .Dd January 14, 2000
 .Dt SU 1
@@ -73,8 +73,9 @@
 By default, the environment is unmodified with the exception of
 .Ev USER ,
 .Ev HOME ,
+.Ev SHELL ,
 and
-.Ev SHELL .
+.Ev SU_FROM .
 .Ev HOME
 and
 .Ev SHELL
@@ -82,8 +83,12 @@
 .Ev USER
 is set to the target login, unless the target login has a user ID of 0,
 in which case it is unmodified.
+.Ev SU_FROM
+is set to the caller's login.
 The invoked shell is the target login's.
-This is the traditional behavior of
+With the exception of
+.Ev SU_FROM
+this is the traditional behavior of
 .Nm "" .
 .Pp
 The options are as follows:
@@ -106,11 +111,13 @@
 .Ev SHELL ,
 .Ev PATH ,
 .Ev TERM ,
+.Ev USER ,
 and
-.Ev USER .
+.Ev SU_FROM .
 .Ev HOME
+.Ev SHELL ,
 and
-.Ev SHELL
+.Ev SU_FROM
 are modified as above.
 .Ev USER
 is set to the target login.
diff -r 0b36c4c4b224 -r 9d4c504d19ea usr.bin/su/su.c
--- a/usr.bin/su/su.c   Fri Feb 11 00:07:36 2000 +0000
+++ b/usr.bin/su/su.c   Fri Feb 11 00:30:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: su.c,v 1.38 2000/01/25 02:19:19 mjl Exp $      */
+/*     $NetBSD: su.c,v 1.39 2000/02/11 00:30:07 abs Exp $      */
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)su.c       8.3 (Berkeley) 4/2/94";*/
 #else
-__RCSID("$NetBSD: su.c,v 1.38 2000/01/25 02:19:19 mjl Exp $");
+__RCSID("$NetBSD: su.c,v 1.39 2000/02/11 00:30:07 abs Exp $");
 #endif
 #endif /* not lint */
 
@@ -351,6 +351,7 @@
                (void)setenv("HOME", pwd->pw_dir, 1);
                (void)setenv("SHELL", shell, 1);
        }
+       (void)setenv("SU_FROM", username, 1);
 
        if (iscsh == YES) {
                if (fastlogin)



Home | Main Index | Thread Index | Old Index