Commit Graph

183 Commits

Author SHA1 Message Date
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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@274364 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: 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
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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@257773 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@251188 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@241021 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
2012-09-28 07:51:30 +00:00
joel
2e1696417c Remove superfluous paragraph macro.
git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@237190 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@233932 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@228843 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@228651 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@228589 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@228559 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: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@207449 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: 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
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