summaryrefslogtreecommitdiff
path: root/libexec/telnetd
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1995-11-02 03:27:39 +0000
committerDavid Greenman <dg@FreeBSD.org>1995-11-02 03:27:39 +0000
commitef472a375eec03f8140d09887719acee489d450d (patch)
treef83c062bc27f1ac26c9000b258c0a8c58b82791a /libexec/telnetd
parentb2355ca3df11f3f6cc5f93647f8ae0c77de43fc8 (diff)
Notes
Diffstat (limited to 'libexec/telnetd')
-rw-r--r--libexec/telnetd/sys_term.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index c2388b5e5e23..2e3e4d2e6b90 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -1555,6 +1555,8 @@ start_login(host, autologin, name)
fatal(net, "makeutx failed");
#endif
+ scrub_env();
+
/*
* -h : pass on name of host.
* WARNING: -h is accepted by login if and only if
@@ -1768,6 +1770,32 @@ addarg(argv, val)
#endif /* NEWINIT */
/*
+ * scrub_env()
+ *
+ * Remove a few things from the environment that
+ * don't need to be there.
+ */
+scrub_env()
+{
+ register char **cpp, **cpp2;
+
+ for (cpp2 = cpp = environ; *cpp; cpp++) {
+#ifdef __FreeBSD__
+ if (strncmp(*cpp, "LD_LIBRARY_PATH=", 16) &&
+ strncmp(*cpp, "LD_NOSTD_PATH=", 14) &&
+ strncmp(*cpp, "LD_PRELOAD=", 11) &&
+#else
+ if (strncmp(*cpp, "LD_", 3) &&
+ strncmp(*cpp, "_RLD_", 5) &&
+ strncmp(*cpp, "LIBPATH=", 8) &&
+#endif
+ strncmp(*cpp, "IFS=", 4))
+ *cpp2++ = *cpp;
+ }
+ *cpp2 = 0;
+}
+
+/*
* cleanup()
*
* This is the routine to call when we are all through, to