summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2012-01-09 16:36:48 +0000
committerchristos <christos@NetBSD.org>2012-01-09 16:36:48 +0000
commit74326c9ea0f5e81ef8d71823cd93f979d9357bbd (patch)
tree89858d72bf821d36245bb4eb904d6dde0457f501 /libexec
parent47e9b0abd90a43303b1a2b1ff9d567987efb9dc2 (diff)
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941) - separate MKCRYPTO from USE_KERBEROS - WARNS=4
Diffstat (limited to 'libexec')
-rw-r--r--libexec/telnetd/Makefile19
-rw-r--r--libexec/telnetd/ext.h8
-rw-r--r--libexec/telnetd/state.c16
-rw-r--r--libexec/telnetd/sys_term.c12
-rw-r--r--libexec/telnetd/telnetd.c13
-rw-r--r--libexec/telnetd/utility.c41
6 files changed, 54 insertions, 55 deletions
diff --git a/libexec/telnetd/Makefile b/libexec/telnetd/Makefile
index 7f739867794..b298ea37e8b 100644
--- a/libexec/telnetd/Makefile
+++ b/libexec/telnetd/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.48 2011/04/24 21:42:06 elric Exp $
+# $NetBSD: Makefile,v 1.49 2012/01/09 16:36:48 christos Exp $
# from: @(#)Makefile 8.2 (Berkeley) 12/15/93
-WARNS?= 2 # XXX: const issues in sys_term.c
+WARNS?= 4 # XXX: const issues in sys_term.c
.include <bsd.own.mk>
@@ -22,17 +22,18 @@ LIBTELNETDIR!= cd ${.CURDIR}/../../lib/libtelnet; ${PRINTOBJDIR}
.if (${USE_KERBEROS} != "no")
CPPFLAGS+=-DKRB5 -DAUTHENTICATION -DENCRYPTION
-LDADD+= -lkrb5 -lasn1 -lcrypto -lcrypt
-DPADD+= ${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT}
+LDADD+= -lkrb5 -lasn1 -lcom_err -lroken
+DPADD+= ${LIBKRB5} ${LIBASN1} ${LIBCOM_ERR} ${LIBROKEN}
+.endif
+
+.if (${MKCRYPTO} != "no")
+LDADD+=-ldes -lcrypto -lcrypt
+DPADD+=${LIBDES} ${LIBCRYPTO} ${LIBCRYPT}
+.endif
.if (${USE_PAM} != "no")
LDADD+= -lpam ${PAM_STATIC_LDADD}
DPADD+= ${LIBPAM} ${PAM_STATIC_DPADD}
.endif
-LDADD+= -ldes -lcom_err -lroken
-DPADD+= ${LIBDES} ${LIBCOM_ERR} ${LIBROKEN}
-
-.endif
-
.include <bsd.prog.mk>
diff --git a/libexec/telnetd/ext.h b/libexec/telnetd/ext.h
index 727a80b28ed..7b3b6d071f1 100644
--- a/libexec/telnetd/ext.h
+++ b/libexec/telnetd/ext.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ext.h,v 1.20 2005/06/21 22:29:53 lha Exp $ */
+/* $NetBSD: ext.h,v 1.21 2012/01/09 16:36:48 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -90,7 +90,7 @@ extern void
doeof(void),
dooption(int),
dontoption(int),
- edithost(char *, char *),
+ edithost(const char *, const char *),
fatal(int, const char *),
fatalperror(int, const char *),
get_slc_defaults(void),
@@ -103,7 +103,7 @@ extern void
netflush(void),
#ifdef DIAGNOSTICS
printoption(const char *, int),
- printdata(char *, char *, int),
+ printdata(const char *, char *, int),
#ifndef ENCRYPTION
printsub(int, unsigned char *, int),
#endif
@@ -130,7 +130,7 @@ extern void
tty_binaryout(int);
extern char *
- putf(char *, char *);
+ putf(const char *, char *);
extern int
end_slc(unsigned char **),
diff --git a/libexec/telnetd/state.c b/libexec/telnetd/state.c
index 85f9c981398..99ba4f5ff7e 100644
--- a/libexec/telnetd/state.c
+++ b/libexec/telnetd/state.c
@@ -1,4 +1,4 @@
-/* $NetBSD: state.c,v 1.28 2011/12/23 16:56:54 christos Exp $ */
+/* $NetBSD: state.c,v 1.29 2012/01/09 16:36:48 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: state.c,v 1.28 2011/12/23 16:56:54 christos Exp $");
+__RCSID("$NetBSD: state.c,v 1.29 2012/01/09 16:36:48 christos Exp $");
#endif
#endif /* not lint */
@@ -45,10 +45,6 @@ __RCSID("$NetBSD: state.c,v 1.28 2011/12/23 16:56:54 christos Exp $");
static int envvarok(char *);
-unsigned const char doopt[] = { IAC, DO, '%', 'c', 0 };
-unsigned const char dont[] = { IAC, DONT, '%', 'c', 0 };
-unsigned const char will[] = { IAC, WILL, '%', 'c', 0 };
-unsigned const char wont[] = { IAC, WONT, '%', 'c', 0 };
int not42 = 1;
/*
@@ -437,7 +433,7 @@ send_do(int option, int init)
set_his_want_state_will(option);
do_dont_resp[option]++;
}
- (void) output_data((const char *)doopt, option);
+ (void) output_data("%c%c%c", IAC, DO, option);
DIAG(TD_OPTIONS, printoption("td: send do", option));
}
@@ -657,7 +653,7 @@ send_dont(int option, int init)
set_his_want_state_wont(option);
do_dont_resp[option]++;
}
- (void) output_data((const char *)dont, option);
+ (void) output_data("%c%c%c", IAC, DONT, option);
DIAG(TD_OPTIONS, printoption("td: send dont", option));
}
@@ -805,7 +801,7 @@ send_will(int option, int init)
set_my_want_state_will(option);
will_wont_resp[option]++;
}
- (void) output_data((const char *)will, option);
+ (void) output_data("%c%c%c", IAC, WILL, option);
DIAG(TD_OPTIONS, printoption("td: send will", option));
}
@@ -959,7 +955,7 @@ send_wont(int option, int init)
set_my_want_state_wont(option);
will_wont_resp[option]++;
}
- (void) output_data((const char *)wont, option);
+ (void) output_data("%c%c%c", IAC, WONT, option);
DIAG(TD_OPTIONS, printoption("td: send wont", option));
}
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 79876d534a0..a247c4ab08c 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_term.c,v 1.44 2007/01/17 21:44:50 hubertf Exp $ */
+/* $NetBSD: sys_term.c,v 1.45 2012/01/09 16:36:48 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: sys_term.c,v 1.44 2007/01/17 21:44:50 hubertf Exp $");
+__RCSID("$NetBSD: sys_term.c,v 1.45 2012/01/09 16:36:48 christos Exp $");
#endif
#endif /* not lint */
@@ -54,7 +54,7 @@ struct termios termbuf, termbuf2; /* pty control structure */
void getptyslave(void);
int cleanopen(char *);
-char **addarg(char **, char *);
+char **addarg(char **, const char *);
void scrub_env(void);
int getent(char *, char *);
char *getstr(const char *, char **);
@@ -84,7 +84,7 @@ init_termbuf(void)
void
copy_termbuf(char *cp, int len)
{
- if (len > sizeof(termbuf))
+ if ((size_t)len > sizeof(termbuf))
len = sizeof(termbuf);
memmove((char *)&termbuf, cp, len);
termbuf2 = termbuf;
@@ -677,7 +677,7 @@ start_login(char *host, int autologin, char *name)
}
char **
-addarg(char **argv, char *val)
+addarg(char **argv, const char *val)
{
char **cpp;
char **nargv;
@@ -707,7 +707,7 @@ addarg(char **argv, char *val)
argv++;
cpp = &argv[(long)argv[-1] - 10];
}
- *cpp++ = val;
+ *cpp++ = __UNCONST(val);
*cpp = 0;
return(argv);
}
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index 2c0a032692f..7aab61e63ba 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: telnetd.c,v 1.52 2011/04/24 21:18:24 elric Exp $ */
+/* $NetBSD: telnetd.c,v 1.53 2012/01/09 16:36:48 christos Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -65,7 +65,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: telnetd.c,v 1.52 2011/04/24 21:18:24 elric Exp $");
+__RCSID("$NetBSD: telnetd.c,v 1.53 2012/01/09 16:36:48 christos Exp $");
#endif
#endif /* not lint */
@@ -118,13 +118,13 @@ int hostinfo = 1; /* do we print login banner? */
static int debug = 0;
int keepalive = 1;
-char *gettyname = "default";
+const char *gettyname = "default";
char *progname;
int main(int, char *[]);
void usage(void);
int getterminaltype(char *, size_t);
-int getent(char *, char *);
+int getent(char *, const char *);
void doit(struct sockaddr *);
void _gettermname(void);
int terminaltypeok(char *);
@@ -360,7 +360,7 @@ main(int argc, char *argv[])
if (debug) {
int s, ns, error;
socklen_t foo;
- char *service = "telnet";
+ const char *service = "telnet";
struct addrinfo hints, *res;
if (argc > 1) {
@@ -747,7 +747,8 @@ telnet(int f, int p)
char defent[TABBUFSIZ];
char defstrs[TABBUFSIZ];
#undef TABBUFSIZ
- char *HE, *HN, *IM, *IF, *ptyibuf2ptr;
+ char *HE, *HN, *IF, *ptyibuf2ptr;
+ const char *IM;
struct pollfd set[2];
/*
diff --git a/libexec/telnetd/utility.c b/libexec/telnetd/utility.c
index 3aa0b19b001..53f6417c635 100644
--- a/libexec/telnetd/utility.c
+++ b/libexec/telnetd/utility.c
@@ -1,4 +1,4 @@
-/* $NetBSD: utility.c,v 1.31 2007/02/21 21:14:07 hubertf Exp $ */
+/* $NetBSD: utility.c,v 1.32 2012/01/09 16:36:48 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: utility.c,v 1.31 2007/02/21 21:14:07 hubertf Exp $");
+__RCSID("$NetBSD: utility.c,v 1.32 2012/01/09 16:36:48 christos Exp $");
#endif
#endif /* not lint */
@@ -370,7 +370,7 @@ fatalperror(f, msg)
char editedhost[MAXHOSTNAMELEN];
void
-edithost(char *pat, char *host)
+edithost(const char *pat, const char *host)
{
char *res = editedhost;
@@ -427,11 +427,11 @@ putchr(int cc)
* 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\
+static const char fmtstr[] = { "%l:%M\
%p on %A, %d %B %Y" };
char *
-putf(char *cp, char *where)
+putf(const char *cp, char *where)
{
char *slash;
time_t t;
@@ -740,7 +740,7 @@ printsub(
break;
case TELOPT_STATUS: {
- char *cp;
+ const char *cp;
int j, k;
output_data("STATUS");
@@ -841,39 +841,40 @@ printsub(
output_data("INFO ");
env_common:
{
- int noquote = 2;
+ static const char NQ[] = "\" ";
+ const char *noquote = NQ;
for (i = 2; i < length; i++ ) {
switch (pointer[i]) {
case NEW_ENV_VAR:
- output_data("%s", "\" VAR " + noquote);
- noquote = 2;
+ output_data("%sVAR ", noquote);
+ noquote = NQ;
break;
case NEW_ENV_VALUE:
- output_data("%s", "\" VALUE " + noquote);
- noquote = 2;
+ output_data("%sVALUE ", noquote);
+ noquote = NQ;
break;
case ENV_ESC:
- output_data("%s", "\" ESC " + noquote);
- noquote = 2;
+ output_data("%sESC ", noquote);
+ noquote = NQ;
break;
case ENV_USERVAR:
- output_data("%s", "\" USERVAR " + noquote);
- noquote = 2;
+ output_data("%sUSERVAR ", noquote);
+ noquote = NQ;
break;
default:
if (isprint(pointer[i]) && pointer[i] != '"') {
- if (noquote) {
+ if (*noquote) {
output_data("\"");
- noquote = 0;
+ noquote = "";
}
output_data("%c", pointer[i]);
} else {
- output_data("\" %03o " + noquote, pointer[i]);
- noquote = 2;
+ output_data("%s%03o ", noquote, pointer[i]);
+ noquote = NQ;
}
break;
}
@@ -1044,7 +1045,7 @@ printsub(
* Dump a data buffer in hex and ascii to the output data stream.
*/
void
-printdata(char *tag, char *ptr, int cnt)
+printdata(const char *tag, char *ptr, int cnt)
{
int i;
char xbuf[30];