History log of /netbsd-current/libexec/telnetd/telnetd.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.59 21-Sep-2023 shm

Fix memory leak - free resources allocated by getaddrinfo


Revision tags: netbsd-10-base
# 1.58 26-Aug-2022 dholland

telnetd: fix the crash that's been talked about the past couple days.

(Move initialization of the slc table earlier so it doesn't get
accessed before that happens.)

Calling the crash a DoS or security problem is a bit overwrought; it's
just a bug.


# 1.57 08-Dec-2021 andvar

s/desireable/desirable/ in comments.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.56 15-Aug-2019 kamil

telnetd: Stop defining the same variables concurrently in bss and data

auth_level and require_secure_login were defined in two places:

- global.c that picked it from headers and removed 'extern'
- telnetd.c that initialized it to 0

line was defined twice: in global.c and sys_term.c with a non-zero value.
Remove the definition and initialization from sys_term.c and initialize
the variable early in main().

Detected during the build of telned with Address Sanitizer (MKSANITIZER).

Reviewed by <mrg>


Revision tags: netbsd-8-2-RELEASE netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.55 27-Feb-2014 joerg

branches: 1.55.18; 1.55.26; 1.55.28;
Global variable is never a null pointer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.54 10-Jan-2012 joerg

branches: 1.54.6;
Use __dead


# 1.53 09-Jan-2012 christos

PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.52 24-Apr-2011 elric

branches: 1.52.4;
#include <com_err.h> -> #include <krb5/com_err.h>.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.51 20-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 09-May-2006 mrg

branches: 1.50.20;
change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.


# 1.49 02-Feb-2006 he

Make the debug variable static, to accomodate static linking with libssh.a.


# 1.48 21-Jun-2005 lha

Remove static local variable so its easier to correctly use strlcpy.


# 1.47 01-Jun-2005 lukem

Ensure IF is initialized before trying to use it.
Found with -Wuninitialized.


Revision tags: netbsd-3-base
# 1.46 06-Feb-2005 perry

branches: 1.46.2;
de-__P, ANSIfy function declarations, remove obsolete "register" declarations.


# 1.45 30-Nov-2004 christos

PR/28473: Jed Davis: telnetd loses data and corrupts crypto state due to
typo in use of poll(). There was an && instead of an & (hi charles)


# 1.44 14-Nov-2004 christos

