Commit Graph

19 Commits

Author SHA1 Message Date
Stephen Heumann 8a3b1e25cd When forking the child process, wait until the child has exec'd before continuing in the parent.
Also includes a few other changes for safety, e.g. making the child exit via QuitGS rather than exit() or _exit().

The vfork_and_run() routine is based on code from my port of hush.
2016-01-09 12:46:38 -06:00
Stephen Heumann 494c69cf82 Eliminate large stack-allocated buffers, and set the stack size to 1.5k.
Also includes code to check the stack usage, which in my testing showed a maximum of 1025 bytes.
2016-01-08 23:45:11 -06:00
Stephen Heumann 1d35c61146 Misc. small changes to remove uses of unavailable functions in telnetd.
Also include libutil for login_tty function.
2015-06-01 20:43:53 -05:00
Stephen Heumann de9fad8d67 More small changes for GNO and ORCA/C compatibility.
In particular, address a couple instances where GNO's sockets implementation doesn't comply with modern standards.
Also, add a few missing prototypes so we can use ORCA/C prototype-checking lint functionality.
2015-05-31 19:52:28 -05:00
Stephen Heumann e8c6388223 Get rid of __FBSDID macros, which aren't defined in GNO (and thus prevent compilation). 2015-05-30 22:26:48 -05:00
Stephen Heumann 327170235b Changes to make telnet & telnetd compile on OS X, and begin adapting them to GNO:
*New makefile
*Refer to local versions of telnet-related headers, rather than system ones
*Use termcap instead of termios
*Change hostname lookup in telnetd back to older code (which assumes IPv4, but that's all GNO supports anyway)
2015-05-30 22:12:01 -05:00
dim bd32956cba In contrib/telnet/telnetd/utility.c, fix a few warnings about format
strings not being literals.

MFC after:	1 week


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@228589 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2011-12-16 16:53:54 +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
markm 820d180830 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.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@87139 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-11-30 21:06:38 +00:00
markm 0fd2377dcc 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.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@81965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-08-20 12:28:40 +00:00
kris 9de6e7ba10 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.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@80224 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-07-23 21:52:26 +00:00
ru 2c684cfa07 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.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@80038 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-07-20 12:02:30 +00:00
ru b3fb8c9630 Fixed the exploitable remote buffer overflow.
Reported on:	bugtraq
Obtained from:	Heimdal, NetBSD
Reviewed by:	obrien, imp


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@79981 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-07-19 17:48:57 +00:00
asmodai a352b628e8 String paranoia. Merged from regular telnet.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@69384 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2000-11-30 10:55:25 +00:00
peter 1e75920e30 $Id$ -> $FreeBSD$
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@50479 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1999-08-28 01:35:59 +00:00
peter a2726b72a6 Old stuff from a source tree: copy (verbatum) the code to expand the
%s/%m in the default /etc/gettytab.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@41856 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1998-12-16 06:01:33 +00:00
charnier 4f7c22a987 MFC: no \n in syslog strings. Change -P to -p in flags. EOF -> -1. Use err(3).
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@31622 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1997-12-08 07:41:13 +00:00
markm 6ba4d9bbdb Bring the FreeBSD changes to the virgin sources.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@29181 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1997-09-07 07:02:53 +00:00
markm 0e15f670a1 This commit was generated by cvs2svn to compensate for changes in r29088,
which included commits to RCS files with non-trunk default branches.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@29089 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1997-09-04 06:11:16 +00:00