Commit Graph

158 Commits

Author SHA1 Message Date
nectar
c4f823a8ba Unbreak Kerberos 5 authentication in telnet.
(Credential forwarding is still broken.)

PR:	bin/45397
2003-03-06 13:41:53 +00:00
nectar
637cc179f5 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.
2003-01-29 18:14:29 +00:00
billf
75d164a3d8 add more RFC defined telnet options
Reviewed by:	ps
2003-01-18 06:10:21 +00:00
eric
7153bb5d55 Merge argument parsing changes into this copy of telnet.
Submitted by:	markm
Approved by:	bmah
2002-11-27 06:34:24 +00:00
dd
f5801700f4 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>
2002-10-02 00:27:14 +00:00
markm
7a2e60f0e3 Catch up with "base" telnet.
s/FALL THROUGH/FALLTHROUGH/ for lint(1).
2002-09-25 07:28:04 +00:00
markm
0ec9e3f996 Catch up with "base" telnet.
s/FALL THROUGH/FALLTHROUGH/ for lint(1).
s/Usage/usage/ for consistency.
2002-09-25 07:26:25 +00:00
markm
8466db9d92 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
2002-09-25 07:24:01 +00:00
nsayer
3781c72cd9 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
2002-08-22 06:19:07 +00:00
markm
741591a6b4 Warnings fixes. Sort out some variable types. 2002-06-26 17:06:14 +00:00
markm
d999cc9a29 Help fix warnings by marking an argument as unused. 2002-06-26 17:05:08 +00:00
jmallett
afc38d0730 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
2002-05-27 08:10:24 +00:00
alfred
ab796ae7fb 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)
2002-05-11 03:19:44 +00:00
markm
452e85175e Fix an external declaration that was causing telnetd to core dump.
MFC after:	1 week
PR:		37766
2002-05-06 09:46:29 +00:00
nectar
63b64d9c11 Update build after import of Heimdal Kerberos 2002/02/17. 2002-02-19 15:53:33 +00:00
sheldonh
81cc5956d9 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
2002-02-05 15:20:02 +00:00
ru
8c39ab0e40 mdoc(7) police: remove -r from SYNOPSIS, sort -p in DESCRIPTION. 2001-12-14 14:41:07 +00:00
jkh
fcc97a61ad 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
2001-12-09 09:53:27 +00:00
ru
dc891f7e3c Fixed bugs from previous revision.
Removed -s from SYNOPSIS and restored -S in DESCRIPTION.
2001-12-04 16:02:36 +00:00
jhay
06c2f4bca3 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
2001-12-03 17:42:02 +00:00
markm
c7155665d1 More help for alpha WARNS=2. This code is, erm, unusual. Anyone who
feels like rewriting it will meet no objection from me.
2001-12-03 12:16:40 +00:00
markm
7138baa87d help the alphas out with the WARNS=2 stuff. 2001-12-03 12:13:18 +00:00
markm
14227a41e2 Damn. The previous mega-commit was incomplete WRT ANSIfication. This
fixes that.
2001-11-30 22:28:07 +00:00
markm
19fd256fae Very large style makeover.
1) ANSIfy.
2) Clean up ifdefs so that
   a) ones that never/always apply are appropriately either
      fully removed, or just the #if junk is removed.
   b) change #if defined(FOO) for appropiate values of FOO.
      (currently AUTHENTICATION and ENCRYPTION)
3) WARNS=2 fixing
4) GC other unused stuff

This code can now be unifdef(1)ed to make non-crypto telnet.
2001-11-30 21:06:38 +00:00
jhb
1c9daba05c Fix world by trimming an extra comment terminator. 2001-10-29 19:22:38 +00:00
nsayer
267f5448c8 Add Berkeley copyright to SRA.
This is by the kind permission of Dave Safford, formerly of TAMU who wrote the
original code. Here is an excerpt of the e-mail exchange concerning this
issue:

