Commit Graph

191 Commits

Author SHA1 Message Date
ed 22cdf6fd37 Let telnetd build without utmp and logwtmp(3).
Just like rlogind, there is no need to change the ownership of the
terminal during shutdown anymore. Also don't call logwtmp, because the
login(1)/PAM is responsible for doing this. Also use SHUT_RDWR instead
of 2.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@202212 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2010-01-13 18:37:42 +00:00
ed 29b3953035 Remove unneeded inclusion of <utmp.h> and dead variables.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@201047 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2009-12-27 11:56:32 +00:00
ed 67287bcb77 Use <termios.h> instead of <sys/termios.h>.
<sys/termios.h> only works on FreeBSD by accident.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@199874 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2009-11-28 11:57:25 +00:00
ed 7541522753 Rename all symbols in libmp(3) to mp_*, just like Solaris.
The function pow() in libmp(3) clashes with pow(3) in libm. We could
rename this single function, but we can just take the same approach as
the Solaris folks did, which is to prefix all function names with mp_.

libmp(3) isn't really popular nowadays. I suspect not a single
application in ports depends on it. There's still a chance, so I've
increased the SHLIB_MAJOR and __FreeBSD_version.

Reviewed by:	deischen, rdivacky


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@189092 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2009-02-26 21:43:15 +00:00
cperciva 1d2eb11519 Correctly scrub telnetd's environment.
Approved by:	so (cperciva)
Security:	FreeBSD-SA-09:05.telnetd


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@188699 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2009-02-16 21:56:17 +00:00
ed 8d9786e342 Use strlcpy() instead of strcpy().
Requested by:	mlaier


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@184938 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2008-11-13 20:40:38 +00:00
ed 7aa7324a8f Convert telnetd(8) to use posix_openpt(2).
Some time ago I got some reports MPSAFE TTY broke telnetd(8). Even
though it turned out to be a different problem within the TTY code, I
spotted a small issue with telnetd(8). Instead of allocating PTY's using
openpty(3) or posix_openpt(2), it used its own PTY allocation routine.
This means that telnetd(8) still uses /dev/ptyXX-style devices.

I've also increased the size of line[]. Even though 16 should be enough,
we already use 13 bytes ("/dev/pts/999", including '\0'). 32 bytes gives
us a little more freedom.

Also enable -DSTREAMSPTY. Otherwise telnetd(8) strips the PTY's pathname
to the latest slash instead of just removing "/dev/" (e.g. /dev/pts/0 ->
0, instead of pts/0).

Reviewed by:	rink


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@184935 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2008-11-13 19:05:27 +00:00
antoine 2846fec647 Fix TELOPT(opt) when opt > TELOPT_TN3270E.
PR:		127194
Submitted by:	Joost Bekkers
MFC after:	1 month


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@183004 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2008-09-13 17:46:50 +00:00
trhodes 180a45c5fb List authentication types supported with "-X" taken from the libtelnet
code.

PR:		121721


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@182419 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2008-08-29 00:04:37 +00:00
jhb d76e719277 Don't attempt authentication at all if it has been disabled via '-a off'.
This works around a bug in HP-UX's telnet client and also gives a much
saner user experience when using FreeBSD's telnet client.

PR:		bin/19405
Submitted by:	Joel Ray Holveck   joelh of gnu.org
MFC after:	1 month


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@180931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2008-07-28 18:58:16 +00:00
gnn dea97c6292 Commit IPv6 support for FAST_IPSEC to the tree.
This commit includes all remaining changes for the time being including
user space updates.

Submitted by:    bz
Approved by:    re


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@171135 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2007-07-01 12:08:08 +00:00
ru 461fc455ee Markup nits.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@162826 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2006-09-29 22:51:29 +00:00
ru 7fe816d452 Remove bogus casts of valid integer ioctl() arguments.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@162671 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2006-09-26 21:46:12 +00:00
maxim 2a1a3f355d o Mention .telnetrc DEFAULT keyword.
PR:		bin/100496 (sort of)
Obtained from:	NetBSD, heas@netbsd
MFC after:	3 weeks


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@162402 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2006-09-18 15:03:18 +00:00
ume b88638bb41 NI_WITHSCOPEID cleanup
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@146468 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-05-21 15:28:42 +00:00
nectar e1492a80cd Correct a pair of buffer overflows in the telnet(1) command:
(CAN-2005-0468) A heap buffer overflow in env_opt_add() and related
 functions.

 (CAN-2005-0469) A global uninitialized data section buffer overflow in
 slc_add_reply() and related functions.

