telnetd/telnetd
marcel d37ea43702 Fix "automatic" login, broken by revision 69825 (12 years, 5 months ago).
The "automatic" login feature is described as follows:
The USER environment variable holds the name of the person telnetting in.
This is the username of the person on the client machine. The traditional
behaviour is to execute login(1) with this username first, meaning that
login(1) will prompt for the password only. If login fails, login(1) will
retry, but now prompt for the username before prompting for the password.

This feature got broken by how the environment got scrubbed. Before the
change in r69825 we removed variables that we deemed dangerous. Starting
with r69825 we only keep those variable we know to be safe.

The USER environment variable fell through the cracks. It suddenly got
scrubbed (i.e. removed from the environment) while still being checked
for. It also got explicitly removed from the environment to handle the
failed login case.

The fix is to obtain the value of the USER environment variable before
we scrub the environment and used the "cached" in subsequent checks.
This guarantees that the environment does not contain the USER variable
in the end, while still being able to implement "automatic" login.

Obtained from:	Juniper Networks, Inc.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@251188 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2013-05-31 17:30:12 +00:00
..
authenc.c Use __FBSDID vs. rcsid[]. Also protect sccs[] and copyright[] from GCC 3.3. 2003-05-04 02:54:49 +00:00
defs.h Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code. 2001-08-29 14:16:17 +00:00
ext.h Convert telnetd(8) to use posix_openpt(2). 2008-11-13 19:05:27 +00:00
global.c Use __FBSDID vs. rcsid[]. Also protect sccs[] and copyright[] from GCC 3.3. 2003-05-04 02:54:49 +00:00
pathnames.h Code merge and diff reduce with "base" telnet. This is the "later" 2001-08-20 12:28:40 +00:00
slc.c Use __FBSDID vs. rcsid[]. Also protect sccs[] and copyright[] from GCC 3.3. 2003-05-04 02:54:49 +00:00
state.c Make sure that each va_start has one and only one matching va_end, 2012-09-28 07:51:30 +00:00
sys_term.c Fix "automatic" login, broken by revision 69825 (12 years, 5 months ago). 2013-05-31 17:30:12 +00:00
telnetd.8 List authentication types supported with "-X" taken from the libtelnet 2008-08-29 00:04:37 +00:00
telnetd.c Forgot a part that was missing in the previous commit. 2010-01-13 18:46:50 +00:00
telnetd.h Very large style makeover. 2001-11-30 21:06:38 +00:00
termstat.c Add missing () to function invocation. 2004-07-28 05:37:18 +00:00
utility.c In contrib/telnet/telnetd/utility.c, fix a few warnings about format 2011-12-16 16:53:54 +00:00