Commit Graph

191 Commits

Author SHA1 Message Date
Stephen Heumann 297d1063f1 Set theme jekyll-theme-dinky 2017-04-20 00:03:54 -05:00
Stephen Heumann 578c8203d8 Add README. 2016-01-09 23:18:23 -06:00
Stephen Heumann 1706441553 Add sample configuration files. 2016-01-09 22:15:42 -06:00
Stephen Heumann f659286e00 Rewrite environment-cleaning code to not directly modify environ or its contents.
The old code didn't work correctly with GNO's environ implementation and could lead to crashes.
2016-01-09 18:04:58 -06:00
Stephen Heumann e6c2831323 Work around a GNO kernel bug that could cause crashes in error cases.
The issue is that the kernel's pty structures get corrupted if the master side of a pty is opened and then closed without the slave side having been opened. This can happen with telnetd in various error cases. The workaround is to arrange for the slave side to be opened just before telnetd exits in those cases.
2016-01-09 14:50:21 -06:00
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 3eba861bdb Remove root files in "make clean" 2016-01-07 20:43:59 -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 e761e0fc48 Use correct path for login on GNO. 2016-01-07 20:07:53 -06:00
Stephen Heumann 2de9b6ebc3 Turn on a few optimizations.
At least -O8 is necessary for compiling varargs functions.
2016-01-07 18:54:14 -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 03a535e170 Change hardcoded fds to STDIN_FILENO and STDERR_FILENO. 2015-06-10 23:23:50 -05:00
Stephen Heumann 98b485d83b vasprintf: Pass a 1-character buffer to initial vsnprintf call.
GNO vsnprintf will give an error if size is 0, leading vasprintf to fail. This prevented sending data in telnetd.
2015-06-03 20:38:31 -05:00
Stephen Heumann 7968e76e4a telnetd: Change hardcoded 0s for stdin to STDIN_FILENO. 2015-06-02 21:59:22 -05:00
Stephen Heumann 2b354e2b66 Replace getent and Getstr code on GNO with code taken from GNO's getty.
This addresses the use of unimplemented functions in that code. At this point, telnetd links successfully.
2015-06-01 21:55:09 -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 1c8d72b2d1 telnet: Define signal handlers on GNO with the proper signature (taking two arguments). 2015-06-01 17:55:24 -05:00
Stephen Heumann a1e8056a8b Remove (most) instances of casting between incompatible function pointer types in telnet/commands.c.
This was generally resolved by adding extra unused parameters to functions, to standardize their signature to what their pointer was being cast to.

This should avoid issues of possible stack corruption due to the ORCA/C calling convention.
2015-06-01 17:33:25 -05:00
Stephen Heumann 972e6d98ba Fix a couple link errors in telnetd related to ORCA/C's handling of externs. 2015-06-01 16:42:47 -05:00
Stephen Heumann af6c2cbe7a Add an implementation for GNO of posix_openpt and related functions for handling ptys. 2015-06-01 16:25:56 -05:00
Stephen Heumann aeddbd055f Divide telnet sources into two segments.
At this point, telnet will build and run, although it doesn't work properly.
2015-05-31 23:44:46 -05:00
Stephen Heumann 46f340c657 Update makefile to build and link in libtelnet files used exclusively by either telnet or telnetd only for the appropriate binary. 2015-05-31 23:20:21 -05:00
Stephen Heumann 391736d065 Remove source files needed only for authentication or encryption, which we've disabled. 2015-05-31 22:55:19 -05:00
Stephen Heumann e39285b030 Add missing inet_ntop function 2015-05-31 21:39:51 -05:00
Stephen Heumann ff78ce7134 Add missing vasprintf function 2015-05-31 21:11:05 -05:00
Stephen Heumann 4f442220c5 Add strlcpy, which GNO's libc doesn't have. 2015-05-31 20:23:06 -05:00
Stephen Heumann 923ec4e425 Transform (v)fork calls to use GNO's fork2 call. 2015-05-31 19:54:10 -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 cd51610a6f Add a GNO-specific makefile, and move stuff that's common between GNO and OS X makefiles to a file included by both of them. 2015-05-31 16:21:53 -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
ngie 052bf438de Add baud rate support to telnet(1)
This implements part of RFC-2217