As a result of these vulnerabilities, it may be possible for a malicious
telnet server or active network attacker to cause telnet(1) to execute
arbitrary code with the privileges of the user running it.

Security: CAN-2005-0468, CAN-2005-0469
Security: FreeBSD-SA-05:01.telnet
Security: http://www.idefense.com/application/poi/display?id=220&type=vulnerabilities
Security: http://www.idefense.com/application/poi/display?id=221&type=vulnerabilities

These fixes are based in part on patches
Submitted by:	Solar Designer <solar@openwall.com>


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@144231 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-03-28 14:45:12 +00:00
tobez 0f4e951657 Increase usefulness of telnet(1) as a protocol tester. By prepending
"+" to the port number, disable option negotiation and allow
transferring of data with high bit set.

OKed by:	markm (maintainer)
PR:		52032
Submitted by:	Valentin Nechayev <netch maybe-at netch stop kiev stop ua>
MFC After:	2 weeks


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@142790 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-02-28 12:46:53 +00:00
ru 26fb67c648 - Soften sentence breaks.
- Remove double whitespace.
- Sort sections.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@140601 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-01-21 21:57:05 +00:00
maxim 82ff960df9 o Make telnet[d] -S (IP TOS) flag really work. We do not have
/etc/iptos implementation so only numeric values supported.

o telnetd.8: steal the -S flag description from telnet.1, bump
the date of the document.

MFC after:	6 weeks


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@139937 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-01-09 10:24:46 +00:00
maxim 10faff8b17 o Add -4 and -6 flags to a man page and usage(). Bump the man page
date.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@139713 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-01-05 09:59:38 +00:00
maxim e5dfcfd096 o Remove -t flag from getopt(3), it was killed in rev. 1.15 three
years ago.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@139711 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-01-05 09:47:10 +00:00
maxim cff120dc74 o Print a correct status for unix domain sockets.
o Restore input mode when return from the command one.

PR:			bin/49983
Submitted by:		Volker Stolz
OK in general from:	markm
MFC after:		1 month


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@139687 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2005-01-04 21:22:32 +00:00
kan 5adbfa7aec Add missing () to function invocation.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@132753 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2004-07-28 05:37:18 +00:00
ume 97005ca0b5 Switch Advanced Sockets API for IPv6 from RFC2292 to RFC3542
(aka RFC2292bis).  Though I believe this commit doesn't break
backward compatibility againt existing binaries, it breaks
backward compatibility of API.
Now, the applications which use Advanced Sockets API such as
telnet, ping6, mld6query and traceroute6 use RFC3542 API.

Obtained from:	KAME


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@121472 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-10-24 18:26:30 +00:00
ume 425407c55a EAI_ADDRFAMILY and EAI_NODATA was deprecated in RFC3493
(aka RFC2553bis).  Now, getaddrinfo(3) returns EAI_NONAME
instead of EAI_NODATA.  Our getaddrinfo(3) nor getnameinfo(3)
didn't use EAI_ADDRFAMILY.

Obtained from:	KAME


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@121425 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-10-23 13:55:36 +00:00
harti 594b8db219 Forced commit to record the PR for the previous commit.
Remembered by: maxim

PR:		bin/45967


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@118866 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-08-13 11:02:37 +00:00
harti 6a39aef766 Implement what has been documented for a long time: make -debug switch
on socket debugging.

Okay'ed by: markm


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@118865 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-08-13 10:56:40 +00:00
markm 4369ac2a7f Fix up external variables named "debug" that have a horrible habit
of conflicting with other, similarly named functions in static
libraries. This is done mostly by renaming the var if it is shared
amongst modules, or making it static otherwise.

OK'ed by:	re(scottl)


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@114911 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-05-11 18:17:00 +00:00
obrien 90a2e082b9 Use __FBSDID vs. rcsid[]. Also protect sccs[] and copyright[] from GCC 3.3.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@114630 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-05-04 02:54:49 +00:00
nectar a948d8a850 Unbreak Kerberos 5 authentication in telnet.
(Credential forwarding is still broken.)

PR:	bin/45397


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@111946 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-03-06 13:41:53 +00:00
nectar a6a592c797 Background:
When libdes was replaced with OpenSSL's libcrypto, there were a few
 interfaces that the former implemented but the latter did not.  Because
 some software in the base system still depended upon these interfaces,
 we simply included them in our libcrypto (rnd_keys.c).

Now, finally get around to removing the dependencies on these
interfaces.  There were basically two cases:

  des_new_random_key -- This is just a wrapper for des_random_key, and
     these calls were replaced.

  des_init_random_number_generator et. al. -- A few functions were used
     by the application to seed libdes's PRNG.  These are not necessary
     when using libcrypto, as OpenSSL internally seeds the PRNG from
     /dev/random.  These calls were simply removed.

Again, some of the Kerberos 4 files have been taken off the vendor
branch.  I do not expect there to be future imports of KTH Kerberos 4.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@110049 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-01-29 18:14:29 +00:00
billf ea4f5f77e7 add more RFC defined telnet options
Reviewed by:	ps


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@109466 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2003-01-18 06:10:21 +00:00
eric 9e0282c9ca Merge argument parsing changes into this copy of telnet.
Submitted by:	markm
Approved by:	bmah


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@107299 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-11-27 06:34:24 +00:00
dd a2b2e46019 Permit the argument to the -s option to be a hostname. I see no
reason to restrict this to a numeric address.

PR:		41841
Submitted by:	Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>,
		Maxim Maximov <mcsi@agava.com>


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@104331 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-10-02 00:27:14 +00:00
markm 5a5138f8df Catch up with "base" telnet.
s/FALL THROUGH/FALLTHROUGH/ for lint(1).


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@103956 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-09-25 07:28:04 +00:00
markm 112a50cd56 Catch up with "base" telnet.
s/FALL THROUGH/FALLTHROUGH/ for lint(1).
s/Usage/usage/ for consistency.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@103955 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-09-25 07:26:25 +00:00
markm b4c79417a1 From the requestor:
"Could you do me a favor and fix sys_bsd.c to get the howmany() macro
from <sys/param.h>, instead of <sys/types.h>?  This will save me from
having to worry about the unsync'd bits before making the change."

Requested by:	mike


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@103954 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-09-25 07:24:01 +00:00
nsayer 60fe3b5542 Encrypted strings (after hex decoding) aren't null terminated, because
0 might simply be part of the ciphertext.

PR:		bin/40266
Submitted by:	andr@dgap.mipt.ru
MFC after:	3 days


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@102250 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-08-22 06:19:07 +00:00
markm e537a06c59 Warnings fixes. Sort out some variable types.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@98884 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-06-26 17:06:14 +00:00
markm 22ff929ecd Help fix warnings by marking an argument as unused.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@98882 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-06-26 17:05:08 +00:00
jmallett e151b0ff25 Don't risk catching a signal while handling a signal for a dying child, as we
can then end up not properly clearing wtmp/utmp entries.

PR:		bin/37934
Submitted by:	Sandeep Kumar <skumar@juniper.net>
Reviewed by:	markm
MFC after:	2 weeks


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@97341 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-05-27 08:10:24 +00:00
alfred 0a0dabb57b unbreak build:
commands.c, sys_bsd.c: comment out/remove junk after #endif/#else
network.c, terminal.c, utlities.c: include stdlib.h for exit(3)


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@96385 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-05-11 03:19:44 +00:00
markm 9ae08b0024 Previous commit was...
Submitted by:	des


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@96109 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-05-06 09:48:02 +00:00
markm 356920ba37 Fix an external declaration that was causing telnetd to core dump.
MFC after:	1 week
PR:		37766


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@96108 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-05-06 09:46:29 +00:00
nectar 8fe168e641 Update build after import of Heimdal Kerberos 2002/02/17.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@90931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-02-19 15:53:33 +00:00
sheldonh 48a0b67941 Don't use non-signal-safe functions (exit(3) in this case) in
signal handlers.  In this case, use _exit(2) instead, following
the call to shutdown(2).

This fixes rare telnetd hangs.

PR:		misc/33672
Submitted by:	Umesh Krishnaswamy <umesh@juniper.net>
MFC after:	1 month


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@90242 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2002-02-05 15:20:02 +00:00
ru 415314d0f6 mdoc(7) police: remove -r from SYNOPSIS, sort -p in DESCRIPTION.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@87882 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-12-14 14:41:07 +00:00
jkh 0dcd34090c Don't assume that the number of fds to select on is known quantity (in
this case 16).  Use dynamic FD_SETs and calculated high-water marks
throughout.  There are also too many versions of telnet in the tree.

Obtained from:  OpenBSD and Apple's Radar database
MFC after:      2 days


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@87558 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-12-09 09:53:27 +00:00
ru c166211dae Fixed bugs from previous revision.
Removed -s from SYNOPSIS and restored -S in DESCRIPTION.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@87358 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-12-04 16:02:36 +00:00
jhay 0b3113dc49 Protect variables and function prototypes that are only used in the INET6
case with an ifdef INET6.

This make the fixit floppy compile again.

Reviewed by:	markm


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@87277 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-12-03 17:42:02 +00:00