towards Kerberized telnet
authorKevin Fall <kfall@ucbvax.Berkeley.EDU>
Thu, 21 Jun 1990 07:44:40 +0000 (23:44 -0800)
committerKevin Fall <kfall@ucbvax.Berkeley.EDU>
Thu, 21 Jun 1990 07:44:40 +0000 (23:44 -0800)
SCCS-vsn: usr.bin/telnet/telnet.c 5.49
SCCS-vsn: usr.bin/telnet/utilities.c 1.18
SCCS-vsn: usr.bin/telnet/Makefile 5.2

usr/src/usr.bin/telnet/Makefile
usr/src/usr.bin/telnet/telnet.c
usr/src/usr.bin/telnet/utilities.c

index 8df3ead..0329e53 100644 (file)
@@ -1,4 +1,4 @@
-#      @(#)Makefile    5.1 (Berkeley) %G%
+#      @(#)Makefile    5.2 (Berkeley) %G%
 #
 # TERMCAP      Define this if your system is termcap based,
 #              otherwise a terminfo based system is assumed.
 #
 # TERMCAP      Define this if your system is termcap based,
 #              otherwise a terminfo based system is assumed.
@@ -23,7 +23,9 @@
 #
 PROG=  telnet
 CFLAGS+=-DTERMCAP -DSRCRT -DKLUDGELINEMODE -DUSE_TERMIO
 #
 PROG=  telnet
 CFLAGS+=-DTERMCAP -DSRCRT -DKLUDGELINEMODE -DUSE_TERMIO
+#CFLAGS+=-DTERMCAP -DSRCRT -DKLUDGELINEMODE -DUSE_TERMIO -DKERBEROS
 LDADD= -ltermcap
 LDADD= -ltermcap
+#LDADD=        -ltermcap -ldes -lkrb
 DPADD= ${LIBTERMCAP}
 
 SRCS=  commands.c main.c network.c ring.c sys_bsd.c telnet.c terminal.c \
 DPADD= ${LIBTERMCAP}
 
 SRCS=  commands.c main.c network.c ring.c sys_bsd.c telnet.c terminal.c \
