Set SU_FROM environment variable. This can be used to determine a 'su -'
shell from a real login shell (but only if you care).
This commit is contained in:
parent
f8b76eb0fd
commit
ddcdaa6b45
@ -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 @@ S/Key is a Trademark of Bellcore.
|
||||
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 @@ are set to the target login's default values.
|
||||
.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 @@ The environment is discarded except for
|
||||
.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.
|
||||
|
@ -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 @@ __COPYRIGHT(
|
||||
#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 @@ badlogin:
|
||||
(void)setenv("HOME", pwd->pw_dir, 1);
|
||||
(void)setenv("SHELL", shell, 1);
|
||||
}
|
||||
(void)setenv("SU_FROM", username, 1);
|
||||
|
||||
if (iscsh == YES) {
|
||||
if (fastlogin)
|
||||
|
Loading…
Reference in New Issue
Block a user