Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/telnetd PR/45805: Borodin Oleg: telnet/telnetd with ...



details:   https://anonhg.NetBSD.org/src/rev/040755ed4782
branches:  trunk
changeset: 772623:040755ed4782
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 09 16:36:48 2012 +0000

description:
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4

diffstat:

 libexec/telnetd/Makefile   |  19 ++++++++++---------
 libexec/telnetd/ext.h      |   8 ++++----
 libexec/telnetd/state.c    |  16 ++++++----------
 libexec/telnetd/sys_term.c |  12 ++++++------
 libexec/telnetd/telnetd.c  |  13 +++++++------
 libexec/telnetd/utility.c  |  41 +++++++++++++++++++++--------------------
 6 files changed, 54 insertions(+), 55 deletions(-)

diffs (truncated from 360 to 300 lines):

diff -r 10641d9c9dc6 -r 040755ed4782 libexec/telnetd/Makefile
--- a/libexec/telnetd/Makefile  Mon Jan 09 16:35:20 2012 +0000
+++ b/libexec/telnetd/Makefile  Mon Jan 09 16:36:48 2012 +0000
@@ -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 @@
 
 .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 -r 10641d9c9dc6 -r 040755ed4782 libexec/telnetd/ext.h
--- a/libexec/telnetd/ext.h     Mon Jan 09 16:35:20 2012 +0000
+++ b/libexec/telnetd/ext.h     Mon Jan 09 16:36:48 2012 +0000
@@ -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 @@
        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 @@
        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 @@
        tty_binaryout(int);
 
 extern char *
-       putf(char *, char *);
+       putf(const char *, char *);
 
 extern int
        end_slc(unsigned char **),
diff -r 10641d9c9dc6 -r 040755ed4782 libexec/telnetd/state.c
--- a/libexec/telnetd/state.c   Mon Jan 09 16:35:20 2012 +0000
+++ b/libexec/telnetd/state.c   Mon Jan 09 16:36:48 2012 +0000
@@ -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 @@
 
 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 @@
                        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 @@
                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 @@
                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 @@
                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 -r 10641d9c9dc6 -r 040755ed4782 libexec/telnetd/sys_term.c
--- a/libexec/telnetd/sys_term.c        Mon Jan 09 16:35:20 2012 +0000
+++ b/libexec/telnetd/sys_term.c        Mon Jan 09 16:36:48 2012 +0000
@@ -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 @@
 
 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 @@
 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 @@
 }
 
 char **
-addarg(char **argv, char *val)
+addarg(char **argv, const char *val)
 {
        char **cpp;
        char **nargv;
@@ -707,7 +707,7 @@
                argv++;
                cpp = &argv[(long)argv[-1] - 10];
        }
-       *cpp++ = val;
+       *cpp++ = __UNCONST(val);
        *cpp = 0;
        return(argv);
 }
diff -r 10641d9c9dc6 -r 040755ed4782 libexec/telnetd/telnetd.c
--- a/libexec/telnetd/telnetd.c Mon Jan 09 16:35:20 2012 +0000
+++ b/libexec/telnetd/telnetd.c Mon Jan 09 16:36:48 2012 +0000
@@ -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 @@
 #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 @@
 
 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 @@
        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 @@
        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 -r 10641d9c9dc6 -r 040755ed4782 libexec/telnetd/utility.c
--- a/libexec/telnetd/utility.c Mon Jan 09 16:35:20 2012 +0000
+++ b/libexec/telnetd/utility.c Mon Jan 09 16:36:48 2012 +0000
@@ -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 @@
 char editedhost[MAXHOSTNAMELEN];
 
 void
-edithost(char *pat, char *host)
+edithost(const char *pat, const char *host)
 {
        char *res = editedhost;
 
@@ -427,11 +427,11 @@
  * 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 @@
            break;
 
        case TELOPT_STATUS: {
-           char *cp;
+           const char *cp;
            int j, k;
 
            output_data("STATUS");
@@ -841,39 +841,40 @@
                output_data("INFO ");
            env_common:



Home | Main Index | Thread Index | Old Index