summaryrefslogtreecommitdiffstats
path: root/contrib/telnet/telnetd
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>1997-09-07 07:02:53 +0000
committermarkm <markm@FreeBSD.org>1997-09-07 07:02:53 +0000
commitcd2a6be22c3f5c010eb7ec63c77cd0699a832567 (patch)
tree316b7a514809054240510520a7e779098c17795e /contrib/telnet/telnetd
parent2075d422d2e14fa0f55c71e4790fd46d0979a7a1 (diff)
downloadFreeBSD-src-cd2a6be22c3f5c010eb7ec63c77cd0699a832567.zip
FreeBSD-src-cd2a6be22c3f5c010eb7ec63c77cd0699a832567.tar.gz
Bring the FreeBSD changes to the virgin sources.
Diffstat (limited to 'contrib/telnet/telnetd')
-rw-r--r--contrib/telnet/telnetd/authenc.c2
-rw-r--r--contrib/telnet/telnetd/ext.h6
-rw-r--r--contrib/telnet/telnetd/global.c2
-rw-r--r--contrib/telnet/telnetd/slc.c40
-rw-r--r--contrib/telnet/telnetd/state.c5
-rw-r--r--contrib/telnet/telnetd/sys_term.c64
-rw-r--r--contrib/telnet/telnetd/telnetd.810
-rw-r--r--contrib/telnet/telnetd/telnetd.c75
-rw-r--r--contrib/telnet/telnetd/termstat.c53
-rw-r--r--contrib/telnet/telnetd/utility.c25
10 files changed, 174 insertions, 108 deletions
diff --git a/contrib/telnet/telnetd/authenc.c b/contrib/telnet/telnetd/authenc.c
index ccb463c..bff80a2 100644
--- a/contrib/telnet/telnetd/authenc.c
+++ b/contrib/telnet/telnetd/authenc.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
diff --git a/contrib/telnet/telnetd/ext.h b/contrib/telnet/telnetd/ext.h
index 19bc0d6..f60139e 100644
--- a/contrib/telnet/telnetd/ext.h
+++ b/contrib/telnet/telnetd/ext.h
@@ -45,9 +45,7 @@ extern int uselinemode; /* what linemode to use (on/off) */
extern int editmode; /* edit modes in use */
extern int useeditmode; /* edit modes to use */
extern int alwayslinemode; /* command line option */
-# ifdef KLUDGELINEMODE
extern int lmodetype; /* Client support for linemode */
-# endif /* KLUDGELINEMODE */
#endif /* LINEMODE */
extern int flowmode; /* current flow control state */
extern int restartany; /* restart output on any character state */
@@ -233,7 +231,11 @@ extern int needtermstat;
# ifdef ultrix
# define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
# else
+# ifdef __FreeBSD__
+# define DEFAULT_IM "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
+# else
# define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
+# endif
# endif
# endif
# endif
diff --git a/contrib/telnet/telnetd/global.c b/contrib/telnet/telnetd/global.c
index af21acc..0699d00 100644
--- a/contrib/telnet/telnetd/global.c
+++ b/contrib/telnet/telnetd/global.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
+static const char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */
/*
diff --git a/contrib/telnet/telnetd/slc.c b/contrib/telnet/telnetd/slc.c
index 6cbb7ab..9579d0d 100644
--- a/contrib/telnet/telnetd/slc.c
+++ b/contrib/telnet/telnetd/slc.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)slc.c 8.2 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)slc.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -288,15 +288,15 @@ change_slc(func, flag, val)
register int hislevel, mylevel;
hislevel = flag & SLC_LEVELBITS;
- mylevel = slctab[func].defset.flag & SLC_LEVELBITS;
+ mylevel = slctab[(int)func].defset.flag & SLC_LEVELBITS;
/*
* If client is setting a function to NOSUPPORT
* or DEFAULT, then we can easily and directly
* accomodate the request.
*/
if (hislevel == SLC_NOSUPPORT) {
- slctab[func].current.flag = flag;
- slctab[func].current.val = (cc_t)_POSIX_VDISABLE;
+ slctab[(int)func].current.flag = flag;
+ slctab[(int)func].current.val = (cc_t)_POSIX_VDISABLE;
flag |= SLC_ACK;
add_slc(func, flag, val);
return;
@@ -309,13 +309,13 @@ change_slc(func, flag, val)
* default level of DEFAULT.
*/
if (mylevel == SLC_DEFAULT) {
- slctab[func].current.flag = SLC_NOSUPPORT;
+ slctab[(int)func].current.flag = SLC_NOSUPPORT;
} else {
- slctab[func].current.flag = slctab[func].defset.flag;
+ slctab[(int)func].current.flag = slctab[(int)func].defset.flag;
}
- slctab[func].current.val = slctab[func].defset.val;
- add_slc(func, slctab[func].current.flag,
- slctab[func].current.val);
+ slctab[(int)func].current.val = slctab[(int)func].defset.val;
+ add_slc(func, slctab[(int)func].current.flag,
+ slctab[(int)func].current.val);
return;
}
@@ -329,13 +329,13 @@ change_slc(func, flag, val)
* the place to put the new value, so change it,
* otherwise, continue the negotiation.
*/
- if (slctab[func].sptr) {
+ if (slctab[(int)func].sptr) {
/*
* We can change this one.
*/
- slctab[func].current.val = val;
- *(slctab[func].sptr) = val;
- slctab[func].current.flag = flag;
+ slctab[(int)func].current.val = val;
+ *(slctab[(int)func].sptr) = val;
+ slctab[(int)func].current.flag = flag;
flag |= SLC_ACK;
slcchange = 1;
add_slc(func, flag, val);
@@ -355,22 +355,22 @@ change_slc(func, flag, val)
* our value as well.
*/
if (mylevel == SLC_DEFAULT) {
- slctab[func].current.flag = flag;
- slctab[func].current.val = val;
+ slctab[(int)func].current.flag = flag;
+ slctab[(int)func].current.val = val;
flag |= SLC_ACK;
} else if (hislevel == SLC_CANTCHANGE &&
mylevel == SLC_CANTCHANGE) {
flag &= ~SLC_LEVELBITS;
flag |= SLC_NOSUPPORT;
- slctab[func].current.flag = flag;
+ slctab[(int)func].current.flag = flag;
} else {
flag &= ~SLC_LEVELBITS;
flag |= mylevel;
- slctab[func].current.flag = flag;
+ slctab[(int)func].current.flag = flag;
if (mylevel == SLC_CANTCHANGE) {
- slctab[func].current.val =
- slctab[func].defset.val;
- val = slctab[func].current.val;
+ slctab[(int)func].current.val =
+ slctab[(int)func].defset.val;
+ val = slctab[(int)func].current.val;
}
}
add_slc(func, flag, val);
diff --git a/contrib/telnet/telnetd/state.c b/contrib/telnet/telnetd/state.c
index 4ee8bea..faf4088 100644
--- a/contrib/telnet/telnetd/state.c
+++ b/contrib/telnet/telnetd/state.c
@@ -32,13 +32,16 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
#if defined(AUTHENTICATION)
#include <libtelnet/auth.h>
#endif
+#if defined(ENCRYPTION)
+#include <libtelnet/encrypt.h>
+#endif
unsigned char doopt[] = { IAC, DO, '%', 'c', 0 };
unsigned char dont[] = { IAC, DONT, '%', 'c', 0 };
diff --git a/contrib/telnet/telnetd/sys_term.c b/contrib/telnet/telnetd/sys_term.c
index 67a2f94..fe9509e 100644
--- a/contrib/telnet/telnetd/sys_term.c
+++ b/contrib/telnet/telnetd/sys_term.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -42,13 +42,17 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#include <libtelnet/auth.h>
#endif
+extern char *altlogin;
+int cleanopen(char *line);
+void scrub_env(void);
+
#if defined(CRAY) || defined(__hpux)
# define PARENT_DOES_UTMP
#endif
+int utmp_len = MAXHOSTNAMELEN;
#ifdef NEWINIT
#include <initreq.h>
-int utmp_len = MAXHOSTNAMELEN; /* sizeof(init_request.host) */
#else /* NEWINIT*/
# ifdef UTMPX
# include <utmpx.h>
@@ -58,14 +62,23 @@ struct utmpx wtmp;
struct utmp wtmp;
# endif /* UTMPX */
-int utmp_len = sizeof(wtmp.ut_host);
# ifndef PARENT_DOES_UTMP
+#ifdef _PATH_WTMP
+char wtmpf[] = _PATH_WTMP;
+#else
char wtmpf[] = "/usr/adm/wtmp";
+#endif
+#ifdef _PATH_UTMP
+char utmpf[] = _PATH_UTMP;
+#else
char utmpf[] = "/etc/utmp";
+#endif
# else /* PARENT_DOES_UTMP */
char wtmpf[] = "/etc/wtmp";
# endif /* PARENT_DOES_UTMP */
+#include <libutil.h>
+
# ifdef CRAY
#include <tmpdir.h>
#include <sys/wait.h>
@@ -504,7 +517,7 @@ int *ptynum;
p2 = &line[14];
#endif
- for (cp = "pqrstuvwxyzPQRST"; *cp; cp++) {
+ for (cp = "pqrsPQRS"; *cp; cp++) {
struct stat stb;
*p1 = *cp;
@@ -516,8 +529,8 @@ int *ptynum;
*/
if (stat(line, &stb) < 0)
break;
- for (i = 0; i < 16; i++) {
- *p2 = "0123456789abcdef"[i];
+ for (i = 0; i < 32; i++) {
+ *p2 = "0123456789abcdefghijklmnopqrstuv"[i];
p = open(line, 2);
if (p > 0) {
#ifndef __hpux
@@ -1065,10 +1078,11 @@ extern void utmp_sig_notify P((int));
* that is necessary. The return value is a file descriptor
* for the slave side.
*/
- int
+ void
getptyslave()
{
register int t = -1;
+ char erase;
#if !defined(CRAY) || !defined(NEWINIT)
# ifdef LINEMODE
@@ -1085,12 +1099,13 @@ getptyslave()
* if linemode was turned on
* terminal window size
* terminal speed
+ * erase character
* so that we can re-set them if we need to.
*/
# ifdef LINEMODE
waslm = tty_linemode();
# endif
-
+ erase = termbuf.c_cc[VERASE];
/*
* Make sure that we don't have a controlling tty, and
@@ -1176,6 +1191,8 @@ getptyslave()
# endif /* defined(USE_TERMIO) && !defined(CRAY) && (BSD <= 43) */
tty_rspeed((def_rspeed > 0) ? def_rspeed : 9600);
tty_tspeed((def_tspeed > 0) ? def_tspeed : 9600);
+ if (erase)
+ termbuf.c_cc[VERASE] = erase;
# ifdef LINEMODE
if (waslm)
tty_setlinemode(1);
@@ -1384,7 +1401,6 @@ startslave(host, autologin, autoname)
{
register int i;
long time();
- char name[256];
#ifdef NEWINIT
extern char *ptyip;
struct init_request request;
@@ -1517,7 +1533,7 @@ init_env()
char **envp;
envp = envinit;
- if (*envp = getenv("TZ"))
+ if ((*envp = getenv("TZ")))
*envp++ -= 3;
#if defined(CRAY) || defined(__hpux)
else
@@ -1542,9 +1558,8 @@ start_login(host, autologin, name)
int autologin;
char *name;
{
- register char *cp;
register char **argv;
- char **addarg();
+ char **addarg(), *user;
extern char *getenv();
#ifdef UTMPX
register int pid = getpid();
@@ -1652,6 +1667,7 @@ start_login(host, autologin, name)
if (auth_level >= 0 && autologin == AUTH_VALID) {
# if !defined(NO_LOGIN_F)
argv = addarg(argv, "-f");
+ argv = addarg(argv, "--");
argv = addarg(argv, name);
# else
# if defined(LOGIN_R)
@@ -1724,12 +1740,14 @@ start_login(host, autologin, name)
pty = xpty;
}
# else
+ argv = addarg(argv, "--");
argv = addarg(argv, name);
# endif
# endif
} else
#endif
if (getenv("USER")) {
+ argv = addarg(argv, "--");
argv = addarg(argv, getenv("USER"));
#if defined(LOGIN_ARGS) && defined(NO_LOGIN_P)
{
@@ -1765,16 +1783,14 @@ start_login(host, autologin, name)
close(pty);
#endif
closelog();
- /*
- * This sleep(1) is in here so that telnetd can
- * finish up with the tty. There's a race condition
- * the login banner message gets lost...
- */
- sleep(1);
- execv(_PATH_LOGIN, argv);
- syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN);
- fatalperror(net, _PATH_LOGIN);
+ if (altlogin == NULL) {
+ altlogin = _PATH_LOGIN;
+ }
+ execv(altlogin, argv);
+
+ syslog(LOG_ERR, "%s: %m\n", altlogin);
+ fatalperror(net, altlogin);
/*NOTREACHED*/
}
@@ -1818,14 +1834,20 @@ addarg(argv, val)
* Remove a few things from the environment that
* don't need to be there.
*/
+ void
scrub_env()
{
register char **cpp, **cpp2;
for (cpp2 = cpp = environ; *cpp; cpp++) {
+#ifdef __FreeBSD__
+ if (strncmp(*cpp, "LD_LIBRARY_PATH=", 16) &&
+ strncmp(*cpp, "LD_PRELOAD=", 11) &&
+#else
if (strncmp(*cpp, "LD_", 3) &&
strncmp(*cpp, "_RLD_", 5) &&
strncmp(*cpp, "LIBPATH=", 8) &&
+#endif
strncmp(*cpp, "IFS=", 4))
*cpp2++ = *cpp;
}
diff --git a/contrib/telnet/telnetd/telnetd.8 b/contrib/telnet/telnetd/telnetd.8
index f618385..e77443e 100644
--- a/contrib/telnet/telnetd/telnetd.8
+++ b/contrib/telnet/telnetd/telnetd.8
@@ -48,6 +48,7 @@ protocol server
.Op Fl X Ar authtype
.Op Fl a Ar authmode
.Op Fl edebug
+.Op Fl P Ar loginprog
.Op Fl r Ns Ar lowpty-highpty
.Op Fl u Ar len
.Op Fl debug Op Ar port
@@ -187,6 +188,11 @@ If
has been compiled with support for data encryption, then the
.Fl edebug
option may be used to enable encryption debugging code.
+.It Fl P Ar loginprog
+Specifies an alternate
+.Xr login 1
+command to run to complete the login. The alternate command must
+understand the same command arguments as the standard login.
.It Fl h
Disables the printing of host-specific information before
login has been completed.
@@ -532,9 +538,9 @@ the data stream.
.Pa /usr/ucb/bftp
(if supported)
.Sh "SEE ALSO"
-.Xr telnet 1 ,
+.Xr bftp 1 ,
.Xr login 1 ,
-.Xr bftp 1
+.Xr telnet 1
(if supported)
.Sh STANDARDS
.Bl -tag -compact -width RFC-1572
diff --git a/contrib/telnet/telnetd/telnetd.c b/contrib/telnet/telnetd/telnetd.c
index 70c0fc0..6e09ab4 100644
--- a/contrib/telnet/telnetd/telnetd.c
+++ b/contrib/telnet/telnetd/telnetd.c
@@ -32,13 +32,13 @@
*/
#ifndef lint
-static char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
@@ -75,6 +75,10 @@ struct socket_security ss;
#include <libtelnet/auth.h>
int auth_level = 0;
#endif
+#if defined(ENCRYPTION)
+#include <libtelnet/encrypt.h>
+#endif
+#include <libtelnet/misc.h>
#if defined(SecurID)
int require_SecurID = 0;
#endif
@@ -101,8 +105,6 @@ char ptyibuf2[BUFSIZ];
unsigned char ctlbuf[BUFSIZ];
struct strbuf strbufc, strbufd;
-int readstream();
-
#else /* ! STREAMPTY */
/*
@@ -112,6 +114,13 @@ int readstream();
char ptyibuf[BUFSIZ], *ptyip = ptyibuf;
char ptyibuf2[BUFSIZ];
+# include <termcap.h>
+
+int readstream(int p, char *ibuf, int bufsize);
+void doit(struct sockaddr_in *who);
+int terminaltypeok(char *s);
+void startslave(char *host, int autologin, char *autoname);
+
#endif /* ! STREAMPTY */
int hostinfo = 1; /* do we print login banner? */
@@ -124,6 +133,7 @@ int lowpty = 0, highpty; /* low, high pty numbers */
int debug = 0;
int keepalive = 1;
char *progname;
+char *altlogin;
extern void usage P((void));
@@ -133,7 +143,7 @@ extern void usage P((void));
* passed off to getopt().
*/
char valid_opts[] = {
- 'd', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U',
+ 'd', ':', 'h', 'k', 'n', 'p', ':', 'S', ':', 'u', ':', 'U',
#ifdef AUTHENTICATION
'a', ':', 'X', ':',
#endif
@@ -301,6 +311,10 @@ main(argc, argv)
keepalive = 0;
break;
+ case 'p':
+ altlogin = optarg;
+ break;
+
#ifdef CRAY
case 'r':
{
@@ -385,7 +399,7 @@ main(argc, argv)
usage();
/* NOT REACHED */
} else if (argc == 1) {
- if (sp = getservbyname(*argv, "tcp")) {
+ if ((sp = getservbyname(*argv, "tcp"))) {
sin.sin_port = sp->s_port;
} else {
sin.sin_port = atoi(*argv);
@@ -699,12 +713,14 @@ getterminaltype(name)
* we have to just go with what we (might) have already gotten.
*/
if (his_state_is_will(TELOPT_TTYPE) && !terminaltypeok(terminaltype)) {
- (void) strncpy(first, terminaltype, sizeof(first));
+ (void) strncpy(first, terminaltype, sizeof(first)-1);
+ first[sizeof(first)-1] = '\0';
for(;;) {
/*
* Save the unknown name, and request the next name.
*/
- (void) strncpy(last, terminaltype, sizeof(last));
+ (void) strncpy(last, terminaltype, sizeof(last)-1);
+ last[sizeof(last)-1] = '\0';
_gettermname();
if (terminaltypeok(terminaltype))
break;
@@ -722,8 +738,10 @@ getterminaltype(name)
* the start of the list.
*/
_gettermname();
- if (strncmp(first, terminaltype, sizeof(first)) != 0)
- (void) strncpy(terminaltype, first, sizeof(first));
+ if (strncmp(first, terminaltype, sizeof(first)) != 0) {
+ (void) strncpy(terminaltype, first, sizeof(terminaltype)-1);
+ terminaltype[sizeof(terminaltype)-1] = '\0';
+ }
break;
}
}
@@ -780,24 +798,20 @@ char *hostname;
char host_name[MAXHOSTNAMELEN];
char remote_host_name[MAXHOSTNAMELEN];
-#ifndef convex
-extern void telnet P((int, int));
-#else
extern void telnet P((int, int, char *));
-#endif
+int level;
+char user_name[256];
/*
* Get a pty, scan input lines.
*/
+void
doit(who)
struct sockaddr_in *who;
{
char *host, *inet_ntoa();
- int t;
struct hostent *hp;
- int level;
int ptynum;
- char user_name[256];
/*
* Find an available pty to use.
@@ -875,12 +889,6 @@ doit(who)
level = getterminaltype(user_name);
setenv("TERM", terminaltype ? terminaltype : "network", 1);
- /*
- * Start up the login process on the slave side of the terminal
- */
-#ifndef convex
- startslave(host, level, user_name);
-
#if defined(_SC_CRAY_SECURE_SYS)
if (secflag) {
if (setulvl(dv.dv_actlvl) < 0)
@@ -890,10 +898,8 @@ doit(who)
}
#endif /* _SC_CRAY_SECURE_SYS */
- telnet(net, pty); /* begin server processing */
-#else
- telnet(net, pty, host);
-#endif
+ telnet(net, pty, host); /* begin server process */
+
/*NOTREACHED*/
} /* end of doit */
@@ -917,15 +923,9 @@ Xterm_output(ibufp, obuf, icountp, ocount)
* hand data to telnet receiver finite state machine.
*/
void
-#ifndef convex
-telnet(f, p)
-#else
telnet(f, p, host)
-#endif
int f, p;
-#ifdef convex
char *host;
-#endif
{
int on = 1;
#define TABBUFSIZ 512
@@ -1162,9 +1162,12 @@ telnet(f, p, host)
{sprintf(nfrontp, "td: Entering processing loop\r\n");
nfrontp += strlen(nfrontp);});
-#ifdef convex
- startslave(host);
-#endif
+ /*
+ * Startup the login process on the slave side of the terminal
+ * now. We delay this until here to insure option negotiation
+ * is complete.
+ */
+ startslave(host, level, user_name);
nfd = ((f > p) ? f : p) + 1;
for (;;) {
diff --git a/contrib/telnet/telnetd/termstat.c b/contrib/telnet/telnetd/termstat.c
index ebc843a..be1372a 100644
--- a/contrib/telnet/telnetd/termstat.c
+++ b/contrib/telnet/telnetd/termstat.c
@@ -32,11 +32,15 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
+#if defined(ENCRYPTION)
+#include <libtelnet/encrypt.h>
+#endif
+
/*
* local variables
*/
@@ -144,8 +148,35 @@ localstat()
#endif /* defined(CRAY2) && defined(UNICOS5) */
/*
+ * Check for changes to flow control if client supports it.
+ */
+ flowstat();
+
+ /*
+ * Check linemode on/off state
+ */
+ uselinemode = tty_linemode();
+
+ /*
+ * If alwayslinemode is on, and pty is changing to turn it off, then
+ * force linemode back on.
+ */
+ if (alwayslinemode && linemode && !uselinemode) {
+ uselinemode = 1;
+ tty_setlinemode(uselinemode);
+ }
+
+ if (uselinemode) {
+ /*
* Check for state of BINARY options.
+ *
+ * We only need to do the binary dance if we are actually going
+ * to use linemode. As this confuses some telnet clients
+ * that don't support linemode, and doesn't gain us
+ * anything, we don't do it unless we're doing linemode.
+ * -Crh (henrich@msu.edu)
*/
+
if (tty_isbinaryin()) {
if (his_want_state_is_wont(TELOPT_BINARY))
send_do(TELOPT_BINARY, 1);
@@ -161,24 +192,6 @@ localstat()
if (my_want_state_is_will(TELOPT_BINARY))
send_wont(TELOPT_BINARY, 1);
}
-
- /*
- * Check for changes to flow control if client supports it.
- */
- flowstat();
-
- /*
- * Check linemode on/off state
- */
- uselinemode = tty_linemode();
-
- /*
- * If alwayslinemode is on, and pty is changing to turn it off, then
- * force linemode back on.
- */
- if (alwayslinemode && linemode && !uselinemode) {
- uselinemode = 1;
- tty_setlinemode(uselinemode);
}
#ifdef ENCRYPTION
@@ -479,7 +492,7 @@ clientstat(code, parm1, parm2)
ack = (useeditmode & MODE_ACK);
useeditmode &= ~MODE_ACK;
- if (changed = (useeditmode ^ editmode)) {
+ if ((changed = (useeditmode ^ editmode))) {
/*
* This check is for a timing problem. If the
* state of the tty has changed (due to the user
diff --git a/contrib/telnet/telnetd/utility.c b/contrib/telnet/telnetd/utility.c
index 9553d58..eac3b69 100644
--- a/contrib/telnet/telnetd/utility.c
+++ b/contrib/telnet/telnetd/utility.c
@@ -32,12 +32,22 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#endif /* not lint */
+#ifdef __FreeBSD__
+#include <locale.h>
+#endif
#define PRINTOPTIONS
#include "telnetd.h"
+#if defined(AUTHENTICATION)
+#include <libtelnet/auth.h>
+#endif
+#if defined(ENCRYPTION)
+#include <libtelnet/encrypt.h>
+#endif
+
/*
* utility functions performing io related tasks
*/
@@ -93,6 +103,7 @@ stilloob(s)
do {
FD_ZERO(&excepts);
FD_SET(s, &excepts);
+ memset((char *)&timeout, 0, sizeof timeout);
value = select(s+1, (fd_set *)0, (fd_set *)0, &excepts, &timeout);
} while ((value == -1) && (errno == EINTR));
@@ -433,12 +444,16 @@ putchr(cc)
*putlocation++ = cc;
}
+#ifdef __FreeBSD__
+static char fmtstr[] = { "%+" };
+#else
/*
* This is split on two lines so that SCCS will not see the M
* between two % signs and expand it...
*/
static char fmtstr[] = { "%l:%M\
%P on %A, %d %B %Y" };
+#endif
void
putf(cp, where)
@@ -481,6 +496,9 @@ putf(cp, where)
break;
case 'd':
+#ifdef __FreeBSD__
+ setlocale(LC_TIME, "");
+#endif
(void)time(&t);
(void)strftime(db, sizeof(db), fmtstr, localtime(&t));
putstr(db);
@@ -939,7 +957,6 @@ printsub(direction, pointer, length)
break;
default:
- def_case:
if (isprint(pointer[i]) && pointer[i] != '"') {
if (noquote) {
*nfrontp++ = '"';
@@ -1110,12 +1127,12 @@ printsub(direction, pointer, length)
break;
case ENCRYPT_ENC_KEYID:
- sprintf(nfrontp, " ENC_KEYID", pointer[1]);
+ sprintf(nfrontp, " ENC_KEYID");
nfrontp += strlen(nfrontp);
goto encommon;
case ENCRYPT_DEC_KEYID:
- sprintf(nfrontp, " DEC_KEYID", pointer[1]);
+ sprintf(nfrontp, " DEC_KEYID");
nfrontp += strlen(nfrontp);
goto encommon;
OpenPOWER on IntegriCloud