Home | History | Annotate | Download | only in telnetd
History log of /src/libexec/telnetd/sys_term.c
RevisionDateAuthorComments
 1.51  27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.50  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.49  15-Aug-2019  kamil branches: 1.49.8; 1.49.10;
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>
 1.48  13-Dec-2018  maya branches: 1.48.2;
Remove unused macros.
 1.47  28-Jun-2013  christos branches: 1.47.26; 1.47.28;
fix wrong variable check, remove casts
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
 1.46  04-Nov-2012  christos Only include the headers we use and remove useless variable.
 1.45  09-Jan-2012  christos branches: 1.45.6;
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4
 1.44  17-Jan-2007  hubertf branches: 1.44.34;
Remove duplicated #includes and some trailing whitespace while here.
From Slava Semushin <slava.semushin@gmail.com>
 1.43  05-May-2005  lukem use _PATH_DEV instead of "/dev/"
 1.42  06-Feb-2005  perry de-__P, ANSIfy function declarations, remove obsolete "register" declarations.
 1.41  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.
 1.40  19-Sep-2003  itojun realloc pedannt
 1.39  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22284, verified by myself.
 1.38  14-Jul-2003  itojun more cleanups
 1.37  14-Jul-2003  itojun remove unused function
XXX what's the difference between #ifdef UTMPX and #ifdef SUPPORT_UTMPX
 1.36  14-Jul-2003  itojun remove unneeded #ifdefs. improves readability.
(confirmed that exact same *.o is produced)
 1.35  13-Jul-2003  itojun use bounded string op (there still are remains)
 1.34  22-Aug-2002  itojun use strlcpy. minor style fixes
 1.33  20-Aug-2002  christos add some more ifdefs, so that we don't define variables we don't use.
 1.32  20-Aug-2002  christos PR/17999: FUKAUMI Naoki: Support wtmpx entries.
 1.31  02-Sep-2001  wiz Fix #ifdef indentation after recent removal of #ifdef NEWINIT-code.
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  29-Aug-2001  wiz Cray-only patch (sync with cray). Patch by Brian Ginsbach in private mail.
 1.28  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.27  20-Aug-2001  wiz Rename variable to avoid shadowing.
 1.26  20-Aug-2001  wiz Improve whitespace a bit, per bin/13667 by Brian Ginsbach.
 1.25  20-Aug-2001  wiz Typo fixes and syslog string improvements, from bin/13667 by Brian Ginsbach.
 1.24  20-Aug-2001  wiz Fix type of last execl argument, inspired by bin/13667.
 1.23  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.22  04-Feb-2001  christos fix redundant declarations.
 1.21  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.20  09-Dec-2000  assar (scrub_env): change to only accept a listed set of variables,
including only non-filename contents for TERMCAP
 1.19  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.18  31-Dec-1999  tron branches: 1.18.4;
Abort if memory for execv(2) argument array cannot be allocated instead
of passing an array with incomplete contents to login(1).
Fix provided by Jun-ichiro itojun Hagino in PR bin/9082.
 1.17  17-Sep-1999  aidan Kerberos5 ticket forwarding works.
 1.16  12-Aug-1999  aidan Added kerberos5_cleanup() to cleanup if KRB5 defined. This is to destroy
a forwarded ccache on cleanup.
 1.15  12-Feb-1999  dean branches: 1.15.2;
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  29-Aug-1998  tsarna Execute ttyaction on termination of rlogind/telnetd sessions.
Also, say a little bit about ttyaction in the getty and login manpages.
 1.13  05-Aug-1998  perry Fix for pr 5904 from Zdenek Salvet; we now use openpty() to get a pty.
 1.12  01-Apr-1998  kleink No need to include <sys/tty.h>.
 1.11  08-Oct-1997  mrg WARNS?=1. RCS ids.
 1.10  25-Aug-1997  kleink Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
 1.9  20-Mar-1996  tls apply Thorsten's patch to add gettytab support to telnetd.
 1.8  28-Feb-1996  thorpej RCS id cosmetics.
 1.7  24-Feb-1996  jtk restore lost local change (be careful with 'long' vs. 'int'
distinctions)
 1.6  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.5  08-Feb-1996  mycroft Make sure that the user name cannot ever be interpreted as an option to
login(8). Note: This does *not* fix any security holes.
 1.4  23-Dec-1994  cgd be a bit more careful with types, casts, and and function declarations.
 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.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.15.2.1  08-Jan-2000  he Pull up revision 1.18 (requested by itojun):
Abort if memory for execv(2) argument array cannot be allocated
instead of passing an array with incomplete contents to login(1).
Fixes PR#9082.
 1.18.4.3  29-Jul-2001  jhawk Pull up revision 1.23 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.18.4.2  15-Dec-2000  he Pull down (revert) revision 1.19 (requested by tv):
1.19 would require a header file update, and is not really
required.
 1.18.4.1  14-Dec-2000  he Pull up revisions 1.19-1.20 (requested by assar):
Fix buffer overflow and environment passing problems, and only
accept a limites set of environment variables and non-filename
TERMCAP variables.
 1.44.34.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.34.2  16-Jan-2013  yamt sync with (a bit old) head
 1.44.34.1  17-Apr-2012  yamt sync with head
 1.45.6.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.6.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47.28.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.47.28.1  10-Jun-2019  christos Sync with HEAD
 1.47.26.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.48.2.2  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.48.2.1  16-Aug-2019  martin Pull up following revision(s) (requested by kamil in ticket #61):

libexec/telnetd/telnetd.c: revision 1.56
libexec/telnetd/sys_term.c: revision 1.49

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>
 1.49.10.1  02-Aug-2025  perseant Sync with HEAD
 1.49.8.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

RSS XML Feed