Pass -a [srrvis'd struct sockaddr] to login, so that login can record the
address where we have logged in from.


Revision tags: netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.43 07-Aug-2003 agc

branches: 1.43.2; 1.43.4;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22284, verified by myself.


# 1.42 22-Jul-2003 matt

Since telnetd has ignored the USER environment variable for logging in for
quite a bit of time, make telnetd ignore it completely now. This results
in the :if=: entry in the default gettytab entry to honored instead of
being ignored. The -h option to telnetd will continue to suppress the
inclusion of :if=:


# 1.41 15-Jul-2003 itojun

use bounded string op. bump shlib major for libtelnet due to API change.


# 1.40 14-Jul-2003 itojun

SIGINFO is defined


# 1.39 14-Jul-2003 itojun

remove unneeded #ifdefs. improves readability.
(confirmed that exact same *.o is produced)


# 1.38 13-Jul-2003 itojun

use bounded string op (there still are remains)


# 1.37 17-May-2003 itojun

use strlcpy


# 1.36 09-May-2003 christos

PR/21233: Onno van der Linden: -U option does not work as advertised.


Revision tags: fvdl_fs64_base
# 1.35 20-Sep-2002 mycroft

Remove dead code.


# 1.34 18-Sep-2002 mycroft

select() -> poll()


# 1.33 20-Aug-2002 christos

add some more ifdefs, so that we don't define variables we don't use.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.32 31-Jan-2002 itojun

implement -u <len>. PR 13676


# 1.31 02-Sep-2001 wiz

-edebug should only be mentioned in the help #ifdef ENCRYPTION, not #ifdef
AUTHENTICATION. Noted (with patch) by Brian Ginsbach.


# 1.30 30-Aug-2001 wiz

Remove code #ifdef'd on NEWINIT (never used on NetBSD).
Sync with Cray, patch by Brian Ginsbach in private mail.


# 1.29 24-Aug-2001 wiz

Remove lots of #ifdef's for dead Cray hardware and obsolete UNICOS releases;
also some Cray-specific fixes. No change for NetBSD.
From Brian Ginsbach of Cray Inc. in bin/13614 and private mail.


# 1.28 20-Aug-2001 wiz

Fix typo, and duplicate ';'. From bin/13667 by Brian Ginsbach.


# 1.27 20-Aug-2001 wiz

Add some (const char *) casts per bin/13667 by Brian Ginsbach.


# 1.26 19-Jul-2001 itojun

bound-check all "*nfrontp++" code. from openbsd/heimdal.
bark if file descriptor goes above FD_SETSIZE. from openbsd.

XXX needs more checking.
XXX what is tab stop size for this code? need more consistency...
XXX we should really remove #ifdef CRAY, UNICOS5 and such.
we just cannot read it through.


# 1.25 04-Feb-2001 christos

fix redundant declarations.


# 1.24 10-Jan-2001 lukem

use LOG_ERR for fatal errors, LOG_WARNING for other errors
minor knf
deprecate LOG_ODELAY; it's the default


# 1.23 19-Nov-2000 christos

Buffer overflow and environment passing fixes [originally inspired from
FreeBSD]. We really didn't need the environment fixes, but for the sake
of keeping the code as close as possible...


# 1.22 18-Aug-2000 itojun

make error case handling in -daemon case meet with other portion of the code.
(use fprintf-then-exit, not errx - costmetic)


# 1.21 22-Jun-2000 thorpej

Bring the telnet situation back into better shape. Specifically,
pull in just about all of the differences from the crypto-us telnet
suite (which includes Kerberos 4 and connection encryption support).
Also bring in the Kerberos 5 support from the Heimdal telnet, and
frob a little so that it can work with the non-Heimdal telnet suite.

There is still some work left to do, specifically:
- Add Heimdal's ticket forwarding support to the Berkeley Kerberos 4
module.
- Add connection encryption support to the Heimdal Kerberos 5
module. Hints on this can be taken from the MIT Kerberos 5
module which still exists in crypto-us.

However, even with the shortcomings listed above, this is a
better situation than using the stock Heimdal telnet suite,
which does not understand the IPSec policy stuff, and is also
based on much older code which contains bugs that we have already
fixed in the NetBSD sources.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.20 13-Jan-2000 ad

branches: 1.20.4;
Make 'if' capability from gettytab work. *shudder*.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.19 16-Dec-1999 itojun

do not touch __ss_len directly, they are not supposed to be touched.


Revision tags: comdex-fall-1999-base
# 1.18 11-Jul-1999 thorpej

branches: 1.18.4;
Nuke some whitespace.


# 1.17 11-Jul-1999 thorpej

Put the RCS ID in the correct place.


# 1.16 02-Jul-1999 itojun

dual-stack telnetd.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 12-Feb-1999 dean

Fix for PR 5821
- s/SecurID/SECURELOGIN/g and define SECURELOGIN in Makefile
- update man page to reflect S/Key and Kerboros authentication used
not SecurID


# 1.14 09-Jul-1998 msaitoh

Declare ints, too, don't default them.


# 1.13 06-Jul-1998 mrg

- use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.12 20-Oct-1997 enami

No need to declare optind and optarg.


# 1.11 16-Oct-1997 mikel

don't include <sys/cdefs.h> twice, kill old-style getpty() declaration


# 1.10 14-Oct-1997 lukem

use <termcap.h>


# 1.9 08-Oct-1997 mrg

WARNS?=1. RCS ids.


# 1.8 08-Oct-1997 enami

Put a whitespace after the keyword `switch'.


# 1.7 08-Oct-1997 enami

Compare a return value of getopt() against -1 instead of EOF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.6 20-Mar-1996 tls

apply Thorsten's patch to add gettytab support to telnetd.


# 1.5 28-Feb-1996 thorpej

RCS id cosmetics.


# 1.4 24-Feb-1996 jtk

update to telnetd from 95.10.23 version. Includes Borman's scrub_env()
to keep stuff out of the environment on the way to exec (we already have
one in the state machine that keeps them from arriving over the wire, so
this should be redundant, but it'll make any further updates easier to
have it present).

also, RCS Id police.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.3 25-Feb-1994 cgd

new telnetd from ftp.cray.com. Encryption support ripped out, pending
figuring out what to do about it...


# 1.2 01-Aug-1993 mycroft

Add RCS identifiers.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.58 26-Aug-2022 dholland

telnetd: fix the crash that's been talked about the past couple days.

(Move initialization of the slc table earlier so it doesn't get
accessed before that happens.)

Calling the crash a DoS or security problem is a bit overwrought; it's
just a bug.


# 1.57 08-Dec-2021 andvar

s/desireable/desirable/ in comments.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.56 15-Aug-2019 kamil

telnetd: Stop defining the same variables concurrently in bss and data

auth_level and require_secure_login were defined in two places:

- global.c that picked it from headers and removed 'extern'
- telnetd.c that initialized it to 0

line was defined twice: in global.c and sys_term.c with a non-zero value.
Remove the definition and initialization from sys_term.c and initialize
the variable early in main().

Detected during the build of telned with Address Sanitizer (MKSANITIZER).

Reviewed by <mrg>


Revision tags: netbsd-8-2-RELEASE netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.55 27-Feb-2014 joerg

branches: 1.55.26; 1.55.28;
Global variable is never a null pointer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.54 10-Jan-2012 joerg

branches: 1.54.6;
Use __dead


# 1.53 09-Jan-2012 christos

PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.52 24-Apr-2011 elric

branches: 1.52.4;
#include <com_err.h> -> #include <krb5/com_err.h>.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.51 20-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 09-May-2006 mrg

branches: 1.50.20;
change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.


# 1.49 02-Feb-2006 he

Make the debug variable static, to accomodate static linking with libssh.a.


# 1.48 21-Jun-2005 lha

Remove static local variable so its easier to correctly use strlcpy.


# 1.47 01-Jun-2005 lukem

Ensure IF is initialized before trying to use it.
Found with -Wuninitialized.


Revision tags: netbsd-3-base
# 1.46 06-Feb-2005 perry

branches: 1.46.2;
de-__P, ANSIfy function declarations, remove obsolete "register" declarations.


# 1.45 30-Nov-2004 christos

PR/28473: Jed Davis: telnetd loses data and corrupts crypto state due to
typo in use of poll(). There was an && instead of an & (hi charles)


# 1.44 14-Nov-2004 christos

Pass -a [srrvis'd struct sockaddr] to login, so that login can record the
address where we have logged in from.


Revision tags: netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.43 07-Aug-2003 agc

branches: 1.43.2; 1.43.4;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22284, verified by myself.


# 1.42 22-Jul-2003 matt

Since telnetd has ignored the USER environment variable for logging in for
quite a bit of time, make telnetd ignore it completely now. This results
in the :if=: entry in the default gettytab entry to honored instead of
being ignored. The -h option to telnetd will continue to suppress the
inclusion of :if=:


# 1.41 15-Jul-2003 itojun

use bounded string op. bump shlib major for libtelnet due to API change.


# 1.40 14-Jul-2003 itojun

SIGINFO is defined


# 1.39 14-Jul-2003 itojun

remove unneeded #ifdefs. improves readability.
(confirmed that exact same *.o is produced)


# 1.38 13-Jul-2003 itojun

use bounded string op (there still are remains)


# 1.37 17-May-2003 itojun

use strlcpy


# 1.36 09-May-2003 christos

PR/21233: Onno van der Linden: -U option does not work as advertised.


Revision tags: fvdl_fs64_base
# 1.35 20-Sep-2002 mycroft

Remove dead code.


# 1.34 18-Sep-2002 mycroft

select() -> poll()


# 1.33 20-Aug-2002 christos

add some more ifdefs, so that we don't define variables we don't use.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.32 31-Jan-2002 itojun

implement -u <len>. PR 13676


# 1.31 02-Sep-2001 wiz

-edebug should only be mentioned in the help #ifdef ENCRYPTION, not #ifdef
AUTHENTICATION. Noted (with patch) by Brian Ginsbach.


# 1.30 30-Aug-2001 wiz

Remove code #ifdef'd on NEWINIT (never used on NetBSD).
Sync with Cray, patch by Brian Ginsbach in private mail.


# 1.29 24-Aug-2001 wiz

Remove lots of #ifdef's for dead Cray hardware and obsolete UNICOS releases;
also some Cray-specific fixes. No change for NetBSD.
From Brian Ginsbach of Cray Inc. in bin/13614 and private mail.


# 1.28 20-Aug-2001 wiz

Fix typo, and duplicate ';'. From bin/13667 by Brian Ginsbach.


# 1.27 20-Aug-2001 wiz

Add some (const char *) casts per bin/13667 by Brian Ginsbach.


# 1.26 19-Jul-2001 itojun

bound-check all "*nfrontp++" code. from openbsd/heimdal.
bark if file descriptor goes above FD_SETSIZE. from openbsd.

XXX needs more checking.
XXX what is tab stop size for this code? need more consistency...
XXX we should really remove #ifdef CRAY, UNICOS5 and such.
we just cannot read it through.


# 1.25 04-Feb-2001 christos

fix redundant declarations.


# 1.24 10-Jan-2001 lukem

use LOG_ERR for fatal errors, LOG_WARNING for other errors
minor knf
deprecate LOG_ODELAY; it's the default


# 1.23 19-Nov-2000 christos

Buffer overflow and environment passing fixes [originally inspired from
FreeBSD]. We really didn't need the environment fixes, but for the sake
of keeping the code as close as possible...


# 1.22 18-Aug-2000 itojun

make error case handling in -daemon case meet with other portion of the code.
(use fprintf-then-exit, not errx - costmetic)


# 1.21 22-Jun-2000 thorpej

Bring the telnet situation back into better shape. Specifically,
pull in just about all of the differences from the crypto-us telnet
suite (which includes Kerberos 4 and connection encryption support).
Also bring in the Kerberos 5 support from the Heimdal telnet, and
frob a little so that it can work with the non-Heimdal telnet suite.

There is still some work left to do, specifically:
- Add Heimdal's ticket forwarding support to the Berkeley Kerberos 4
module.
- Add connection encryption support to the Heimdal Kerberos 5
module. Hints on this can be taken from the MIT Kerberos 5
module which still exists in crypto-us.

However, even with the shortcomings listed above, this is a
better situation than using the stock Heimdal telnet suite,
which does not understand the IPSec policy stuff, and is also
based on much older code which contains bugs that we have already
fixed in the NetBSD sources.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.20 13-Jan-2000 ad

branches: 1.20.4;
Make 'if' capability from gettytab work. *shudder*.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.19 16-Dec-1999 itojun

do not touch __ss_len directly, they are not supposed to be touched.


Revision tags: comdex-fall-1999-base
# 1.18 11-Jul-1999 thorpej

branches: 1.18.4;
Nuke some whitespace.


# 1.17 11-Jul-1999 thorpej

Put the RCS ID in the correct place.


# 1.16 02-Jul-1999 itojun

dual-stack telnetd.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 12-Feb-1999 dean

Fix for PR 5821
- s/SecurID/SECURELOGIN/g and define SECURELOGIN in Makefile
- update man page to reflect S/Key and Kerboros authentication used
not SecurID


# 1.14 09-Jul-1998 msaitoh

Declare ints, too, don't default them.


# 1.13 06-Jul-1998 mrg

- use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.12 20-Oct-1997 enami

No need to declare optind and optarg.


# 1.11 16-Oct-1997 mikel

don't include <sys/cdefs.h> twice, kill old-style getpty() declaration


# 1.10 14-Oct-1997 lukem

use <termcap.h>


# 1.9 08-Oct-1997 mrg

WARNS?=1. RCS ids.


# 1.8 08-Oct-1997 enami

Put a whitespace after the keyword `switch'.


# 1.7 08-Oct-1997 enami

Compare a return value of getopt() against -1 instead of EOF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.6 20-Mar-1996 tls

apply Thorsten's patch to add gettytab support to telnetd.


# 1.5 28-Feb-1996 thorpej

RCS id cosmetics.


# 1.4 24-Feb-1996 jtk

update to telnetd from 95.10.23 version. Includes Borman's scrub_env()
to keep stuff out of the environment on the way to exec (we already have
one in the state machine that keeps them from arriving over the wire, so
this should be redundant, but it'll make any further updates easier to
have it present).

also, RCS Id police.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.3 25-Feb-1994 cgd

new telnetd from ftp.cray.com. Encryption support ripped out, pending
figuring out what to do about it...


# 1.2 01-Aug-1993 mycroft

Add RCS identifiers.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.57 08-Dec-2021 andvar

s/desireable/desirable/ in comments.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.56 15-Aug-2019 kamil

telnetd: Stop defining the same variables concurrently in bss and data

auth_level and require_secure_login were defined in two places:

- global.c that picked it from headers and removed 'extern'
- telnetd.c that initialized it to 0

line was defined twice: in global.c and sys_term.c with a non-zero value.
Remove the definition and initialization from sys_term.c and initialize
the variable early in main().

Detected during the build of telned with Address Sanitizer (MKSANITIZER).

Reviewed by <mrg>


Revision tags: netbsd-8-2-RELEASE netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.55 27-Feb-2014 joerg

branches: 1.55.26; 1.55.28;
Global variable is never a null pointer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.54 10-Jan-2012 joerg

branches: 1.54.6;
Use __dead


# 1.53 09-Jan-2012 christos

PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.52 24-Apr-2011 elric

branches: 1.52.4;
#include <com_err.h> -> #include <krb5/com_err.h>.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.51 20-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 09-May-2006 mrg

branches: 1.50.20;
change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.


# 1.49 02-Feb-2006 he

Make the debug variable static, to accomodate static linking with libssh.a.


# 1.48 21-Jun-2005 lha

Remove static local variable so its easier to correctly use strlcpy.


# 1.47 01-Jun-2005 lukem

Ensure IF is initialized before trying to use it.
Found with -Wuninitialized.


Revision tags: netbsd-3-base
# 1.46 06-Feb-2005 perry

branches: 1.46.2;
de-__P, ANSIfy function declarations, remove obsolete "register" declarations.


# 1.45 30-Nov-2004 christos

PR/28473: Jed Davis: telnetd loses data and corrupts crypto state due to
typo in use of poll(). There was an && instead of an & (hi charles)


# 1.44 14-Nov-2004 christos

Pass -a [srrvis'd struct sockaddr] to login, so that login can record the
address where we have logged in from.


Revision tags: netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.43 07-Aug-2003 agc

branches: 1.43.2; 1.43.4;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22284, verified by myself.


# 1.42 22-Jul-2003 matt

Since telnetd has ignored the USER environment variable for logging in for
quite a bit of time, make telnetd ignore it completely now. This results
in the :if=: entry in the default gettytab entry to honored instead of
being ignored. The -h option to telnetd will continue to suppress the
inclusion of :if=:


# 1.41 15-Jul-2003 itojun

use bounded string op. bump shlib major for libtelnet due to API change.


# 1.40 14-Jul-2003 itojun

SIGINFO is defined


# 1.39 14-Jul-2003 itojun

remove unneeded #ifdefs. improves readability.
(confirmed that exact same *.o is produced)


# 1.38 13-Jul-2003 itojun

use bounded string op (there still are remains)


# 1.37 17-May-2003 itojun

use strlcpy


# 1.36 09-May-2003 christos

PR/21233: Onno van der Linden: -U option does not work as advertised.


Revision tags: fvdl_fs64_base
# 1.35 20-Sep-2002 mycroft

Remove dead code.


# 1.34 18-Sep-2002 mycroft

select() -> poll()


# 1.33 20-Aug-2002 christos

add some more ifdefs, so that we don't define variables we don't use.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.32 31-Jan-2002 itojun

implement -u <len>. PR 13676


# 1.31 02-Sep-2001 wiz

-edebug should only be mentioned in the help #ifdef ENCRYPTION, not #ifdef
AUTHENTICATION. Noted (with patch) by Brian Ginsbach.


# 1.30 30-Aug-2001 wiz

Remove code #ifdef'd on NEWINIT (never used on NetBSD).
Sync with Cray, patch by Brian Ginsbach in private mail.


# 1.29 24-Aug-2001 wiz

Remove lots of #ifdef's for dead Cray hardware and obsolete UNICOS releases;
also some Cray-specific fixes. No change for NetBSD.
From Brian Ginsbach of Cray Inc. in bin/13614 and private mail.


# 1.28 20-Aug-2001 wiz

Fix typo, and duplicate ';'. From bin/13667 by Brian Ginsbach.


# 1.27 20-Aug-2001 wiz

Add some (const char *) casts per bin/13667 by Brian Ginsbach.


# 1.26 19-Jul-2001 itojun

bound-check all "*nfrontp++" code. from openbsd/heimdal.
bark if file descriptor goes above FD_SETSIZE. from openbsd.

XXX needs more checking.
XXX what is tab stop size for this code? need more consistency...
XXX we should really remove #ifdef CRAY, UNICOS5 and such.
we just cannot read it through.


# 1.25 04-Feb-2001 christos

fix redundant declarations.


# 1.24 10-Jan-2001 lukem

use LOG_ERR for fatal errors, LOG_WARNING for other errors
minor knf
deprecate LOG_ODELAY; it's the default


# 1.23 19-Nov-2000 christos

Buffer overflow and environment passing fixes [originally inspired from
FreeBSD]. We really didn't need the environment fixes, but for the sake
of keeping the code as close as possible...


# 1.22 18-Aug-2000 itojun

make error case handling in -daemon case meet with other portion of the code.
(use fprintf-then-exit, not errx - costmetic)


# 1.21 22-Jun-2000 thorpej

Bring the telnet situation back into better shape. Specifically,
pull in just about all of the differences from the crypto-us telnet
suite (which includes Kerberos 4 and connection encryption support).
Also bring in the Kerberos 5 support from the Heimdal telnet, and
frob a little so that it can work with the non-Heimdal telnet suite.

There is still some work left to do, specifically:
- Add Heimdal's ticket forwarding support to the Berkeley Kerberos 4
module.
- Add connection encryption support to the Heimdal Kerberos 5
module. Hints on this can be taken from the MIT Kerberos 5
module which still exists in crypto-us.

However, even with the shortcomings listed above, this is a
better situation than using the stock Heimdal telnet suite,
which does not understand the IPSec policy stuff, and is also
based on much older code which contains bugs that we have already
fixed in the NetBSD sources.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.20 13-Jan-2000 ad

branches: 1.20.4;
Make 'if' capability from gettytab work. *shudder*.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.19 16-Dec-1999 itojun

do not touch __ss_len directly, they are not supposed to be touched.


Revision tags: comdex-fall-1999-base
# 1.18 11-Jul-1999 thorpej

branches: 1.18.4;
Nuke some whitespace.


# 1.17 11-Jul-1999 thorpej

Put the RCS ID in the correct place.


# 1.16 02-Jul-1999 itojun

dual-stack telnetd.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 12-Feb-1999 dean

Fix for PR 5821
- s/SecurID/SECURELOGIN/g and define SECURELOGIN in Makefile
- update man page to reflect S/Key and Kerboros authentication used
not SecurID


# 1.14 09-Jul-1998 msaitoh

Declare ints, too, don't default them.


# 1.13 06-Jul-1998 mrg

- use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.12 20-Oct-1997 enami

No need to declare optind and optarg.


# 1.11 16-Oct-1997 mikel

don't include <sys/cdefs.h> twice, kill old-style getpty() declaration


# 1.10 14-Oct-1997 lukem

use <termcap.h>


# 1.9 08-Oct-1997 mrg

WARNS?=1. RCS ids.


# 1.8 08-Oct-1997 enami

Put a whitespace after the keyword `switch'.


# 1.7 08-Oct-1997 enami

Compare a return value of getopt() against -1 instead of EOF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.6 20-Mar-1996 tls

apply Thorsten's patch to add gettytab support to telnetd.


# 1.5 28-Feb-1996 thorpej

RCS id cosmetics.


# 1.4 24-Feb-1996 jtk

update to telnetd from 95.10.23 version. Includes Borman's scrub_env()
to keep stuff out of the environment on the way to exec (we already have
one in the state machine that keeps them from arriving over the wire, so
this should be redundant, but it'll make any further updates easier to
have it present).

also, RCS Id police.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.3 25-Feb-1994 cgd

new telnetd from ftp.cray.com. Encryption support ripped out, pending
figuring out what to do about it...


# 1.2 01-Aug-1993 mycroft

Add RCS identifiers.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.56 15-Aug-2019 kamil

telnetd: Stop defining the same variables concurrently in bss and data

auth_level and require_secure_login were defined in two places:

- global.c that picked it from headers and removed 'extern'
- telnetd.c that initialized it to 0

line was defined twice: in global.c and sys_term.c with a non-zero value.
Remove the definition and initialization from sys_term.c and initialize
the variable early in main().

Detected during the build of telned with Address Sanitizer (MKSANITIZER).

Reviewed by <mrg>


Revision tags: netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.55 27-Feb-2014 joerg

Global variable is never a null pointer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base
# 1.54 10-Jan-2012 joerg

branches: 1.54.6;
Use __dead


# 1.53 09-Jan-2012 christos

PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.52 24-Apr-2011 elric

branches: 1.52.4;
#include <com_err.h> -> #include <krb5/com_err.h>.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.51 20-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 1.50 09-May-2006 mrg

branches: 1.50.20;
change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.


# 1.49 02-Feb-2006 he

Make the debug variable static, to accomodate static linking with libssh.a.


# 1.48 21-Jun-2005 lha

Remove static local variable so its easier to correctly use strlcpy.


# 1.47 01-Jun-2005 lukem

Ensure IF is initialized before trying to use it.
Found with -Wuninitialized.


Revision tags: netbsd-3-base
# 1.46 06-Feb-2005 perry

branches: 1.46.2;
de-__P, ANSIfy function declarations, remove obsolete "register" declarations.


# 1.45 30-Nov-2004 christos

PR/28473: Jed Davis: telnetd loses data and corrupts crypto state due to
typo in use of poll(). There was an && instead of an & (hi charles)


# 1.44 14-Nov-2004 christos

Pass -a [srrvis'd struct sockaddr] to login, so that login can record the
address where we have logged in from.


Revision tags: netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.43 07-Aug-2003 agc

branches: 1.43.2; 1.43.4;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22284, verified by myself.


# 1.42 22-Jul-2003 matt

Since telnetd has ignored the USER environment variable for logging in for
quite a bit of time, make telnetd ignore it completely now. This results
in the :if=: entry in the default gettytab entry to honored instead of
being ignored. The -h option to telnetd will continue to suppress the
inclusion of :if=:


# 1.41 15-Jul-2003 itojun

use bounded string op. bump shlib major for libtelnet due to API change.


# 1.40 14-Jul-2003 itojun

SIGINFO is defined


# 1.39 14-Jul-2003 itojun

remove unneeded #ifdefs. improves readability.
(confirmed that exact same *.o is produced)


# 1.38 13-Jul-2003 itojun

use bounded string op (there still are remains)


# 1.37 17-May-2003 itojun

use strlcpy


# 1.36 09-May-2003 christos

PR/21233: Onno van der Linden: -U option does not work as advertised.


Revision tags: fvdl_fs64_base
# 1.35 20-Sep-2002 mycroft

Remove dead code.


# 1.34 18-Sep-2002 mycroft

select() -> poll()


# 1.33 20-Aug-2002 christos

add some more ifdefs, so that we don't define variables we don't use.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.32 31-Jan-2002 itojun

implement -u <len>. PR 13676


# 1.31 02-Sep-2001 wiz

-edebug should only be mentioned in the help #ifdef ENCRYPTION, not #ifdef
AUTHENTICATION. Noted (with patch) by Brian Ginsbach.


# 1.30 30-Aug-2001 wiz

Remove code #ifdef'd on NEWINIT (never used on NetBSD).
Sync with Cray, patch by Brian Ginsbach in private mail.


# 1.29 24-Aug-2001 wiz

Remove lots of #ifdef's for dead Cray hardware and obsolete UNICOS releases;
also some Cray-specific fixes. No change for NetBSD.
From Brian Ginsbach of Cray Inc. in bin/13614 and private mail.


# 1.28 20-Aug-2001 wiz

Fix typo, and duplicate ';'. From bin/13667 by Brian Ginsbach.


# 1.27 20-Aug-2001 wiz

Add some (const char *) casts per bin/13667 by Brian Ginsbach.


# 1.26 19-Jul-2001 itojun

bound-check all "*nfrontp++" code. from openbsd/heimdal.
bark if file descriptor goes above FD_SETSIZE. from openbsd.

XXX needs more checking.
XXX what is tab stop size for this code? need more consistency...
XXX we should really remove #ifdef CRAY, UNICOS5 and such.
we just cannot read it through.


# 1.25 04-Feb-2001 christos

fix redundant declarations.


# 1.24 10-Jan-2001 lukem

use LOG_ERR for fatal errors, LOG_WARNING for other errors
minor knf
deprecate LOG_ODELAY; it's the default


# 1.23 19-Nov-2000 christos

Buffer overflow and environment passing fixes [originally inspired from
FreeBSD]. We really didn't need the environment fixes, but for the sake
of keeping the code as close as possible...


# 1.22 18-Aug-2000 itojun

make error case handling in -daemon case meet with other portion of the code.
(use fprintf-then-exit, not errx - costmetic)


# 1.21 22-Jun-2000 thorpej

Bring the telnet situation back into better shape. Specifically,
pull in just about all of the differences from the crypto-us telnet
suite (which includes Kerberos 4 and connection encryption support).
Also bring in the Kerberos 5 support from the Heimdal telnet, and
frob a little so that it can work with the non-Heimdal telnet suite.

There is still some work left to do, specifically:
- Add Heimdal's ticket forwarding support to the Berkeley Kerberos 4
module.
- Add connection encryption support to the Heimdal Kerberos 5
module. Hints on this can be taken from the MIT Kerberos 5
module which still exists in crypto-us.

However, even with the shortcomings listed above, this is a
better situation than using the stock Heimdal telnet suite,
which does not understand the IPSec policy stuff, and is also
based on much older code which contains bugs that we have already
fixed in the NetBSD sources.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.20 13-Jan-2000 ad

branches: 1.20.4;
Make 'if' capability from gettytab work. *shudder*.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.19 16-Dec-1999 itojun

do not touch __ss_len directly, they are not supposed to be touched.


Revision tags: comdex-fall-1999-base
# 1.18 11-Jul-1999 thorpej

branches: 1.18.4;
Nuke some whitespace.


# 1.17 11-Jul-1999 thorpej

Put the RCS ID in the correct place.


# 1.16 02-Jul-1999 itojun

dual-stack telnetd.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.15 12-Feb-1999 dean

Fix for PR 5821
- s/SecurID/SECURELOGIN/g and define SECURELOGIN in Makefile
- update man page to reflect S/Key and Kerboros authentication used
not SecurID


# 1.14 09-Jul-1998 msaitoh

Declare ints, too, don't default them.


# 1.13 06-Jul-1998 mrg

- use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.12 20-Oct-1997 enami

No need to declare optind and optarg.


# 1.11 16-Oct-1997 mikel

don't include <sys/cdefs.h> twice, kill old-style getpty() declaration


# 1.10 14-Oct-1997 lukem

use <termcap.h>


# 1.9 08-Oct-1997 mrg

WARNS?=1. RCS ids.


# 1.8 08-Oct-1997 enami

Put a whitespace after the keyword `switch'.


# 1.7 08-Oct-1997 enami

Compare a return value of getopt() against -1 instead of EOF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.6 20-Mar-1996 tls

apply Thorsten's patch to add gettytab support to telnetd.


# 1.5 28-Feb-1996 thorpej

RCS id cosmetics.


# 1.4 24-Feb-1996 jtk

update to telnetd from 95.10.23 version. Includes Borman's scrub_env()
to keep stuff out of the environment on the way to exec (we already have
one in the state machine that keeps them from arriving over the wire, so
this should be redundant, but it'll make any further updates easier to
have it present).

also, RCS Id police.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.3 25-Feb-1994 cgd

new telnetd from ftp.cray.com. Encryption support ripped out, pending
figuring out what to do about it...


# 1.2 01-Aug-1993 mycroft

Add RCS identifiers.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision