Home | History | Annotate | Download | only in telnetd
History log of /src/libexec/telnetd/state.c
RevisionDateAuthorComments
 1.35  29-Oct-2024  kre PR bin/58787 telnetd - handle auto authentication better

Apparently from FreeBSD via RVP -- but FreeBSD deleted telnetd
more than 2 years ago, so I assume instead from
https://github.com/cschuber/freebsd-telnet/tree/main/contrib/telnet
 1.34  10-Feb-2024  andvar branches: 1.34.2;
fix various typos in comments and log messages.
 1.33  22-Sep-2023  shm Fix off by one in telrcv()

In case of "\r" in the data buffer, the code was unconditionally looking ahead
to next character, even if "\r" was last character in the buffer. That
condition leads to read outside of the data (one byte after the array)

Thanks christos@ for the review
 1.32  09-Aug-2021  andvar branches: 1.32.2;
s/fist/first/
 1.31  03-Feb-2019  mrg branches: 1.31.2;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.30  12-Dec-2016  maya branches: 1.30.14;
acknowleg -> acknowledg, proceedure -> procedure.
only comments were changed.

from miod
 1.29  09-Jan-2012  christos branches: 1.29.22;
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4
 1.28  23-Dec-2011  christos there is a macro for that, use it.
 1.27  21-Feb-2007  hubertf branches: 1.27.34;
Move ctype.h from headers to files which really need it
From: Slava Semushin <slava.semushin@gmail.com>
 1.26  21-Jun-2005  lha Remove static local variable so its easier to correctly use strlcpy.
 1.25  06-Feb-2005  perry branches: 1.25.2;
de-__P, ANSIfy function declarations, remove obsolete "register" declarations.
 1.24  07-Aug-2003  agc branches: 1.24.2; 1.24.4;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22284, verified by myself.
 1.23  14-Jul-2003  itojun remove unneeded #ifdefs. improves readability.
(confirmed that exact same *.o is produced)
 1.22  11-Feb-2002  wiz achive is not a good word.
 1.21  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.20  20-Aug-2001  wiz Typo fixes and syslog string improvements, from bin/13667 by Brian Ginsbach.
 1.19  20-Aug-2001  wiz Add some (const char *) casts per bin/13667 by Brian Ginsbach.
 1.18  27-Jul-2001  wiz Fix compilation without -DLINEMODE, per bin/13571 from Onno van der Linden.
 1.17  19-Jul-2001  itojun vsnprintf() can return value longer than the actual string. from assar
 1.16  19-Jul-2001  itojun try netflush() if buffer is too low.
 1.15  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.14  04-Feb-2001  christos fix redundant declarations.
 1.13  10-Oct-2000  is Format string cleanups by sommerfeld.
 1.12  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.
 1.11  08-Oct-1997  mrg branches: 1.11.4; 1.11.12;
WARNS?=1. RCS ids.
 1.10  07-Sep-1996  explorer Block ENV and BASH_ENV from client. From David Holland <dholland@hcs.harvard.edu>
 1.9  28-Feb-1996  thorpej RCS id cosmetics.
 1.8  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.
 1.7  19-Oct-1995  ghudson Cleanup, from Mark Eichin.
 1.6  18-Oct-1995  ghudson Filter potentially dangerous environment variables passed from
telnet client.
 1.5  25-Feb-1994  cgd branches: 1.5.4;
new telnetd from ftp.cray.com. Encryption support ripped out, pending
figuring out what to do about it...
 1.4  02-Aug-1993  mycroft Nuke remaining patchkit headers.
 1.3  01-Aug-1993  mycroft Add RCS identifiers.
 1.2  21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  24-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.4.2  19-Oct-1995  ghudson Update from trunk.
 1.5.4.1  18-Oct-1995  ghudson Update from trunk.
 1.11.12.3  29-Jul-2001  jhawk Pull up revision 1.17 via patch (requested by itojun):