index 3b8a01d..8f28869 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)telnet.c   5.48 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnet.c   5.49 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -806,6 +806,7 @@ suboption()
     case TELOPT_AUTHENTICATION:
        if ((subbuffer[1] & 0xff) == TELQUAL_SEND) {
                register char *cp = &subbuffer[2];
     case TELOPT_AUTHENTICATION:
        if ((subbuffer[1] & 0xff) == TELQUAL_SEND) {
                register char *cp = &subbuffer[2];
+               char tmp[256];
                int dokrb4 = 0, unknowntypes = 0, noresponse = 1;
 
                while (cp < subend) {
                int dokrb4 = 0, unknowntypes = 0, noresponse = 1;
 
                while (cp < subend) {
@@ -852,7 +853,7 @@ suboption()
                                if (*ucp == IAC)
                                        space++;
                        }
                                if (*ucp == IAC)
                                        space++;
                        }
-                       if (NETROOM() < 6 + 1 + strlen(remotename) + 2 +
+                       if (NETROOM() < 6 + 1 + 2 +
                            space + 2) {
                                fprintf(stderr,
                                   "no room to send V4 ticket/authenticator\n");
                            space + 2) {
                                fprintf(stderr,
                                   "no room to send V4 ticket/authenticator\n");
@@ -868,29 +869,23 @@ cantsend4:
                                exit(1);
                        } else {
 #ifdef notdef
                                exit(1);
                        } else {
 #ifdef notdef
-                   printring(&netoring, "%c%c%c%c%c%c%c%s", IAC, SB,
+                   printring(&netoring, "%c%c%c%c%c%c", IAC, SB,
                              TELOPT_AUTHENTICATION,
                              TELQUAL_IS, TELQUAL_AUTHTYPE_KERBEROS,
                              TELOPT_AUTHENTICATION,
                              TELQUAL_IS, TELQUAL_AUTHTYPE_KERBEROS,
-                             TELQUAL_AUTHTYPE_KERBEROS_V4,
-                             strlen(remotename),
-                             remotename);
-                   sprintf(tmp, "%c%c%c%c%s%c%c", TELOPT_AUTHENTICATION,
+                             TELQUAL_AUTHTYPE_KERBEROS_V4);
+                   sprintf(tmp, "%c%c%c%c%c%c", TELOPT_AUTHENTICATION,
                            TELQUAL_IS, TELQUAL_AUTHTYPE_KERBEROS,
                            TELQUAL_IS, TELQUAL_AUTHTYPE_KERBEROS,
-                           TELQUAL_AUTHTYPE_KERBEROS_V4,
-                           remotename, IAC, SE);
+                           TELQUAL_AUTHTYPE_KERBEROS_V4, IAC, SE);
 #else
 #else
-                           printring(&netoring, "%c%c%c%c%c%c%s", IAC, SB,
+                           printring(&netoring, "%c%c%c%c%c", IAC, SB,
                              TELOPT_AUTHENTICATION,
                              TELQUAL_IS,
                              TELOPT_AUTHENTICATION,
                              TELQUAL_IS,
-                             TELQUAL_AUTHTYPE_KERBEROS_V4,
-                             strlen(remotename),
-                             remotename);
-                           sprintf(tmp, "%c%c%c%s%c%c", TELOPT_AUTHENTICATION,
+                             TELQUAL_AUTHTYPE_KERBEROS_V4);
+                           sprintf(tmp, "%c%c%c%c%c", TELOPT_AUTHENTICATION,
                              TELQUAL_IS,
                              TELQUAL_IS,
-                             TELQUAL_AUTHTYPE_KERBEROS_V4,
-                             remotename, IAC, SE);
+                             TELQUAL_AUTHTYPE_KERBEROS_V4, IAC, SE);
 #endif
 #endif
-                           printsub(">", tmp, 4+strlen(remotename)+2-2-2);
+                           printsub(">", tmp, 4+2-2-2);
                            ring_supply_bindata(&netoring,
                                (char *)authent_st.dat, authent_st.length, IAC);
                            printring(&netoring, "%c%c", IAC, SE);
                            ring_supply_bindata(&netoring,
                                (char *)authent_st.dat, authent_st.length, IAC);
                            printring(&netoring, "%c%c", IAC, SE);
index 52d8bb7..8f4e0f5 100644 (file)
@@ -2,11 +2,23 @@
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms are permitted
+ * provided that: (1) source distributions retain this entire copyright
+ * notice and comment, and (2) distributions including binaries display
+ * the following acknowledgement:  ``This product includes software
+ * developed by the University of California, Berkeley and its contributors''
+ * in the documentation or other materials provided with the distribution
+ * and in all advertising materials mentioning features or use of this
+ * software. Neither the name of the University nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)utilities.c        1.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)utilities.c        1.17 (Berkeley) 6/1/90";
 #endif /* not lint */
 
 #define        TELOPTS
 #endif /* not lint */
 
 #define        TELOPTS
@@ -251,6 +263,12 @@ optionstatus()
 
 char *slcnames[] = { SLC_NAMES };
 
 
 char *slcnames[] = { SLC_NAMES };
 
+#ifdef KERBEROS
+static char *authtypes[3] = { "NONE", "PRIVATE", "KERBEROS" };
+#else
+static char *authtypes[2] = { "NONE", "PRIVATE" };
+#endif
+
 void
 printsub(direction, pointer, length)
 char   direction;              /* '<' or '>' */
 void
 printsub(direction, pointer, length)
 char   direction;              /* '<' or '>' */
@@ -372,6 +390,51 @@ int        length;                 /* length of suboption data */
                fprintf(NetTrace, " ?%d?", pointer[i]);
            break;
 
                fprintf(NetTrace, " ?%d?", pointer[i]);
            break;
 
+#ifdef KERBEROS
+       case TELOPT_AUTHENTICATION:
+           fprintf(NetTrace, "Authentication information ");
+           switch (pointer[1]) {
+           case TELQUAL_IS:
+               switch (pointer[2]) {
+               case TELQUAL_AUTHTYPE_NONE:
+               case TELQUAL_AUTHTYPE_PRIVATE:
+               case TELQUAL_AUTHTYPE_KERBEROS:
+
+                       fprintf(NetTrace, "is type %s\r\n", authtypes[pointer[2]]);
+                       break;
+               default:
+                       fprintf(NetTrace, "is type unknown\r\n");
+                       break;
+               }
+
+           case TELQUAL_SEND:
+           {
+               int     idx = 2;
+               fprintf(NetTrace, "- request to send, types");
+               for (idx = 2; idx < length - 1; idx++)
+                       switch (pointer[idx]) {
+                       case TELQUAL_AUTHTYPE_NONE:
+                       case TELQUAL_AUTHTYPE_PRIVATE:
+                       case TELQUAL_AUTHTYPE_KERBEROS:
+                               fprintf(NetTrace, " %s",
+                                       authtypes[pointer[idx]]);
+                                       break;
+                       default:
+                               fprintf(NetTrace, " <unknown %u>",
+                                       pointer[idx]);
+                               break;
+                       }
+               fprintf(NetTrace, "\r\n");
+           }
+               break;
+
+           default:
+               fprintf(NetTrace, " - unknown qualifier %d (0x%x).\r\n",
+                       pointer[1], pointer[1]);
+           }
+           break;
+#endif /* KERBEROS */
+
        case TELOPT_LINEMODE:
            fprintf(NetTrace, "LINEMODE ");
            if (length < 2) {
        case TELOPT_LINEMODE:
            fprintf(NetTrace, "LINEMODE ");
            if (length < 2) {