Dave Safford wrote:
>Nick Sayer wrote:
>> Some time ago we spoke about SRA and importing it into FreeBSD. I forgot to
>> ask if you had a prefered license boilerplate for the top of the files. It
>> has come up recently, and the SRA code in FreeBSD doesn't have one.

>I really have no preference - use whatever is most convenient in the
>FreeBSD environment.

>dave safford

This is the standard BSD license with clause 3 removed and clause 4
suitably renumbered.

MFC after:	1 day
2001-10-29 16:12:16 +00:00
markm
4c52c72d92 Diff-reduce these two.
Really, one of them needs to disappear. I'll figure out which
later.

Reported by:	bde
2001-10-27 12:49:19 +00:00
markm
0163eae972 Add __FBSDID() to diff-reduce with "base" telnet. 2001-10-01 16:04:55 +00:00
markm
5987cca2b8 Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code. 2001-08-29 14:16:17 +00:00
dd
2c3a92a16f Remove description of an option that only applies to UNICOS < 7.0.
That define may still be present in the source, but I don't think
anyone has plans to try to use it.

Obtained from:	NetBSD
2001-08-25 21:29:12 +00:00
markm
62fa01a04b Code merge and diff reduce with "base" telnet. This is the "later"
telnet, so it was treated as the reference code, except where later
commits were made to "base" telnet.
2001-08-20 12:28:40 +00:00
horikawa
679dd2c9f8 Removal of following export controll related sentences:
o Because of export controls, TELNET ENCRYPT option is not supported outside
  of the United States and Canada.
o Because of export controls, data encryption
  is not supported outside of the United States and Canada.

src/crypto/README revision 1.5 commit log says:
> Crypto sources are no longer export controlled:
> Explain, why crypto sources are still in crypto/.
and actually telnet encryption is used outside of US and Canada now.

Pointed out by: OHSAWA Chitoshi <ohsawa@catv1.ccn-net.ne.jp>
Reviewed by: no objection on doc
2001-08-15 01:30:25 +00:00
ru
24c7b0a61d mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
kris
d051133293 output_data(), output_datalen() and netflush() didn't actually guarantee
to do what they are supposed to: under some circumstances output data would
be truncated, or the buffer would not actually be flushed (possibly leading
to overflows when the caller assumes the operation succeeded).  Change the
semantics so that these functions ensure they complete the operation before
returning.

Comment out diagnostic code enabled by '-D reports' which causes an
infinite recursion and an eventual crash.

