* Add forward command. [45]
authorSam Hartman <hartmans@mit.edu>
Sat, 2 Nov 1996 01:46:33 +0000 (01:46 +0000)
committerSam Hartman <hartmans@mit.edu>
Sat, 2 Nov 1996 01:46:33 +0000 (01:46 +0000)
* Add TOS support. [57]

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9281 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/telnet/telnet/ChangeLog
src/appl/telnet/telnet/commands.c
src/appl/telnet/telnet/main.c
src/appl/telnet/telnet/telnet.1

index 6f9c1ba939594b5368615afb1cf0ae2c0c446db9..af36a6cf79b3aa1d597b1f6e412822e0db45e661 100644 (file)
@@ -1,3 +1,15 @@
+Fri Nov  1 00:49:21 1996  Sam Hartman  <hartmans@mit.edu>
+
+       * main.c: Implement Type Of Service patch from jhawk. [57]
+
+Thu Oct 31 18:12:15 1996  Sam Hartman  <hartmans@mit.edu>
+
+       * main.c commands.c: Don't define OPTS_FORWARD* here; include
+       libtelnet/auth.h to get them.
+
+       * commands.c (forw_status): Integrate forward command from
+       jik@cam.ov.com [45]
+
 Mon Oct 14 02:22:16 1996  Sam Hartman  <hartmans@mit.edu>
 
        * commands.c (env_cmd): Print only' at correct times.  Patch from
index 196b3fe4beac98036169d3f2c55cd819951bfa98..740be8aa7f7eb89cea910c6963f96e6cae07b73c 100644 (file)
@@ -2124,6 +2124,117 @@ encrypt_cmd(argc, argv)
 }
 #endif /* ENCRYPTION */
 
+#if    defined(FORWARD)
+#include <libtelnet/auth.h>
+
+/*
+ * The FORWARD command.
+ */
+
+
+extern int forward_flags;
+
+struct forwlist {
+       char    *name;
+       char    *help;
+       int     (*handler)();
+       int     f_flags;
+};
+
+static int
+       forw_status P((void)),
+       forw_set P((int)),
+       forw_help P((void));
+
+struct forwlist ForwList[] = {
+    { "status",        "Display current status of credential forwarding",
+                                               forw_status,    0 },
+    { "disable", "Disable credential forwarding",
+                                               forw_set,       0 },
+    { "enable", "Enable credential forwarding",
+                                               forw_set,
+                                               OPTS_FORWARD_CREDS },
+    { "forwardable", "Enable credential forwarding of forwardable credentials",
+                                               forw_set,
+                                               OPTS_FORWARD_CREDS |
+                                               OPTS_FORWARDABLE_CREDS },
+    { "help",  0,                              forw_help,              0 },
+    { "?",     "Print help information",       forw_help,              0 },
+    { 0 },
+};
+
+    static int
+forw_status()
+{
+    if (forward_flags & OPTS_FORWARD_CREDS) {
+       if (forward_flags & OPTS_FORWARDABLE_CREDS) {
+           printf("Credential forwarding of forwardable credentials enabled\n");
+       } else {
+           printf("Credential forwarding enabled\n");
+       }
+    } else {
+       printf("Credential forwarding disabled\n");
+    }
+    return(0);
+}
+
+forw_set(f_flags)
+     int f_flags;
+{
+    forward_flags = f_flags;
+    return(0);
+}
+
+    static int
+forw_help()
+{
+    struct forwlist *c;
+
+    for (c = ForwList; c->name; c++) {
+       if (c->help) {
+           if (*c->help)
+               printf("%-15s %s\n", c->name, c->help);
+           else
+               printf("\n");
+       }
+    }
+    return 0;
+}
+
+forw_cmd(argc, argv)
+    int  argc;
+    char *argv[];
+{
+    struct forwlist *c;
+
+    if (argc < 2) {
+      fprintf(stderr,
+          "Need an argument to 'forward' command.  'forward ?' for help.\n");
+      return 0;
+    }
+
+    c = (struct forwlist *)
+               genget(argv[1], (char **) ForwList, sizeof(struct forwlist));
+    if (c == 0) {
+        fprintf(stderr, "'%s': unknown argument ('forw ?' for help).\n",
+                               argv[1]);
+        return 0;
+    }
+    if (Ambiguous(c)) {
+        fprintf(stderr, "'%s': ambiguous argument ('forw ?' for help).\n",
+                               argv[1]);
+        return 0;
+    }
+    if (argc != 2) {
+       fprintf(stderr,
+       "No arguments needed to 'forward %s' command.  'forward ?' for help.\n",
+               c->name);
+       return 0;
+    }
+    return((*c->handler)(c->f_flags));
+}
+#endif
+
 #if    defined(unix) && defined(TN3270)
     static void
 filestuff(fd)