It's based off a patch originally written by Sujal Patel at Isilon, and
contributions from other Isilon employees.

PR: 173728
Phabric: D995
Reviewed by: markj, markm
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2014-11-11 04:06:05 +00: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: 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: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2014-03-02 00:47:47 +00:00
sjg 839f5deaca Propagate ancient fix from Junos.
Use of -h is not supposed to depend on AUTHENTICATION being defined.

Reviewed by: markm

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2013-11-07 00:36:39 +00:00
marcel d37ea43702 Fix "automatic" login, broken by revision 69825 (12 years, 5 months ago).
The "automatic" login feature is described as follows:
The USER environment variable holds the name of the person telnetting in.
This is the username of the person on the client machine. The traditional
behaviour is to execute login(1) with this username first, meaning that
login(1) will prompt for the password only. If login fails, login(1) will
retry, but now prompt for the username before prompting for the password.

This feature got broken by how the environment got scrubbed. Before the
change in r69825 we removed variables that we deemed dangerous. Starting
with r69825 we only keep those variable we know to be safe.

The USER environment variable fell through the cracks. It suddenly got
scrubbed (i.e. removed from the environment) while still being checked
for. It also got explicitly removed from the environment to handle the
failed login case.

The fix is to obtain the value of the USER environment variable before
we scrub the environment and used the "cached" in subsequent checks.
This guarantees that the environment does not contain the USER variable
in the end, while still being able to implement "automatic" login.

Obtained from:	Juniper Networks, Inc.

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2013-05-31 17:30:12 +00:00
kevlo 6b099757e8 Make sure that each va_start has one and only one matching va_end,
especially in error cases.

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2012-09-28 07:51:30 +00:00
joel 2e1696417c Remove superfluous paragraph macro.
git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2012-06-17 11:04:38 +00:00
stas d97058c8ec - Do not use deprecated krb5 error message reporting functions in libtelnet.
git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2012-04-06 00:03:45 +00:00
cperciva a02488779d Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]
Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]

Fix a buffer overflow in telnetd. [11:08]

Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]

Add sanity checking of service names in pam_start. [11:10]

Approved by:    so (cperciva)
Approved by:    re (bz)
Security:       FreeBSD-SA-11:06.bind
Security:       FreeBSD-SA-11:07.chroot
Security:       FreeBSD-SA-11:08.telnetd
Security:       FreeBSD-SA-11:09.pam_ssh
Security:       FreeBSD-SA-11:10.pam

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2011-12-23 15:00:37 +00:00
dim 24a5c1e093 In contrib/telnet/telnet/utilities.c, fix a few warnings about format
strings not being literals.

MFC after:	1 week

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2011-12-17 18:18:36 +00: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: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2011-12-16 16:53:54 +00:00
dim d107e99829 In contrib/telnet/libtelnet/sra.c, use the correct number of bytes to
zero the password buffer.

MFC after:	1 week

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2011-12-16 00:48:53 +00:00
jilles 0fddcbcf1c telnet: Fix infinite loop if local output generates SIGPIPE.
Instead of catching SIGPIPE and jumping out of the signal handler with
longjmp, ignore it and handle write errors to the local output by exiting
from there. I have changed the error message to mention the local output
instead of NetBSD's wrong "Connection closed by foreign host". Write errors
to the network were already handled by exiting immediately and this now
applies to EPIPE too.

The code assumed that SIGPIPE could only be generated by the network
connection; if it was generated by the local output, it would longjmp out of
the signal handler and write an error message which caused another SIGPIPE.

PR:		19773
Obtained from:	NetBSD
MFC after:	1 week

git-svn-id: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2010-04-30 19:52:35 +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: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2010-01-13 18:46:50 +00:00