PR/5803: Gregg A. Woods: su doesn't support it's "-f" option for sh and/or ksh

fixed by unsetenv("ENV") when -f is set and the shell is not csh.
This commit is contained in:
christos 2003-04-20 20:13:20 +00:00
parent 336e3096f2
commit c71d457343
2 changed files with 13 additions and 3 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" from: @(#)su.1 8.2 (Berkeley) 4/18/94 .\" from: @(#)su.1 8.2 (Berkeley) 4/18/94
.\" $NetBSD: su.1,v 1.28 2003/02/25 10:35:56 wiz Exp $ .\" $NetBSD: su.1,v 1.29 2003/04/20 20:13:20 christos Exp $
.\" .\"
.Dd January 19, 2003 .Dd January 19, 2003
.Dt SU 1 .Dt SU 1
@ -106,6 +106,14 @@ If the invoked shell is
this option prevents it from reading the this option prevents it from reading the
.Dq Pa .cshrc .Dq Pa .cshrc
file. file.
If the invoked shell is
.Xr sh 1 ,
or
.Xr ksh 1 ,
this option unsets
.Ev ENV ,
thus preventing the shell from executing the startup file pointed to by
this variable.
.It Fl l .It Fl l
Simulate a full login. Simulate a full login.
The environment is discarded except for The environment is discarded except for

View File

@ -1,4 +1,4 @@
/* $NetBSD: su.c,v 1.51 2002/11/16 15:59:31 itojun Exp $ */ /* $NetBSD: su.c,v 1.52 2003/04/20 20:13:20 christos Exp $ */
/* /*
* Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1988 The Regents of the University of California.
@ -44,7 +44,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/ static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/
#else #else
__RCSID("$NetBSD: su.c,v 1.51 2002/11/16 15:59:31 itojun Exp $"); __RCSID("$NetBSD: su.c,v 1.52 2003/04/20 20:13:20 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -356,6 +356,8 @@ badlogin:
*np-- = "-f"; *np-- = "-f";
if (asme) if (asme)
*np-- = "-m"; *np-- = "-m";
} else {
unsetenv("ENV");
} }
if (asthem) { if (asthem) {