WARNS?=1. RCS ids.

This commit is contained in:
mrg 1997-10-08 08:45:07 +00:00
parent ac262c0c2f
commit ee62445dbf
10 changed files with 106 additions and 72 deletions

View File

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.8 1997/10/08 08:45:07 mrg Exp $
# from: @(#)Makefile 8.2 (Berkeley) 12/15/93
# $NetBSD: Makefile,v 1.7 1997/03/24 22:18:37 christos Exp $
WARNS?= 1
PROG= telnetd
CFLAGS+=-DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO -DDIAGNOSTICS
CFLAGS+=-DOLD_ENVIRON -DENV_HACK -I${.CURDIR}

View File

@ -1,4 +1,4 @@
/* $NetBSD: authenc.c,v 1.3 1996/02/28 20:38:08 thorpej Exp $ */
/* $NetBSD: authenc.c,v 1.4 1997/10/08 08:45:08 mrg Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)authenc.c 8.2 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: authenc.c,v 1.3 1996/02/28 20:38:08 thorpej Exp $";
__RCSID("$NetBSD: authenc.c,v 1.4 1997/10/08 08:45:08 mrg Exp $");
#endif
#endif /* not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext.h,v 1.6 1996/02/28 20:38:13 thorpej Exp $ */
/* $NetBSD: ext.h,v 1.7 1997/10/08 08:45:09 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -140,9 +140,9 @@ extern void
start_login P((char *, int, char *)),
start_slc P((int)),
#if defined(AUTHENTICATION)
start_slave P((char *)),
startslave P((char *)),
#else
start_slave P((char *, int, char *)),
startslave P((char *, int, char *)),
#endif
suboption P((void)),
telrcv P((void)),

View File

@ -1,4 +1,4 @@
/* $NetBSD: global.c,v 1.6 1996/02/28 20:38:14 thorpej Exp $ */
/* $NetBSD: global.c,v 1.7 1997/10/08 08:45:10 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)global.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: global.c,v 1.6 1996/02/28 20:38:14 thorpej Exp $";
__RCSID("$NetBSD: global.c,v 1.7 1997/10/08 08:45:10 mrg Exp $");
#endif
#endif /* not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: slc.c,v 1.5 1996/02/28 20:38:16 thorpej Exp $ */
/* $NetBSD: slc.c,v 1.6 1997/10/08 08:45:10 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)slc.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: slc.c,v 1.5 1996/02/28 20:38:16 thorpej Exp $";
__RCSID("$NetBSD: slc.c,v 1.6 1997/10/08 08:45:10 mrg Exp $");
#endif
#endif /* not lint */
@ -53,6 +54,10 @@ static int slcchange; /* change to slc is requested */
static unsigned char *slcptr; /* pointer into slc buffer */
static unsigned char slcbuf[NSLC*6]; /* buffer for slc negotiation */
void default_slc __P((void));
int end_slc __P((unsigned char **));
void process_slc __P((u_int, u_int, cc_t));
/*
* send_slc
*
@ -162,7 +167,7 @@ start_slc(getit)
slcchange = 0;
if (getit)
init_termbuf();
(void) sprintf((char *)slcbuf, "%c%c%c%c",
(void)snprintf((char *)slcbuf, sizeof slcbuf, "%c%c%c%c",
IAC, SB, TELOPT_LINEMODE, LM_SLC);
slcptr = slcbuf + 4;
@ -178,7 +183,6 @@ end_slc(bufp)
register unsigned char **bufp;
{
register int len;
void netflush();
/*
* If a change has occured, store the new terminal control
@ -222,10 +226,10 @@ end_slc(bufp)
*/
void
process_slc(func, flag, val)
register unsigned char func, flag;
register cc_t val;
u_int func, flag;
cc_t val;
{
register int hislevel, mylevel, ack;
int hislevel, mylevel, ack;
/*
* Ensure that we know something about this function
@ -288,10 +292,10 @@ process_slc(func, flag, val)
*/
void
change_slc(func, flag, val)
register char func, flag;
register cc_t val;
int func, flag;
cc_t val;
{
register int hislevel, mylevel;
int hislevel, mylevel;
hislevel = flag & SLC_LEVELBITS;
mylevel = slctab[func].defset.flag & SLC_LEVELBITS;
@ -458,7 +462,7 @@ do_opt_slc(ptr, len)
if (ptr >= end) break;
val = (cc_t)*ptr++;
process_slc(func, flag, val);
process_slc((u_int)func, (u_int)flag, val);
}
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: state.c,v 1.10 1996/09/07 21:45:52 explorer Exp $ */
/* $NetBSD: state.c,v 1.11 1997/10/08 08:45:11 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: state.c,v 1.10 1996/09/07 21:45:52 explorer Exp $";
__RCSID("$NetBSD: state.c,v 1.11 1997/10/08 08:45:11 mrg Exp $");
#endif
#endif /* not lint */
@ -46,6 +47,8 @@ static char rcsid[] = "$NetBSD: state.c,v 1.10 1996/09/07 21:45:52 explorer Exp
#include <libtelnet/auth.h>
#endif
static int envvarok __P((char *));
unsigned char doopt[] = { IAC, DO, '%', 'c', 0 };
unsigned char dont[] = { IAC, DONT, '%', 'c', 0 };
unsigned char will[] = { IAC, WILL, '%', 'c', 0 };
@ -453,10 +456,10 @@ send_do(option, init)
}
#ifdef AUTHENTICATION
extern void auth_request();
extern void auth_request __P((void)); /* libtelnet */
#endif
#ifdef LINEMODE
extern void doclientstat();
extern void doclientstat __P((void));
#endif
void
@ -464,7 +467,7 @@ willoption(option)
int option;
{
int changeok = 0;
void (*func)() = 0;
void (*func) __P((void)) = 0;
/*
* process input from peer.

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_term.c,v 1.10 1997/08/25 19:31:51 kleink Exp $ */
/* $NetBSD: sys_term.c,v 1.11 1997/10/08 08:45:12 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,17 +33,20 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: sys_term.c,v 1.10 1997/08/25 19:31:51 kleink Exp $";
__RCSID("$NetBSD: sys_term.c,v 1.11 1997/10/08 08:45:12 mrg Exp $");
#endif
#endif /* not lint */
#include "telnetd.h"
#include "pathnames.h"
#include <util.h>
#include <sys/cdefs.h>
#define P __P
@ -180,6 +183,14 @@ int ttyfd = -1;
# endif
#endif /* USE_TERMIO */
void getptyslave __P((void));
int cleanopen __P((char *));
void init_env __P((void));
char **addarg __P((char **, char *));
void scrub_env __P((void));
int getent __P((char *, char *));
char *getstr __P((char *, char **));
/*
* init_termbuf()
* copy_termbuf(cp)
@ -1074,7 +1085,7 @@ 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;
@ -1392,7 +1403,6 @@ startslave(host, autologin, autoname)
char *autoname;
{
register int i;
char name[256];
#ifdef NEWINIT
extern char *ptyip;
struct init_request request;
@ -1455,7 +1465,7 @@ startslave(host, autologin, autoname)
utmp_sig_notify(pid);
# endif /* PARENT_DOES_UTMP */
} else {
getptyslave(autologin);
getptyslave();
start_login(host, autologin, autoname);
/*NOTREACHED*/
}
@ -1467,7 +1477,8 @@ startslave(host, autologin, autoname)
*/
if ((i = open(INIT_FIFO, O_WRONLY)) < 0) {
char tbuf[128];
(void) sprintf(tbuf, "Can't open %s\n", INIT_FIFO);
(void)snprintf(tbuf, sizeof tbuf, "Can't open %s\n", INIT_FIFO);
fatalperror(net, tbuf);
}
memset((char *)&request, 0, sizeof(request));
@ -1490,20 +1501,23 @@ startslave(host, autologin, autoname)
#endif /* BFTPDAEMON */
if (write(i, (char *)&request, sizeof(request)) < 0) {
char tbuf[128];
(void) sprintf(tbuf, "Can't write to %s\n", INIT_FIFO);
(void)snprintf(tbuf, sizeof tbuf, "Can't write to %s\n", INIT_FIFO);
fatalperror(net, tbuf);
}
(void) close(i);
(void) signal(SIGALRM, nologinproc);
for (i = 0; ; i++) {
char tbuf[128];
alarm(15);
n = read(pty, ptyip, BUFSIZ);
if (i == 3 || n >= 0 || !gotalarm)
break;
gotalarm = 0;
sprintf(tbuf, "telnetd: waiting for /etc/init to start login process on %s\r\n", line);
(void) write(net, tbuf, strlen(tbuf));
(void)snprintf(tbuf, sizeof tbuf,
"telnetd: waiting for /etc/init to start login process on %s\r\n", line);
(void)write(net, tbuf, strlen(tbuf));
}
if (n < 0 && gotalarm)
fatal(net, "/etc/init didn't start login process");
@ -1521,11 +1535,10 @@ extern char **environ;
void
init_env()
{
extern char *getenv();
char **envp;
envp = envinit;
if (*envp = getenv("TZ"))
if ((*envp = getenv("TZ")))
*envp++ -= 3;
#if defined(CRAY) || defined(__hpux)
else
@ -1550,17 +1563,13 @@ start_login(host, autologin, name)
int autologin;
char *name;
{
register char *cp;
register char **argv;
char **addarg();
extern char *getenv();
extern char *getstr();
extern char *gettyname;
#define TABBUFSIZ 512
char defent[TABBUFSIZ];
char defstrs[TABBUFSIZ];
#undef TABBUFSIZ
char *loginprog;
char *loginprog = NULL;
#ifdef UTMPX
register int pid = getpid();
struct utmpx utmpx;
@ -1843,6 +1852,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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: telnetd.c,v 1.8 1997/10/08 01:09:02 enami Exp $ */
/* $NetBSD: telnetd.c,v 1.9 1997/10/08 08:45:13 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,23 +33,24 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n");
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: telnetd.c,v 1.8 1997/10/08 01:09:02 enami Exp $";
__RCSID("$NetBSD: telnetd.c,v 1.9 1997/10/08 08:45:13 mrg Exp $");
#endif
#endif /* not lint */
#include "telnetd.h"
#include "pathnames.h"
#include <arpa/inet.h>
int tgetent __P((char *, char *)); /* XXX from <curses.h> */
#include <sys/cdefs.h>
#define P __P
@ -136,6 +137,14 @@ char *gettyname = "default";
char *progname;
extern void usage P((void));
int main __P((int, char *[]));
void usage __P((void));
int getterminaltype __P((char *));
int getent __P((char *, char *));
void doit __P((struct sockaddr_in *));
void _gettermname __P((void));
int terminaltypeok __P((char *));
char *getstr __P((char *, char **));
/*
* The string to pass to getopt(). We do it this way so
@ -168,6 +177,7 @@ char valid_opts[] = {
'\0'
};
int
main(argc, argv)
char *argv[];
{
@ -381,7 +391,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);
@ -523,6 +533,9 @@ main(argc, argv)
net = 0;
doit(&from);
/* NOTREACHED */
#ifdef __GNUC__
exit(0);
#endif
} /* end of main */
void
@ -586,7 +599,6 @@ getterminaltype(name)
char *name;
{
int retval = -1;
void _gettermname();
settimer(baseline);
#if defined(AUTHENTICATION)
@ -770,11 +782,11 @@ extern void telnet P((int, int, char *));
/*
* Get a pty, scan input lines.
*/
void
doit(who)
struct sockaddr_in *who;
{
char *host, *inet_ntoa();
int t;
char *host;
struct hostent *hp;
int level;
int ptynum;
@ -826,6 +838,9 @@ doit(who)
if (hp == NULL && registerd_host_only) {
fatal(net, "Couldn't resolve your address into a host name.\r\n\
Please contact your net administrator");
#ifdef __GNUC__
host = NULL; /* XXX gcc */
#endif
} else if (hp &&
(strlen(hp->h_name) <= (unsigned int)((utmp_len < 0) ? -utmp_len
: utmp_len))) {
@ -916,7 +931,6 @@ telnet(f, p, host)
char *HE;
char *HN;
char *IM;
void netflush();
int nfd;
/*
@ -1109,7 +1123,6 @@ telnet(f, p, host)
#endif
if (getent(defent, gettyname) == 1) {
char *getstr();
char *cp=defstrs;
HE = getstr("he", &cp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: termstat.c,v 1.5 1996/02/28 20:38:27 thorpej Exp $ */
/* $NetBSD: termstat.c,v 1.6 1997/10/08 08:45:14 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: termstat.c,v 1.5 1996/02/28 20:38:27 thorpej Exp $";
__RCSID("$NetBSD: termstat.c,v 1.6 1997/10/08 08:45:14 mrg Exp $");
#endif
#endif /* not lint */
@ -138,7 +139,6 @@ int newmap = 1; /* nonzero if \n maps to ^M^J */
void
localstat()
{
void netflush();
int need_will_echo = 0;
#if defined(CRAY2) && defined(UNICOS5)
@ -378,7 +378,6 @@ flowstat()
clientstat(code, parm1, parm2)
register int code, parm1, parm2;
{
void netflush();
/*
* Get a copy of terminal characteristics.
@ -466,7 +465,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: utility.c,v 1.10 1996/09/27 02:30:05 thorpej Exp $ */
/* $NetBSD: utility.c,v 1.11 1997/10/08 08:45:15 mrg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: utility.c,v 1.10 1996/09/27 02:30:05 thorpej Exp $";
__RCSID("$NetBSD: utility.c,v 1.11 1997/10/08 08:45:15 mrg Exp $");
#endif
#endif /* not lint */
@ -45,6 +46,11 @@ static char rcsid[] = "$NetBSD: utility.c,v 1.10 1996/09/27 02:30:05 thorpej Exp
#define PRINTOPTIONS
#include "telnetd.h"
char *nextitem __P((char *));
void fatalperror __P((int, char *));
void edithost __P((char *, char *));
void putstr __P((char *));
/*
* utility functions performing io related tasks
*/
@ -61,7 +67,6 @@ static char rcsid[] = "$NetBSD: utility.c,v 1.10 1996/09/27 02:30:05 thorpej Exp
void
ttloop()
{
void netflush();
DIAG(TD_REPORT, {sprintf(nfrontp, "td: ttloop\r\n");
nfrontp += strlen(nfrontp);});
@ -328,8 +333,8 @@ fatal(f, msg)
{
char buf[BUFSIZ];
(void) sprintf(buf, "telnetd: %s.\r\n", msg);
(void) write(f, buf, (int)strlen(buf));
(void)snprintf(buf, sizeof buf,"telnetd: %s.\r\n", msg);
(void)write(f, buf, (int)strlen(buf));
sleep(1); /*XXX*/
exit(1);
}
@ -339,9 +344,9 @@ fatalperror(f, msg)
int f;
char *msg;
{
char buf[BUFSIZ], *strerror();
char buf[BUFSIZ];
(void) sprintf(buf, "%s: %s", msg, strerror(errno));
(void)snprintf(buf, sizeof buf, "%s: %s", msg, strerror(errno));
fatal(f, buf);
}
@ -353,7 +358,6 @@ edithost(pat, host)
register char *host;
{
register char *res = editedhost;
char *strncpy();
if (!pat)
pat = "";
@ -425,7 +429,6 @@ putf(cp, where)
#ifdef STREAMSPTY
extern char *strchr();
#else
extern char *strrchr();
#endif
uname(&utsinfo);
@ -511,8 +514,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; /* XXX gcc */
if (!(diagnostic & TD_OPTIONS))
return;
@ -758,7 +760,8 @@ printsub(direction, pointer, length)
}
{
char tbuf[32];
sprintf(tbuf, "%s%s%s%s%s",
(void)snprintf(tbuf, sizeof tbuf, "%s%s%s%s%s",
pointer[2]&MODE_EDIT ? "|EDIT" : "",
pointer[2]&MODE_TRAPSIG ? "|TRAPSIG" : "",
pointer[2]&MODE_SOFT_TAB ? "|SOFT_TAB" : "",
@ -931,7 +934,6 @@ printsub(direction, pointer, length)
break;
default:
def_case:
if (isprint(pointer[i]) && pointer[i] != '"') {
if (noquote) {
*nfrontp++ = '"';