Security-related fixups for telnet
Bound-check all "*nfrontp++" code. From OpenBSD and Heimdal.
Complain if file descriptor goes above FD_SETSIZE. From OpenBSD.
 1.11.12.2  17-Oct-2000  tv Pullup libexec string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.11.12.1  22-Jun-2000  thorpej Update from trunk:
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.
 1.11.4.1  10-Oct-2000  he Pull up revision 1.13 (requested by is):
Format string cleanup.
 1.24.4.1  01-Jul-2005  tron Apply patch (requested by lha in ticket #2041):
Remove static local variable so its easier to correctly use strlcpy.
 1.24.2.1  01-Jul-2005  tron Apply patch (requested by lha in ticket #2041):
Remove static local variable so its easier to correctly use strlcpy.
 1.25.2.1  27-Jun-2005  tron Pull up revision 1.26 (requested by lha in ticket #502):
Remove static local variable so its easier to correctly use strlcpy.
 1.27.34.1  17-Apr-2012  yamt sync with head
 1.29.22.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.30.14.1  10-Jun-2019  christos Sync with HEAD
 1.31.2.1  18-Nov-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1927):

lib/libtelnet/encrypt.h: revision 1.10
libexec/telnetd/telnetd.c: revision 1.59
libexec/telnetd/sys_term.c: revision 1.50
lib/libtelnet/encrypt.c: revision 1.20
lib/libtelnet/enc_des.c: revision 1.18
lib/libtelnet/enc-proto.h: revision 1.11
libexec/telnetd/state.c: revision 1.33
libexec/telnetd/state.c: revision 1.35
libexec/telnetd/telnetd.c: revision 1.60

Fix memory leak - free resources allocated by getaddrinfo

Fix off by one in telrcv()

In case of "\r" in the data buffer, the code was unconditionally looking ahead
to next character, even if "\r" was last character in the buffer. That
condition leads to read outside of the data (one byte after the array)
Thanks christos@ for the review
PR bin/58787 libtelnet - avoid using a global variable


From RVP -- make 'encrypt_debug_mode' be a static (file scope)
variable instead of extern, and convert the (had been recently
anyway) unused function encrypt_debug() into an accensor function
for it.

This is the minor (almost irrelevant) change from PR bin/58787
PR bin/58787 telnetd - handle auto authentication better
Apparently from FreeBSD via RVP -- but FreeBSD deleted telnetd
more than 2 years ago, so I assume instead from

https://github.com/cschuber/freebsd-telnet/tree/main/contrib/telnet
 1.32.2.1  18-Nov-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1013):

lib/libtelnet/encrypt.h: revision 1.10
libexec/telnetd/telnetd.c: revision 1.59
libexec/telnetd/sys_term.c: revision 1.50
lib/libtelnet/encrypt.c: revision 1.20
lib/libtelnet/enc_des.c: revision 1.18
lib/libtelnet/enc-proto.h: revision 1.11
libexec/telnetd/state.c: revision 1.33
libexec/telnetd/state.c: revision 1.35
libexec/telnetd/telnetd.c: revision 1.60

Fix memory leak - free resources allocated by getaddrinfo

Fix off by one in telrcv()

In case of "\r" in the data buffer, the code was unconditionally looking ahead
to next character, even if "\r" was last character in the buffer. That
condition leads to read outside of the data (one byte after the array)
Thanks christos@ for the review
PR bin/58787 libtelnet - avoid using a global variable


From RVP -- make 'encrypt_debug_mode' be a static (file scope)
variable instead of extern, and convert the (had been recently
anyway) unused function encrypt_debug() into an accensor function
for it.

This is the minor (almost irrelevant) change from PR bin/58787
PR bin/58787 telnetd - handle auto authentication better
Apparently from FreeBSD via RVP -- but FreeBSD deleted telnetd
more than 2 years ago, so I assume instead from

https://github.com/cschuber/freebsd-telnet/tree/main/contrib/telnet
 1.34.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed