Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/telnet unifdef compatibility for old BSD servers. Th...



details:   https://anonhg.NetBSD.org/src/rev/8d5ebd66652f
branches:  trunk
changeset: 447242:8d5ebd66652f
user:      maya <maya%NetBSD.org@localhost>
date:      Sat Jan 05 06:47:24 2019 +0000

description:
unifdef compatibility for old BSD servers. This has been
disabled, so no binary change. from openbsd.

diffstat:

 usr.bin/telnet/commands.c  |  48 +--------------------------
 usr.bin/telnet/telnet.c    |  81 +--------------------------------------------
 usr.bin/telnet/utilities.c |  39 ++-------------------
 3 files changed, 8 insertions(+), 160 deletions(-)

diffs (truncated from 310 to 300 lines):

diff -r fff8b2d9d6fe -r 8d5ebd66652f usr.bin/telnet/commands.c
--- a/usr.bin/telnet/commands.c Sat Jan 05 06:30:05 2019 +0000
+++ b/usr.bin/telnet/commands.c Sat Jan 05 06:47:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: commands.c,v 1.74 2019/01/05 06:30:05 maya Exp $       */
+/*     $NetBSD: commands.c,v 1.75 2019/01/05 06:47:24 maya Exp $       */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: commands.c,v 1.74 2019/01/05 06:30:05 maya Exp $");
+__RCSID("$NetBSD: commands.c,v 1.75 2019/01/05 06:47:24 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -1542,10 +1542,6 @@
     { "send",  "Send an environment variable", env_send,       1 },
     { "list",  "List the current environment variables",
                                                env_list,       0 },
-#if defined(OLD_ENVIRON) && defined(ENV_HACK)
-    { "varval", "Reverse VAR and VALUE (auto, right, wrong, status)",
-                                               env_varval,    1 },
-#endif
     { "help",  0,                              env_help,               0 },
     { "?",     "Print help information",       env_help,               0 },
     { .name = 0 },
@@ -1745,9 +1741,6 @@
        struct env_lst *ep;
 
        if (my_state_is_wont(TELOPT_NEW_ENVIRON)
-#ifdef OLD_ENVIRON
-           && my_state_is_wont(TELOPT_OLD_ENVIRON)
-#endif
                ) {
                fprintf(stderr,
                    "Cannot send '%s': Telnet ENVIRON option not enabled\n",
@@ -1807,43 +1800,6 @@
        return NULL;
 }
 
-#if defined(OLD_ENVIRON) && defined(ENV_HACK)
-void
-env_varval(const unsigned char *what)
-{
-       extern int old_env_var, old_env_value, env_auto;
-       int len = strlen(what);
-
-       if (len == 0)
-               goto unknown;
-
-       if (strncasecmp(what, "status", len) == 0) {
-               if (env_auto)
-                       printf("%s%s", "VAR and VALUE are/will be ",
-                                       "determined automatically\n");
-               if (old_env_var == OLD_ENV_VAR)
-                       printf("VAR and VALUE set to correct definitions\n");
-               else
-                       printf("VAR and VALUE definitions are reversed\n");
-       } else if (strncasecmp(what, "auto", len) == 0) {
-               env_auto = 1;
-               old_env_var = OLD_ENV_VALUE;
-               old_env_value = OLD_ENV_VAR;
-       } else if (strncasecmp(what, "right", len) == 0) {
-               env_auto = 0;
-               old_env_var = OLD_ENV_VAR;
-               old_env_value = OLD_ENV_VALUE;
-       } else if (strncasecmp(what, "wrong", len) == 0) {
-               env_auto = 0;
-               old_env_var = OLD_ENV_VALUE;
-               old_env_value = OLD_ENV_VAR;
-       } else {
-unknown:
-               printf("Unknown \"varval\" command. (\"auto\", \"right\", \"wrong\", \"status\")\n");
-       }
-}
-#endif
-
 #ifdef AUTHENTICATION
 /*
  * The AUTHENTICATE command.
diff -r fff8b2d9d6fe -r 8d5ebd66652f usr.bin/telnet/telnet.c
--- a/usr.bin/telnet/telnet.c   Sat Jan 05 06:30:05 2019 +0000
+++ b/usr.bin/telnet/telnet.c   Sat Jan 05 06:47:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: telnet.c,v 1.41 2018/12/14 23:40:17 christos Exp $     */
+/*     $NetBSD: telnet.c,v 1.42 2019/01/05 06:47:24 maya Exp $ */
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)telnet.c   8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: telnet.c,v 1.41 2018/12/14 23:40:17 christos Exp $");
+__RCSID("$NetBSD: telnet.c,v 1.42 2019/01/05 06:47:24 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -133,11 +133,7 @@
 #define        TS_SE           8               /* looking for sub-option end */
 
 static int     telrcv_state;
-#ifdef OLD_ENVIRON
-unsigned char telopt_environ = TELOPT_NEW_ENVIRON;
-#else
 # define telopt_environ TELOPT_NEW_ENVIRON
-#endif
 
 jmp_buf        toplevel = { 0 };
 
@@ -461,16 +457,6 @@
                break;
 
            case TELOPT_NEW_ENVIRON:    /* New environment variable option */
-#ifdef OLD_ENVIRON
-               if (my_state_is_will(TELOPT_OLD_ENVIRON))
-                       send_wont(TELOPT_OLD_ENVIRON, 1); /* turn off the old */
-               goto env_common;
-           case TELOPT_OLD_ENVIRON:    /* Old environment variable option */
-               if (my_state_is_will(TELOPT_NEW_ENVIRON))
-                       break;          /* Don't enable if new one is in use! */
-           env_common:
-               telopt_environ = option;
-#endif
                new_state_ok = 1;
                break;
 
@@ -546,16 +532,6 @@
            case TELOPT_LINEMODE:
                linemode = 0;   /* put us back to the default state */
                break;
-#ifdef OLD_ENVIRON
-           case TELOPT_NEW_ENVIRON:
-               /*
-                * The new environ option wasn't recognized, try
-                * the old one.
-                */
-               send_will(TELOPT_OLD_ENVIRON, 1);
-               telopt_environ = TELOPT_OLD_ENVIRON;
-               break;
-#endif
            }
            /* we always accept a DONT */
            set_my_want_state_wont(option);
@@ -893,9 +869,6 @@
        }
        break;
 
