summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1996-10-31 03:22:10 +0000
committermillert <millert@openbsd.org>1996-10-31 03:22:10 +0000
commit36b3ccd4d64feaa60ca463572c323db6f02ec95d (patch)
tree4dde5f44bfc7aefd6a43a0162bf1d6d60d0d798a
parentProper strncpy() usage. (diff)
downloadwireguard-openbsd-36b3ccd4d64feaa60ca463572c323db6f02ec95d.tar.xz
wireguard-openbsd-36b3ccd4d64feaa60ca463572c323db6f02ec95d.zip
Strip out $LD_* and $IFS if given -p. Code taken from telnetd.
-rw-r--r--usr.bin/login/login.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index c8d48ad7a09..7e7e4085607 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login.c,v 1.8 1996/10/23 01:28:56 millert Exp $ */
+/* $OpenBSD: login.c,v 1.9 1996/10/31 03:22:10 millert Exp $ */
/* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
#endif
-static char rcsid[] = "$OpenBSD: login.c,v 1.8 1996/10/23 01:28:56 millert Exp $";
+static char rcsid[] = "$OpenBSD: login.c,v 1.9 1996/10/31 03:22:10 millert Exp $";
#endif /* not lint */
/*
@@ -403,6 +403,16 @@ main(argc, argv)
/* Destroy environment unless user has requested its preservation. */
if (!pflag)
environ = envinit;
+ else {
+ char **cpp, **cpp2;
+
+ for (cpp2 = cpp = environ; *cpp; cpp++) {
+ if (strncmp(*cpp, "LD_", 3) &&
+ strncmp(*cpp, "IFS=", 4))
+ *cpp2++ = *cpp;
+ }
+ *cpp2 = 0;
+ }
(void)setenv("HOME", pwd->pw_dir, 1);
(void)setenv("SHELL", pwd->pw_shell, 1);
if (term[0] == '\0')