Commit Graph

45 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 7f21186a25 Don't try to use pty packet mode on GNO, which doesn't support it. 2016-01-08 17:54:14 -06:00
Stephen Heumann cc929f87ce Don't generate log messages about "setsockopt (IP_TOS)" not working on GNO.
This isn't currently supported by MariGNOtti, so it always generates the message, but it's really not important.
2016-01-07 20:19:25 -06:00
Stephen Heumann a995ff4eb5 Environment handling on GNO
*Initialize environ on startup
*Separate child process environment from parent
2016-01-06 20:39:54 -06:00
Stephen Heumann 7968e76e4a telnetd: Change hardcoded 0s for stdin to STDIN_FILENO. 2015-06-02 21:59:22 -05: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 9bab5c3dec Add an implementation of getaddrinfo and getnameinfo, which are missing in GNO.
These are adapted from a version in netperf.
2015-05-31 16:56:05 -05:00
Stephen Heumann 581990e767 Misc. small changes for GNO and ORCA/C compatibility 2015-05-31 15:27:34 -05:00
Stephen Heumann cfa9287257 Back out recently-added code that uses mmap. 2015-05-31 10:12:25 -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
marcel 2d43ae29e1 Improve upon previous commit:
1.  Check return of mmap(2) (*)
2.  Avoid FD leak when fstat fails.
3.  Fix style(9).

(*) Pointed out by jmg@


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@262679 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2014-03-02 03:34:06 +00:00
marcel 2c30da6c4a Revive support for /etc/issue, lost due revision 81963.
Obtained from:	Juniper Networks, Inc.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@262673 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2014-03-02 00:47:47 +00:00
ed b3741997b0 Forgot a part that was missing in the previous commit.
There is no need to call trimdomain() anymore now that ut_host is big
enough to fit decent hostnames.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@202214 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2010-01-13 18:46:50 +00:00
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
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
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
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
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
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
markm a88d48b9df Damn. The previous mega-commit was incomplete WRT ANSIfication. This
fixes that.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@87155 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-11-30 22:28:07 +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 3efb267b2d Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@82497 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-08-29 14:16:17 +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 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 80f3e3bc78 Fix typo: wierd -> weird.
There is no such thing as wierd in the english language.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@72083 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2001-02-06 09:32:26 +00:00
asmodai e84c612e39 String paranoia fix. Synched from normal telnet.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@69387 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2000-11-30 13:10:01 +00:00
kris 312e8003c1 Correct definition of MAXHOSTNAMELEN in ifdef'ed code.
Submitted by:	Edwin Groothuis <mavetju@chello.nl>
PR:		bin/22787


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@69223 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2000-11-26 21:37:51 +00:00
shin 32ca7e751c 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


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@56668 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2000-01-27 09:28:38 +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
brian ec2cbe8315 MF libexec/telnetd: Determine the host name using an array size of
MAXHOSTNAMELEN and call trimdomain() before implementing
                    the -u option.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@45493 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1999-04-08 21:39:34 +00:00
brian e115c62597 MF libexec/telnetd: MAXHOSTNAMELEN & -u fixes.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@45428 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1999-04-07 10:17:24 +00:00
brian 8229e94407 Use realhostname().
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@45395 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1999-04-06 23:35:21 +00:00
brian a483d5b52d MF src/libexec/telnetd: Verify the reverse DNS lookup
ala rlogind.
Suggested by: markm


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@45377 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1999-04-06 12:41:27 +00:00
peter 8808a173ed Old stuff laying around: Don't use getstr which can conflict with some
curses/termcap/terminfo implementations and causes recursion.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@41858 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1998-12-16 06:06:06 +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
uhclem d16b9a5166 PR: bin/771 and bin/1037 are resolved by this change
This change changes the default handling of linemode so that older and/or
stupider telnet clients can still get wakeup characters like <ESC> and
<CTRL>D to work correctly multiple times on the same line, as in csh
"set filec" operations.   It also causes CR and LF characters to be read by
apps in certain terminal modes consistently, as opposed to returning
CR sometimes and LF sometimes, which broke existing apps.  The change
was shown to fix the problem demonstrated in the FreeBSD telnet client,
along with the telnet client in Solaris, SCO, Windows '95 & NT, DEC OSF,
NCSA, and others.

A similar change was incorporated in the non-crypto version of telnetd.

This resolves bin/771 and bin/1037.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@30212 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
1997-10-08 03:14:34 +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