@@ -2506,6 +2617,9 @@ static char
 #ifdef ENCRYPTION
        encrypthelp[] = "turn on (off) encryption ('encrypt ?' for more)",
 #endif /* ENCRYPTION */
+#ifdef  FORWARD
+       forwardhelp[] = "turn on (off) credential forwarding ('forward ?' for more)",
+#endif
 #if    defined(unix)
        zhelp[] =       "suspend telnet",
 #endif /* defined(unix) */
@@ -2537,6 +2651,9 @@ static Command cmdtab[] = {
 #ifdef ENCRYPTION
        { "encrypt",    encrypthelp,    encrypt_cmd,    0 },
 #endif /* ENCRYPTION */
+#ifdef  FORWARD
+       { "forward",    forwardhelp,    forw_cmd,       0 },
+#endif
 #if    defined(unix)
        { "z",          zhelp,          suspend,        0 },
 #endif /* defined(unix) */
index 89159e0fd43f94d7e267da2b78a576b37f945821..c87d9410cb14dba27446cfc29c9b7ee2ee9a648e 100644 (file)
@@ -40,15 +40,15 @@ char copyright[] =
 /* based on @(#)main.c 5.5 (Berkeley) 12/18/92 */
 
 #include <sys/types.h>
+#include <libtelnet/auth.h>
+
+
+# include <netinet/in.h>
 
 #include "ring.h"
 #include "externs.h"
 #include "defines.h"
 
-/* These values need to be the same as defined in libtelnet/kerberos5.c */
-/* Either define them in both places, or put in some common header file. */
-#define OPTS_FORWARD_CREDS           0x00000002
-#define OPTS_FORWARDABLE_CREDS       0x00000001
 
 #if 0
 #define FORWARD
@@ -160,7 +160,7 @@ main(argc, argv)
                        break;
                case 'S':
                    {
-#ifdef HAS_GETTOS
+#if defined(HAS_GETTOS) || (defined(IPPROTO_IP) && defined(IP_TOS))
                        extern int tos;
 
                        if ((tos = parsetos(optarg, "tcp")) < 0)
@@ -168,6 +168,8 @@ main(argc, argv)
                                        prompt, ": Bad TOS argument '",
                                        optarg,
                                        "; will try to use default TOS");
+
+                      fprintf(stderr, "Setting TOS to 0x%x\n", tos);
 #else
                        fprintf(stderr,
                           "%s: Warning: -S ignored, no parsetos() support.\n",
index 52367b7d85aeff965db2ca2aaa4d6104a25ed283..e354c2a1223dc8ec68d4afcd517e5cc74a0aab65 100644 (file)
@@ -82,7 +82,8 @@ be negotiated on output.
 Set the IP type-of-service (TOS) option for the telnet connection to the
 value
 .I tos,
-which can be a numeric TOS value or, on systems that support it, a
+which can be a numeric TOS value (in decimal, or a hex value preceded
+by 0x, or an octal value preceded by a leading 0) or, on systems that support it, a
 symbolic TOS name found in the /etc/iptos file.
 .TP
 \fB\-X\fP \fIatype\fP