}
#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)
#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) */
#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) */
/* 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
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)
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",