Patch developed with assistance from ru and assar.
2001-07-23 21:52:26 +00:00
ru
4b023c5a9f More potential buffer overflow fixes.
o Fixed `nfrontp' calculations in output_data().  If `remaining' is
  initially zero, it was possible for `nfrontp' to be decremented.

Noticed by:	dillon

o Replaced leaking writenet() with output_datalen():

:  * writenet
:  *
:  * Just a handy little function to write a bit of raw data to the net.
:  * It will force a transmit of the buffer if necessary
:  *
:  * arguments
:  *    ptr - A pointer to a character string to write
:  *    len - How many bytes to write
:  */
: 	void
: writenet(ptr, len)
: 	register unsigned char *ptr;
: 	register int len;
: {
: 	/* flush buffer if no room for new data) */
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: 	if ((&netobuf[BUFSIZ] - nfrontp) < len) {
: 		/* if this fails, don't worry, buffer is a little big */
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: 		netflush();
: 	}
:
: 	memmove(nfrontp, ptr, len);
: 	nfrontp += len;
:
: }  /* end of writenet */

What an irony!  :-)

o Optimized output_datalen() a bit.
2001-07-20 12:02:30 +00:00
ru
5bfe15ad2f vsnprintf() can return a value larger than the buffer size.
Submitted by:	assar
Obtained from:	OpenBSD
2001-07-19 18:58:31 +00:00
ru
9cac33d71f Fixed the exploitable remote buffer overflow.
Reported on:	bugtraq
Obtained from:	Heimdal, NetBSD
Reviewed by:	obrien, imp
2001-07-19 17:48:57 +00:00
ru
d19961ab7f mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 10:42:19 +00:00
ru
9fe5b34c60 mdoc(7) police: merge all fixes from non-crypto version. 2001-07-05 14:08:12 +00:00
ru
30aad2eb2c MF non-crypto: 1.13: document -u in usage. 2001-07-05 14:06:27 +00:00
dillon
0c1af1bd68 Oops, forgot the 'u' in the getopt for the previous commit. 2001-05-24 00:14:19 +00:00
dillon
9ff666d52d A feature to allow one to telnet to a unix domain socket. (MFC from
non-crypto version)

Also update the crypto telnet's man page to reflect other options
ported from the non-crypto version.

Obtained from:   Lyndon Nerenberg <lyndon@orthanc.ab.ca>
2001-05-23 22:54:07 +00:00
nsayer
e25576d211 Make the PAM user-override actually override the correect thing. 2001-05-17 16:28:11 +00:00
peter
859d222e45 Back out last commit. This was already fixed. This should never have
happened, this is why we have commit mail expressly delivered to
committers.
2001-05-17 03:14:42 +00:00
peter
fdd845cf6b Fix the latest telnet breakage. Obviously this was never compiled. 2001-05-17 03:13:00 +00:00
nsayer
295844e3ff Since the root-on-insecure-tty code was added to telnetd, a dependency
on char *line was added to libtelnet. Put a dummy one in to keep the
linker happy.
2001-05-16 20:34:42 +00:00
nsayer
02a47b1303 Make sure the protocol actively rejects bad data rather than
(potentially) not responding to an invalid SRA 'auth is' message.
2001-05-16 20:24:58 +00:00
nsayer
280add2b35 srandomdev() affords us the opportunity to radically improve, and at the
same time simplify, the random number selection code.
2001-05-16 18:32:46 +00:00
nsayer
ca01fb27dc Catch any attempted buffer overflows. The magic numbers in this code
(512) are a little distressing, but the method really needs to be
extended to allow server-supplied DH parameters anyway.

Submitted by:	kris
2001-05-16 18:27:09 +00:00
nsayer
ce94eedfd7 Catch malloc return failures. This should help avoid dereferencing NULL on
low-memory situations.

Submitted by:	kris
2001-05-16 18:17:55 +00:00
peter
6125cb47e3 Hack to work around braindeath in libtelnet:sra.c. The sra.o file
references global variables from telnetd, but is also linked into
telnet as well. I was tempted to back out the last sra.c change
as it is 100% bogus and should be taken out and shot, but for now
this bandaid should get world working again. :-(
2001-05-15 09:52:03 +00:00
nsayer
2bdf180df8 If the uid of the attempted authentication is 0 and if the pty is
insecure, do not succeed. Copied from login.c. This functionality really
should be a PAM module.
2001-05-15 04:47:14 +00:00
nsayer
b47830be3e Pointy hat fix -- reapply the SRA PAM patch. To -current this time. 2001-05-07 20:42:02 +00:00
ru
8e59fdc98e mdoc(7) police: removed hard sentence breaks introduced in rev.1.10. 2001-04-13 08:49:52 +00:00
nsayer
311a1c9e61 Clean up telnet's argument processing a bit. autologin and encryption is
now the default, so ignore the arguments that turn it on. Add a new -y
argument to turn off encryption in case someone wants to do that. Sync
these changes with the man page (including removing the now obsolete
statement about availability only in the US and Canada).
2001-04-06 15:56:10 +00:00
nsayer
66051d03dc Reactivate SRA.
Make handling of SIGINT and SIGQUIT follow SIGTSTP in TerminalNewMode().
This allows people to break out of SRA authentication if they wish to.
2001-04-05 14:09:15 +00:00
nsayer
392858ffd3 Fix core noted in -stable with 'auth disable SRA'.
I just mistakenly commited this to RELENG_4. I have contacted Jordan to see
about how to fix this. Pass the pointy hat.
2001-03-18 09:44:25 +00:00
assar
c63261057a enable auto-negotiation of encrypt and decrypt 2001-03-12 03:54:48 +00:00
asmodai
bf7345c3e8 Synch: Add $FreeBSD$. 2001-02-07 21:58:16 +00:00
asmodai
7d76aced28 Fix typo: compatability -> compatibility.
Compatability is not an existing english word.
2001-02-06 12:05:58 +00:00
asmodai
47a2266000 Fix typo: seperate -> separate.
Seperate does not exist in the english language.

Submitted to look at by:	kris
2001-02-06 10:39:38 +00:00
asmodai
43450ced68 Fix typo: wierd -> weird.
There is no such thing as wierd in the english language.
2001-02-06 09:32:26 +00:00
ru
8c9e49b445 mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 17:12:45 +00:00
ru
a45dd3f68d Prepare for mdoc(7)NG. 2001-01-10 16:51:28 +00:00
assar
b022d1d27e (scrub_env): change to only accept a listed set of variables,
including only non-filename contents for TERMCAP
2000-12-10 20:50:20 +00:00
asmodai
56b0ddae6c Add more environment variables to be filtered through scrub_env().
Synched from normal telnet.
2000-11-30 13:14:54 +00:00
asmodai
5c47bfad32 String paranoia fix. Synched from normal telnet. 2000-11-30 13:10:01 +00:00
asmodai
617a96fd6d String paranoia. Merged from regular telnet. 2000-11-30 10:55:25 +00:00
kris
35eec2074d Correct definition of MAXHOSTNAMELEN in ifdef'ed code.
Submitted by:	Edwin Groothuis <mavetju@chello.nl>
PR:		bin/22787
2000-11-26 21:37:51 +00:00
ru
71e2293ad4 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
kris
1a1517afe4 Fix a buffer overflow from a long local hostname.
Obtained from:	OpenBSD
2000-11-19 10:08:26 +00:00
ru
a6f5d950d8 Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
kris
d2f83e4ec4 Sync with usr.bin/telnet/telnet.c r1.9 - fix buffer overflow in DISPLAY 2000-10-29 00:10:14 +00:00
ume
0abc0cfcd6 Fix buffer size of ALIGNed buffer.
PR:		bin/20053
Submitted by:	Alex Kapranoff <alex@kapran.bitmcnit.bryansk.su>
2000-07-20 14:54:04 +00:00
peter
e2062d0bd5 Add missing $FreeBSD$ to files that are NOT still on vendor a branch. 2000-07-16 05:48:49 +00:00
nsayer
f0ebc4fdd1 Fix 'telnet -X sra' coredump
PR# 19835
2000-07-11 15:04:05 +00:00
kris
a5aaf7609c Don't call printf with no format string. 2000-07-10 05:16:59 +00:00
ume
4eacfb7489 Make telnet -s work. It is corresponding to EAI_NONAME -> EAI_NODATA
change (getaddrinfo.c rev 1.12).
2000-07-08 05:22:00 +00:00
itojun
1fcab4244d sync with usr.bin/telnet/commands.c 1.21 -> 1.22. pierre.dampure@alveley.org 2000-07-07 12:35:05 +00:00
shin
b284df6e2f CMSG_XXX macros alignment fixes to follow RFC2292.
Approved by: jkh
2000-03-03 12:50:46 +00:00
markm
2cbf93e2b4 Get crypto from libcrypto, not libdes. 2000-02-24 19:28:31 +00:00
markm
fd6da7cf96 Freefall/Internat diff reducer. 2000-02-24 10:37:29 +00:00
shin
981d4a6e4b Use static buffer to save source route hostnames.
Approved by: jkh
2000-02-19 16:33:14 +00:00
shin
e1b335a34c Print "Trying ..." for each host. Also cleanups for error printing.
Approved by: jkh

Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>
2000-02-19 16:17:41 +00:00
shin
77f276d5ac Fix bugs in telnet.
Sorry there were still several bugs.
   -error retry at af missmatch was incomplete.
   -af matching for source addr option was wrong
   -socket was not freed at retry.

Approved by: jkh
2000-02-15 15:59:12 +00:00
shin
bca215974d Add more dual stack consideration.
-Should retry as much as possible when some of source
     routing intermediate hosts' address families missmatch
     happened.
     (such as when a host has only A record, and another host
     has each of A and AAAA record.)

    -Should retry as much as possible when dest addr and
     source addr(specified with -s option) address family
     missmatch happend

Approved by: jkh
2000-02-10 20:06:36 +00:00
shin
67ff6efc68 Fix telnet core dump at invalid service name specified.
Added an error check to avoid it.

Approved by: jkh

Submitted by: Robert Muir <rmuir@gibralter.net>
2000-02-07 00:52:49 +00:00
shin
3859c2231c Add NI_NAMEREQD flag to getnameinfo() call. Without this flag,
getnameinfo() don't return error at name resolving failure.
But it is used at doaddrlookup(-N) case in telnet, error need to be
returned to correctly initialize hostname buffer.

Discovered at checking recent KAME repository change, noticed by itojun.
2000-01-29 18:21:05 +00:00
shin
ce15efb7c0 another tcp apps IPv6 updates.(should be make world safe)
ftp, telnet, ftpd, faithd
  also telnet related sync with crypto, secure, kerberosIV

Obtained from: KAME project
2000-01-27 09:28:38 +00:00
markm
05435ef431 Termcap header no longer needed. 1999-09-01 18:57:38 +00:00
peter
efabb9ccb1 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
nsayer
6cf65828c9 According to Mark Murray, Makefiles do not belong here. I guess we're
going to have to figure something else out.
1999-08-16 18:59:05 +00:00
nsayer
189690bcce Add SRA authentication to src/crypto/telnet.
SRA does a Diffie-Hellmen exchange and then DES-encrypts the
authentication data. If the authentication is successful, it also
sets up a session key for DES encryption.

SRA was originally developed at Texas A&M University.

This code is probably export restricted (despite the fact that I
originally found it at a University in Germany).

SRA is not perfect. It is vulnerable to monkey-in-the-middle attacks
and does not use tremendously large DH constants (and thus an individual
exchange probably could be factored in a few days on modern CPU
horsepower). It does not, however, require any changes in user or
administrative behavior and foils session hijacking and sniffing.
The goal of this commit is that telnet and telnetd end up in the DES
distribution and that therefore an encrypted session telnet becomes
standard issue for FreeBSD.
1999-08-16 11:24:29 +00:00
nsayer
8528b2a710 Fix int function without return (make consistent with neighbors) 1999-08-16 02:15:29 +00:00
nik
668aec5d3d Document the "skey" command in telnet(1).
PR:             docs/12360
Submitted by:   kjm@rins.ryukoku.ac.jp (KOJIMA Hajime)
Nagged by:      markm :-)
1999-07-30 21:24:03 +00:00
ru
c7b22dab8b Merge from non-crypto version:
- "-N" option
- "-E" security fix
- "-s src_addr" option

Requested by:	markm
1999-06-17 09:24:37 +00:00
brian
7670f1eab4 MF libexec/telnetd: Determine the host name using an array size of
MAXHOSTNAMELEN and call trimdomain() before implementing
                    the -u option.
1999-04-08 21:39:34 +00:00
brian
88f6c1a7e8 MF libexec/telnetd: MAXHOSTNAMELEN & -u fixes. 1999-04-07 10:17:24 +00:00
brian
07625d3f4d Use realhostname(). 1999-04-06 23:35:21 +00:00
brian
290eeb0e06 MF src/libexec/telnetd: Verify the reverse DNS lookup
ala rlogind.
Suggested by: markm
1999-04-06 12:41:27 +00:00