From: Sam Hartman Date: Sat, 2 Nov 1996 01:46:33 +0000 (+0000) Subject: * Add forward command. [45] X-Git-Tag: krb5-1.0-freeze1~141 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=24a98c372f16702fdfa61af7ea9bf7436ee298b9;p=krb5.git * Add forward command. [45] * Add TOS support. [57] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9281 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/telnet/telnet/ChangeLog b/src/appl/telnet/telnet/ChangeLog index 6f9c1ba93..af36a6cf7 100644 --- a/src/appl/telnet/telnet/ChangeLog +++ b/src/appl/telnet/telnet/ChangeLog @@ -1,3 +1,15 @@ +Fri Nov 1 00:49:21 1996 Sam Hartman + + * main.c: Implement Type Of Service patch from jhawk. [57] + +Thu Oct 31 18:12:15 1996 Sam Hartman + + * 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 * commands.c (env_cmd): Print only' at correct times. Patch from diff --git a/src/appl/telnet/telnet/commands.c b/src/appl/telnet/telnet/commands.c index 196b3fe4b..740be8aa7 100644 --- a/src/appl/telnet/telnet/commands.c +++ b/src/appl/telnet/telnet/commands.c @@ -2124,6 +2124,117 @@ encrypt_cmd(argc, argv) } #endif /* ENCRYPTION */ +#if defined(FORWARD) +#include + +/* + * 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) */ diff --git a/src/appl/telnet/telnet/main.c b/src/appl/telnet/telnet/main.c index 89159e0fd..c87d9410c 100644 --- a/src/appl/telnet/telnet/main.c +++ b/src/appl/telnet/telnet/main.c @@ -40,15 +40,15 @@ char copyright[] = /* based on @(#)main.c 5.5 (Berkeley) 12/18/92 */ #include +#include + + +# include #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", diff --git a/src/appl/telnet/telnet/telnet.1 b/src/appl/telnet/telnet/telnet.1 index 52367b7d8..e354c2a12 100644 --- a/src/appl/telnet/telnet/telnet.1 +++ b/src/appl/telnet/telnet/telnet.1 @@ -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