This commit was manufactured by cvs2svn to create tag
[krb5.git] / src / appl / telnet / telnet / utilities.c
index c40fccc6ee5084eedcf6b23c4412531b4278f161..82ad8417821ff0db70c55f20d13c5ecac93af1d8 100644 (file)
@@ -31,9 +31,7 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)utilities.c        8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
+/* based on @(#)utilities.c    8.1 (Berkeley) 6/6/93 */
 
 #define        TELOPTS
 #define        TELCMDS
@@ -115,13 +113,15 @@ SetNetTrace(file)
     if (file  && (strcmp(file, "-") != 0)) {
        NetTrace = fopen(file, "w");
        if (NetTrace) {
-           strcpy((char *)NetTraceFile, file);
+           strncpy((char *)NetTraceFile, file, sizeof(NetTraceFile) - 1);
+           NetTraceFile[sizeof(NetTraceFile) - 1] = '\0';
            return;
        }
        fprintf(stderr, "Cannot open %s.\n", file);
     }
     NetTrace = stdout;
-    strcpy((char *)NetTraceFile, "(standard output)");
+    strncpy((char *)NetTraceFile, "(standard output)", sizeof(NetTraceFile) - 1);
+    NetTraceFile[sizeof(NetTraceFile) - 1] = '\0';
 }
 
     void
@@ -134,7 +134,6 @@ Dump(direction, buffer, length)
 #   define min(x,y)    ((x<y)? x:y)
     unsigned char *pThis;
     int offset;
-    extern pettydump;
 
     offset = 0;
 
@@ -439,12 +438,13 @@ printsub(direction, pointer, length)
                    fprintf(NetTrace, "(partial suboption??\?)");
                    break;
                }
-               fprintf(NetTrace, "%s|%s",
+               fprintf(NetTrace, "%s|%s%s",
                        ((pointer[3] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT) ?
                        "CLIENT" : "SERVER",
                        ((pointer[3] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) ?
-                       "MUTUAL" : "ONE-WAY");
-
+                       "MUTUAL" : "ONE-WAY",
+                       ((pointer[3] & AUTH_ENCRYPT_MASK) == AUTH_ENCRYPT_ON) ?
+                       "|ENCRYPT" : "");
                auth_printsub(&pointer[1], length - 1, buf, sizeof(buf));
                fprintf(NetTrace, "%s", buf);
                break;
@@ -461,11 +461,13 @@ printsub(direction, pointer, length)
                        fprintf(NetTrace, "(partial suboption??\?)");
                        break;
                    }
-                   fprintf(NetTrace, "%s|%s ",
+                   fprintf(NetTrace, "%s|%s%s ",
                        ((pointer[i] & AUTH_WHO_MASK) == AUTH_WHO_CLIENT) ?
                                                        "CLIENT" : "SERVER",
                        ((pointer[i] & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) ?
-                                                       "MUTUAL" : "ONE-WAY");
+                                                       "MUTUAL" : "ONE-WAY",
+                       ((pointer[i] & AUTH_ENCRYPT_MASK) == AUTH_ENCRYPT_ON) ?
+                                                       "|ENCRYPT" : "");
                    ++i;
                }
                break;
@@ -819,7 +821,6 @@ printsub(direction, pointer, length)
                            break;
 
                        default:
-                       def_case:
                            if (isprint(pointer[i]) && pointer[i] != '"') {
                                if (noquote) {
                                    putc('"', NetTrace);