-#ifdef OLD_ENVIRON
-    case TELOPT_OLD_ENVIRON:
-#endif
     case TELOPT_NEW_ENVIRON:
        if (SB_EOF())
            return;
@@ -1434,26 +1407,6 @@
        return(need_update);
 }
 
-#ifdef OLD_ENVIRON
-# ifdef        ENV_HACK
-/*
- * Earlier version of telnet/telnetd from the BSD code had
- * the definitions of VALUE and VAR reversed.  To ensure
- * maximum interoperability, we assume that the server is
- * an older BSD server, until proven otherwise.  The newer
- * BSD servers should be able to handle either definition,
- * so it is better to use the wrong values if we don't
- * know what type of server it is.
- */
-int env_auto = 1;
-int old_env_var = OLD_ENV_VAR;
-int old_env_value = OLD_ENV_VALUE;
-# else
-#  define old_env_var OLD_ENV_VAR
-#  define old_env_value OLD_ENV_VALUE
-# endif
-#endif
-
 void
 env_opt(unsigned char *buf, int len)
 {
@@ -1467,27 +1420,7 @@
                        env_opt_add(NULL);
                } else for (i = 1; i < len; i++) {
                        switch (buf[i]&0xff) {
-#ifdef OLD_ENVIRON
-                       case OLD_ENV_VAR:
-# ifdef        ENV_HACK
-                               if (telopt_environ == TELOPT_OLD_ENVIRON
-                                   && env_auto) {
-                                       /* Server has the same definitions */
-                                       old_env_var = OLD_ENV_VAR;
-                                       old_env_value = OLD_ENV_VALUE;
-                               }
-                               /* FALL THROUGH */
-# endif
-                       case OLD_ENV_VALUE:
-                               /*
-                                * Although OLD_ENV_VALUE is not legal, we will
-                                * still recognize it, just in case it is an
-                                * old server that has VAR & VALUE mixed up...
-                                */
-                               /* FALL THROUGH */
-#else
                        case NEW_ENV_VAR:
-#endif
                        case ENV_USERVAR:
                                if (ep) {
                                        *epc = 0;
@@ -1601,11 +1534,6 @@
                opt_replyend = opt_reply + len;
        }
        if (opt_welldefined(ep))
-#ifdef OLD_ENVIRON
-               if (telopt_environ == TELOPT_OLD_ENVIRON)
-                       *opt_replyp++ = old_env_var;
-               else
-#endif
                        *opt_replyp++ = NEW_ENV_VAR;
        else
                *opt_replyp++ = ENV_USERVAR;
@@ -1625,11 +1553,6 @@
                        *opt_replyp++ = c;
                }
                if ((ep = vp) != NULL) {
-#ifdef OLD_ENVIRON
-                       if (telopt_environ == TELOPT_OLD_ENVIRON)
-                               *opt_replyp++ = old_env_value;
-                       else
-#endif
                                *opt_replyp++ = NEW_ENV_VALUE;
                        vp = NULL;
                } else
diff -r fff8b2d9d6fe -r 8d5ebd66652f usr.bin/telnet/utilities.c
--- a/usr.bin/telnet/utilities.c        Sat Jan 05 06:30:05 2019 +0000
+++ b/usr.bin/telnet/utilities.c        Sat Jan 05 06:47:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utilities.c,v 1.28 2018/12/14 23:40:17 christos Exp $  */
+/*     $NetBSD: utilities.c,v 1.29 2019/01/05 06:47:24 maya Exp $      */
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)utilities.c        8.3 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: utilities.c,v 1.28 2018/12/14 23:40:17 christos Exp $");
+__RCSID("$NetBSD: utilities.c,v 1.29 2019/01/05 06:47:24 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -750,12 +750,6 @@
 
        case TELOPT_NEW_ENVIRON:
            fprintf(NetTrace, "NEW-ENVIRON ");
-#ifdef OLD_ENVIRON
-           goto env_common1;
-       case TELOPT_OLD_ENVIRON:
-           fprintf(NetTrace, "OLD-ENVIRON");
-       env_common1:
-#endif
            switch (pointer[1]) {
            case TELQUAL_IS:
                fprintf(NetTrace, "IS ");
@@ -769,40 +763,15 @@
                {
                    static const char NQ[] = "\" ";
                    const char *noquote = NQ;
-#if defined(ENV_HACK) && defined(OLD_ENVIRON)
-                   extern int old_env_var, old_env_value;
-#endif
                    for (i = 2; i < length; i++ ) {
                        switch (pointer[i]) {
                        case NEW_ENV_VALUE:
-#ifdef OLD_ENVIRON
-                    /* case NEW_ENV_OVAR: */
-                           if (pointer[0] == TELOPT_OLD_ENVIRON) {
-# ifdef        ENV_HACK
-                               if (old_env_var == OLD_ENV_VALUE)
-                                   fprintf(NetTrace, "%s(VALUE) ", noquote);
-                               else
-# endif
-                                   fprintf(NetTrace, "%sVAR ", noquote);
-                           } else
-#endif /* OLD_ENVIRON */
-                               fprintf(NetTrace, "%sVALUE ", noquote);
+                           fprintf(NetTrace, "%sVALUE ", noquote);
                            noquote = NQ;
                            break;
 
                        case NEW_ENV_VAR:
-#ifdef OLD_ENVIRON
-                    /* case OLD_ENV_VALUE: */
-                           if (pointer[0] == TELOPT_OLD_ENVIRON) {
-# ifdef        ENV_HACK
-                               if (old_env_value == OLD_ENV_VAR)
-                                   fprintf(NetTrace, "%s(VAR) ", noquote);



Home | Main Index | Thread Index | Old Index