summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-12-03 07:16:08 +0000
committercharnier <charnier@FreeBSD.org>1997-12-03 07:16:08 +0000
commit4fb0a742b1c5240b2cad42e221aa28ac18f8afa2 (patch)
treeb28511d60d77bf6230e67126c80e71232c503c81 /libexec
parent27c596e1ed6ea0fe26b2cf64d9e5a257d92f2d34 (diff)
downloadFreeBSD-src-4fb0a742b1c5240b2cad42e221aa28ac18f8afa2.zip
FreeBSD-src-4fb0a742b1c5240b2cad42e221aa28ac18f8afa2.tar.gz
Use err(3). Remove progname and trailing \n in syslog strings.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/telnetd/global.c4
-rw-r--r--libexec/telnetd/slc.c6
-rw-r--r--libexec/telnetd/state.c8
-rw-r--r--libexec/telnetd/sys_term.c32
-rw-r--r--libexec/telnetd/telnetd.8135
-rw-r--r--libexec/telnetd/telnetd.c89
-rw-r--r--libexec/telnetd/termstat.c8
-rw-r--r--libexec/telnetd/utility.c22
8 files changed, 155 insertions, 149 deletions
diff --git a/libexec/telnetd/global.c b/libexec/telnetd/global.c
index af21acc..8e5c7bb 100644
--- a/libexec/telnetd/global.c
+++ b/libexec/telnetd/global.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
/*
diff --git a/libexec/telnetd/slc.c b/libexec/telnetd/slc.c
index a3799f3..f0c9835 100644
--- a/libexec/telnetd/slc.c
+++ b/libexec/telnetd/slc.c
@@ -29,12 +29,14 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id$
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)slc.c 8.1 (Berkeley) 6/4/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "telnetd.h"
diff --git a/libexec/telnetd/state.c b/libexec/telnetd/state.c
index 4e72666..6693077 100644
--- a/libexec/telnetd/state.c
+++ b/libexec/telnetd/state.c
@@ -29,12 +29,14 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id$
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)state.c 8.2 (Berkeley) 12/15/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "telnetd.h"
@@ -345,7 +347,7 @@ gotiac: switch (c) {
continue;
default:
- syslog(LOG_ERR, "telnetd: panic state=%d\n", state);
+ syslog(LOG_ERR, "panic state=%d", state);
printf("telnetd: panic state=%d\n", state);
exit(1);
}
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 1881e32..07c8dfd 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -29,12 +29,14 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id$
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)sys_term.c 8.2 (Berkeley) 12/15/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "telnetd.h"
@@ -187,6 +189,12 @@ int ttyfd = -1;
# endif
#endif /* USE_TERMIO */
+#include <sys/types.h>
+#include <libutil.h>
+
+int cleanopen __P((char *));
+void scrub_env __P((void));
+
/*
* init_termbuf()
* copy_termbuf(cp)
@@ -1046,10 +1054,9 @@ extern void utmp_sig_notify P((int));
* getptyslave()
*
* Open the slave side of the pty, and do any initialization
- * that is necessary. The return value is a file descriptor
- * for the slave side.
+ * that is necessary.
*/
- int
+ void
getptyslave()
{
register int t = -1;
@@ -1369,7 +1376,6 @@ startslave(host, autologin, autoname)
{
register int i;
long time();
- char name[256];
#ifdef NEWINIT
extern char *ptyip;
struct init_request request;
@@ -1502,7 +1508,7 @@ init_env()
char **envp;
envp = envinit;
- if (*envp = getenv("TZ"))
+ if ((*envp = getenv("TZ")))
*envp++ -= 3;
#if defined(CRAY) || defined(__hpux)
else
@@ -1527,9 +1533,8 @@ start_login(host, autologin, name)
int autologin;
char *name;
{
- register char *cp;
register char **argv;
- char **addarg(), *user;
+ char **addarg();
extern char *getenv();
#ifdef UTMPX
register int pid = getpid();
@@ -1736,7 +1741,7 @@ start_login(host, autologin, name)
}
execv(altlogin, argv);
- syslog(LOG_ERR, "%s: %m\n", altlogin);
+ syslog(LOG_ERR, "%s: %m", altlogin);
fatalperror(net, altlogin);
/*NOTREACHED*/
}
@@ -1781,6 +1786,7 @@ addarg(argv, val)
* Remove a few things from the environment that
* don't need to be there.
*/
+ void
scrub_env()
{
register char **cpp, **cpp2;
@@ -2000,7 +2006,7 @@ cleantmp(wtp)
utp = getutid(wtp);
if (utp == 0) {
- syslog(LOG_ERR, "Can't get /etc/utmp entry to clean TMPDIR");
+ syslog(LOG_ERR, "can't get /etc/utmp entry to clean TMPDIR");
return(-1);
}
/*
@@ -2052,12 +2058,12 @@ cleantmpdir(jid, tpath, user)
{
switch(fork()) {
case -1:
- syslog(LOG_ERR, "TMPDIR cleanup(%s): fork() failed: %m\n",
+ syslog(LOG_ERR, "TMPDIR cleanup(%s): fork() failed: %m",
tpath);
break;
case 0:
execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, 0);
- syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m\n",
+ syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m",
tpath, CLEANTMPCMD);
exit(1);
default:
diff --git a/libexec/telnetd/telnetd.8 b/libexec/telnetd/telnetd.8
index de8099d..a9de2bc 100644
--- a/libexec/telnetd/telnetd.8
+++ b/libexec/telnetd/telnetd.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)telnetd.8 8.3 (Berkeley) 3/1/94
-.\" $Id: telnetd.8,v 1.8 1997/02/22 14:22:30 peter Exp $
+.\" $Id: telnetd.8,v 1.9 1997/09/14 18:25:19 wosch Exp $
.\"
.Dd March 1, 1994
.Dt TELNETD 8
@@ -55,7 +55,7 @@ protocol server
.Op Fl debug Op Ar port
.Sh DESCRIPTION
The
-.Nm telnetd
+.Nm
command is a server which supports the
.Tn DARPA
standard
@@ -69,45 +69,45 @@ for requests to connect to the
port as indicated by the
.Pa /etc/services
file (see
-.Xr services 5 ) .
+.Xr services 5 ).
The
.Fl debug
option may be used to start up
-.Nm telnetd
+.Nm
manually, instead of through
.Xr inetd 8 .
If started up this way,
.Ar port
may be specified to run
-.Nm telnetd
+.Nm
on an alternate
.Tn TCP
port number.
.Pp
The
-.Nm telnetd
+.Nm
command accepts the following options:
-.Bl -tag -width "-a authmode"
+.Bl -tag -width indent
.It Fl a Ar authmode
This option may be used for specifying what mode should
be used for authentication.
Note that this option is only useful if
-.Nm telnetd
+.Nm
has been compiled with support for the
.Dv AUTHENTICATION
option.
There are several valid values for
-.Ar authmode:
+.Ar authmode :
.Bl -tag -width debug
-.It debug
-Turns on authentication debugging code.
-.It user
+.It Cm debug
+Turn on authentication debugging code.
+.It Cm user
Only allow connections when the remote user
can provide valid authentication information
to identify the remote user,
and is allowed access to the specified account
without providing a password.
-.It valid
+.It Cm valid
Only allow connections when the remote user
can provide valid authentication information
to identify the remote user.
@@ -116,14 +116,14 @@ The
command will provide any additional user verification
needed if the remote user is not allowed automatic
access to the specified account.
-.It other
+.It Cm other
Only allow connections that supply some authentication information.
This option is currently not supported
by any of the existing authentication mechanisms,
and is thus the same as specifying
.Fl a
.Cm valid .
-.It none
+.It Cm none
This is the default state.
Authentication information is not required.
If no or insufficient authentication information
@@ -131,15 +131,15 @@ is provided, then the
.Xr login 1
program will provide the necessary user
verification.
-.It off
-This disables the authentication code.
+.It Cm off
+Disable the authentication code.
All user verification will happen through the
.Xr login 1
program.
.El
.It Fl B
-Specifies bftp server mode. In this mode,
-.Nm telnetd
+Specify bftp server mode. In this mode,
+.Nm
causes login to start a
.Xr bftp 1
session rather than the user's
@@ -151,51 +151,51 @@ port.
.It Fl D Ar debugmode
This option may be used for debugging purposes.
This allows
-.Nm telnetd
+.Nm
to print out debugging information
to the connection, allowing the user to see what
-.Nm telnetd
+.Nm
is doing.
There are several possible values for
-.Ar debugmode:
+.Ar debugmode :
.Bl -tag -width exercise
.It Cm options
-Prints information about the negotiation of
+Print information about the negotiation of
.Tn TELNET
options.
.It Cm report
-Prints the
+Print the
.Cm options
information, plus some additional information
about what processing is going on.
.It Cm netdata
-Displays the data stream received by
-.Nm telnetd.
+Display the data stream received by
+.Nm Ns .
.It Cm ptydata
-Displays data written to the pty.
+Display data written to the pty.
.It Cm exercise
Has not been implemented yet.
.El
.It Fl debug
-Enables debugging on each socket created by
-.Nm telnetd
+Enable debugging on each socket created by
+.Nm
(see
.Dv SO_DEBUG
in
.Xr socket 2 ) .
.It Fl edebug
If
-.Nm telnetd
+.Nm
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
+Specify 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
+Disable the printing of host-specific information before
login has been completed.
.It Fl I Ar initid
This option is only applicable to
@@ -211,7 +211,7 @@ is
.Dv fe.
.It Fl k
This option is only useful if
-.Nm telnetd
+.Nm
has been compiled with both linemode and kludge linemode
support. If the
.Fl k
@@ -219,7 +219,7 @@ option is specified, then if the remote client does not
support the
.Dv LINEMODE
option, then
-.Nm telnetd
+.Nm
will operate in character at a time mode.
It will still support kludge linemode, but will only
go into kludge linemode if the remote client requests
@@ -238,7 +238,7 @@ in response to a
.Dv DO TIMING-MARK)
for kludge linemode support.
.It Fl l
-Specifies line mode. Tries to force clients to use line-
+Specify line mode. Try to force clients to use line-
at-a-time mode.
If the
.Dv LINEMODE
@@ -248,7 +248,7 @@ into kludge linemode.
Disable
.Dv TCP
keep-alives. Normally
-.Nm telnetd
+.Nm
enables the
.Tn TCP
keep-alive mechanism to probe connections that
@@ -258,7 +258,7 @@ from machines that have crashed or can no longer
be reached may be cleaned up.
.It Fl r Ar lowpty-highpty
This option is only enabled when
-.Nm telnetd
+.Nm
is compiled for
.Dv UNICOS.
It specifies an inclusive range of pseudo-terminal devices to
@@ -274,14 +274,14 @@ may be omitted to allow changing
either end of the search range. If
.Ar lowpty
is omitted, the - character is still required so that
-.Nm telnetd
+.Nm
can differentiate
.Ar highpty
from
.Ar lowpty .
.It Fl s
This option is only enabled if
-.Nm telnetd
+.Nm
is compiled with support for
.Tn SecurID
cards.
@@ -317,7 +317,7 @@ should be put into the
file.
.It Fl U
This option causes
-.Nm telnetd
+.Nm
to refuse connections from addresses that
cannot be mapped back into a symbolic name
via the
@@ -325,14 +325,14 @@ via the
routine.
.It Fl X Ar authtype
This option is only valid if
-.Nm telnetd
+.Nm
has been built with support for the authentication option.
It disables the use of
.Ar authtype
authentication, and
can be used to temporarily disable
a specific authentication type without having to recompile
-.Nm telnetd .
+.Nm Ns .
.El
.Pp
.Nm Telnetd
@@ -354,7 +354,7 @@ between the remote client and the login process.
When a
.Tn TELNET
session is started up,
-.Nm telnetd
+.Nm
sends
.Tn TELNET
options to the client side indicating
@@ -403,25 +403,25 @@ current state of terminal echoing.
When terminal echo is not desired, a
.Dv WILL ECHO
is sent to indicate that
-.Tn telnetd
+.Nm
will take care of echoing any data that needs to be
echoed to the terminal, and then nothing is echoed.
When terminal echo is desired, a
.Dv WONT ECHO
is sent to indicate that
-.Tn telnetd
+.Nm
will not be doing any terminal echoing, so the
client should do any terminal echoing that is needed.
.It "WILL BINARY"
-Indicates that the client is willing to send a
+Indicate that the client is willing to send a
8 bits of data, rather than the normal 7 bits
of the Network Virtual Terminal.
.It "WILL SGA"
-Indicates that it will not be sending
+Indicate that it will not be sending
.Dv IAC GA,
go ahead, commands.
.It "WILL STATUS"
-Indicates a willingness to send the client, upon
+Indicate a willingness to send the client, upon
request, of the current status of all
.Tn TELNET
options.
@@ -441,7 +441,7 @@ is sent in response, and the
session is shut down.
.It "WILL ENCRYPT"
Only sent if
-.Nm telnetd
+.Nm
is compiled with support for data encryption, and
indicates a willingness to decrypt
the data stream.
@@ -454,7 +454,7 @@ options:
.Bl -tag -width "DO AUTHENTICATION"
.It "DO BINARY"
Sent to indicate that
-.Tn telnetd
+.Nm
is willing to receive an 8 bit data stream.
.It "DO LFLOW"
Requests that the client handle flow control
@@ -470,38 +470,38 @@ is received, a
.Dv DONT ECHO
will be sent in response.
.It "DO TERMINAL-TYPE"
-Indicates a desire to be able to request the
+Indicate a desire to be able to request the
name of the type of terminal that is attached
to the client side of the connection.
.It "DO SGA"
-Indicates that it does not need to receive
+Indicate that it does not need to receive
.Dv IAC GA,
the go ahead command.
.It "DO NAWS"
Requests that the client inform the server when
the window (display) size changes.
.It "DO TERMINAL-SPEED"
-Indicates a desire to be able to request information
+Indicate a desire to be able to request information
about the speed of the serial line to which
the client is attached.
.It "DO XDISPLOC"
-Indicates a desire to be able to request the name
+Indicate a desire to be able to request the name
of the X Window System display that is associated with
the telnet client.
.It "DO NEW-ENVIRON"
-Indicates a desire to be able to request environment
+Indicate a desire to be able to request environment
variable information, as described in RFC 1572.
.It "DO ENVIRON"
-Indicates a desire to be able to request environment
+Indicate a desire to be able to request environment
variable information, as described in RFC 1408.
.It "DO LINEMODE"
Only sent if
-.Nm telnetd
+.Nm
is compiled with support for linemode, and
requests that the client do line by line processing.
.It "DO TIMING-MARK"
Only sent if
-.Nm telnetd
+.Nm
is compiled with support for both linemode and
kludge linemode, and the client responded with
.Dv WONT LINEMODE.
@@ -514,28 +514,27 @@ Note that the
option can be used to disable this.
.It "DO AUTHENTICATION"
Only sent if
-.Nm telnetd
+.Nm
is compiled with support for authentication, and
indicates a willingness to receive authentication
information for automatic login.
.It "DO ENCRYPT"
Only sent if
-.Nm telnetd
+.Nm
is compiled with support for data encryption, and
indicates a willingness to decrypt
the data stream.
.Sh ENVIRONMENT
.Sh FILES
-.Pa /etc/services
-.br
-.Pa /etc/inittab
+.Bl -tag -width /usr/ucb/bftp -compact
+.It Pa /etc/services
+.It Pa /etc/inittab
(UNICOS systems only)
-.br
-.Pa /etc/iptos
+.It Pa /etc/iptos
(if supported)
-.br
-.Pa /usr/ucb/bftp
+.It Pa /usr/ucb/bftp
(if supported)
+.El
.Sh "SEE ALSO"
.Xr bftp 1 ,
.Xr login 1 ,
@@ -593,7 +592,7 @@ commands are only partially implemented.
.Pp
Because of bugs in the original 4.2 BSD
.Xr telnet 1 ,
-.Nm telnetd
+.Nm
performs some dubious protocol exchanges to try to discover if the remote
client is, in fact, a 4.2 BSD
.Xr telnet 1 .
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index 52eab70..2944188 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -29,18 +29,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id: telnetd.c,v 1.11 1997/03/28 15:48:18 imp Exp $
*/
#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
+#if 0
static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "telnetd.h"
@@ -55,6 +57,9 @@ static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93";
# undef _SC_CRAY_SECURE_SYS
#endif
+#include <err.h>
+#include <arpa/inet.h>
+
#if defined(_SC_CRAY_SECURE_SYS)
#include <sys/sysv.h>
#include <sys/secdev.h>
@@ -125,9 +130,11 @@ int lowpty = 0, highpty; /* low, high pty numbers */
int debug = 0;
int keepalive = 1;
-char *progname;
char *altlogin;
+void doit __P((struct sockaddr_in *));
+int terminaltypeok __P((char *));
+void startslave __P((char *, int, char *));
extern void usage P((void));
/*
@@ -161,14 +168,13 @@ char valid_opts[] = {
'\0'
};
+ int
main(argc, argv)
char *argv[];
{
struct sockaddr_in from;
int on = 1, fromlen;
register int ch;
- extern char *optarg;
- extern int optind;
#if defined(IPPROTO_IP) && defined(IP_TOS)
int tos = -1;
#endif
@@ -177,8 +183,6 @@ main(argc, argv)
netip = netibuf;
nfrontp = nbackp = netobuf;
- progname = *argv;
-
/*
* This initialization causes linemode to default to a configuration
* that works on all telnet clients, including the FreeBSD client.
@@ -228,8 +232,7 @@ main(argc, argv)
*/
auth_level = -1;
} else {
- fprintf(stderr,
- "telnetd: unknown authorization level for -a\n");
+ warnx("unknown authorization level for -a");
}
break;
#endif /* AUTHENTICATION */
@@ -344,12 +347,11 @@ main(argc, argv)
case 'S':
#ifdef HAS_GETTOS
if ((tos = parsetos(optarg, "tcp")) < 0)
- fprintf(stderr, "%s%s%s\n",
- "telnetd: Bad TOS argument '", optarg,
+ warnx("%s%s%s",
+ "bad TOS argument '", optarg,
"'; will try to use default TOS");
#else
- fprintf(stderr, "%s%s\n", "TOS option unavailable; ",
- "-S flag not supported\n");
+ warnx("TOS option unavailable; -S flag not supported");
#endif
break;
@@ -371,7 +373,7 @@ main(argc, argv)
#endif /* AUTHENTICATION */
default:
- fprintf(stderr, "telnetd: %c: unknown option\n", ch);
+ warnx("%c: unknown option", ch);
/* FALLTHROUGH */
case '?':
usage();
@@ -391,12 +393,12 @@ 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);
if ((int)sin.sin_port <= 0) {
- fprintf(stderr, "telnetd: %s: bad port #\n", *argv);
+ warnx("%s: bad port #", *argv);
usage();
/* NOT REACHED */
}
@@ -404,34 +406,24 @@ main(argc, argv)
}
} else {
sp = getservbyname("telnet", "tcp");
- if (sp == 0) {
- fprintf(stderr, "telnetd: tcp/telnet: unknown service\n");
- exit(1);
- }
+ if (sp == 0)
+ errx(1, "tcp/telnet: unknown service");
sin.sin_port = sp->s_port;
}
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s < 0) {
- perror("telnetd: socket");;
- exit(1);
- }
+ if (s < 0)
+ err(1, "socket");
(void) setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
(char *)&on, sizeof(on));
- if (bind(s, (struct sockaddr *)&sin, sizeof sin) < 0) {
- perror("bind");
- exit(1);
- }
- if (listen(s, 1) < 0) {
- perror("listen");
- exit(1);
- }
+ if (bind(s, (struct sockaddr *)&sin, sizeof sin) < 0)
+ err(1, "bind");
+ if (listen(s, 1) < 0)
+ err(1, "listen");
foo = sizeof sin;
ns = accept(s, (struct sockaddr *)&sin, &foo);
- if (ns < 0) {
- perror("accept");
- exit(1);
- }
+ if (ns < 0)
+ err(1, "accept");
(void) dup2(ns, 0);
(void) close(ns);
(void) close(s);
@@ -459,10 +451,8 @@ main(argc, argv)
bzero((char *)&dv, sizeof(dv));
- if (getsysv(&sysv, sizeof(struct sysv)) != 0) {
- perror("getsysv");
- exit(1);
- }
+ if (getsysv(&sysv, sizeof(struct sysv)) != 0)
+ err(1, "getsysv");
/*
* Get socket security label and set device values
@@ -473,8 +463,7 @@ main(argc, argv)
(char *)&ss, &szss) < 0) ||
(getsockopt(0, SOL_SOCKET, SO_SEC_MULTI,
(char *)&sock_multi, &szi) < 0)) {
- perror("getsockopt");
- exit(1);
+ err(1, "getsockopt");
} else {
dv.dv_actlvl = ss.ss_actlabel.lt_level;
dv.dv_actcmp = ss.ss_actlabel.lt_compart;
@@ -504,8 +493,7 @@ main(argc, argv)
openlog("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON);
fromlen = sizeof (from);
if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) {
- fprintf(stderr, "%s: ", progname);
- perror("getpeername");
+ warn("getpeername");
_exit(1);
}
if (keepalive &&
@@ -533,12 +521,13 @@ main(argc, argv)
net = 0;
doit(&from);
/* NOTREACHED */
+ return(0);
} /* end of main */
void
usage()
{
- fprintf(stderr, "Usage: telnetd");
+ fprintf(stderr, "usage: telnetd");
#ifdef AUTHENTICATION
fprintf(stderr, " [-a (debug|other|user|valid|off|none)]\n\t");
#endif
@@ -774,11 +763,11 @@ char user_name[256];
/*
* Get a pty, scan input lines.
*/
+ void
doit(who)
struct sockaddr_in *who;
{
- char *host, *inet_ntoa();
- int t;
+ char *host = NULL;
struct hostent *hp;
int ptynum;
@@ -1056,9 +1045,9 @@ telnet(f, p, host)
* side. Set up signal handler now.
*/
if ((int)signal(SIGUSR1, termstat) < 0)
- perror("signal");
+ warn("signal");
else if (ioctl(p, TCSIGME, (char *)SIGUSR1) < 0)
- perror("ioctl:TCSIGME");
+ warn("ioctl:TCSIGME");
/*
* Make processing loop check terminal characteristics early on.
*/
diff --git a/libexec/telnetd/termstat.c b/libexec/telnetd/termstat.c
index 9cb2b63..b95aa5f 100644
--- a/libexec/telnetd/termstat.c
+++ b/libexec/telnetd/termstat.c
@@ -29,12 +29,14 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id$
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)termstat.c 8.1 (Berkeley) 6/4/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include "telnetd.h"
@@ -471,7 +473,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/libexec/telnetd/utility.c b/libexec/telnetd/utility.c
index 2ee0d21..4735be3 100644
--- a/libexec/telnetd/utility.c
+++ b/libexec/telnetd/utility.c
@@ -29,12 +29,14 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id$
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)utility.c 8.2 (Berkeley) 12/15/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#ifdef __FreeBSD__
@@ -69,10 +71,10 @@ ttloop()
}
ncc = read(net, netibuf, sizeof netibuf);
if (ncc < 0) {
- syslog(LOG_INFO, "ttloop: read: %m\n");
+ syslog(LOG_INFO, "ttloop: read: %m");
exit(1);
} else if (ncc == 0) {
- syslog(LOG_INFO, "ttloop: peer died: %m\n");
+ syslog(LOG_INFO, "ttloop: peer died: %m");
exit(1);
}
DIAG(TD_REPORT, {sprintf(nfrontp, "td: ttloop read %d chars\r\n", ncc);
@@ -353,7 +355,6 @@ edithost(pat, host)
register char *host;
{
register char *res = editedhost;
- char *strncpy();
if (!pat)
pat = "";
@@ -523,8 +524,7 @@ printsub(direction, pointer, length)
unsigned char *pointer; /* where suboption data sits */
int length; /* length of suboption data */
{
- register int i;
- char buf[512];
+ register int i = 0;
if (!(diagnostic & TD_OPTIONS))
return;
@@ -943,7 +943,6 @@ printsub(direction, pointer, length)
break;
default:
- def_case:
if (isprint(pointer[i]) && pointer[i] != '"') {
if (noquote) {
*nfrontp++ = '"';
@@ -999,8 +998,11 @@ printsub(direction, pointer, length)
"MUTUAL" : "ONE-WAY");
nfrontp += strlen(nfrontp);
- auth_printsub(&pointer[1], length - 1, buf, sizeof(buf));
- sprintf(nfrontp, "%s", buf);
+ {
+ char buf[512];
+ auth_printsub(&pointer[1], length - 1, buf, sizeof(buf));
+ sprintf(nfrontp, "%s", buf);
+ }
nfrontp += strlen(nfrontp);
break;
OpenPOWER on IntegriCloud