]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-smb.c
Compile with '-Wsign-compare' in devel mode if supported
[tcpdump] / print-smb.c
index aa4732d6acd42b596b7a95507b49bbb015134d53..d8e66f13eb4a707a91d0bf5bec642a5a873bcdda 100644 (file)
@@ -20,7 +20,6 @@
 #include "extract.h"
 #include "smb.h"
 
-static const char tstr[] = "[|SMB]";
 
 static int request = 0;
 static int unicodestr = 0;
@@ -142,7 +141,7 @@ trans2_qfsinfo(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 static const struct smbfnsint trans2_fns[] = {
@@ -236,7 +235,7 @@ print_trans2(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 static void
@@ -317,7 +316,7 @@ print_browse(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 
@@ -392,7 +391,7 @@ print_trans(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 
@@ -435,7 +434,7 @@ print_negprot(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 static void
@@ -480,7 +479,7 @@ print_sesssetup(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 static void
@@ -521,7 +520,7 @@ print_lockingandx(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 
@@ -835,7 +834,7 @@ print_smb(netdissect_options *ndo,
     smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr);
 
     if (nterrcodes) {
-       nterror = EXTRACT_LE_U_4(buf + 5);
+       nterror = EXTRACT_LE_U_4(buf + 5);
        if (nterror)
            ND_PRINT("NTError = %s\n", nt_errstr(nterror));
     } else {
@@ -923,7 +922,7 @@ print_smb(netdissect_options *ndo,
     ND_PRINT("\n");
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 
@@ -939,6 +938,7 @@ nbt_tcp_print(netdissect_options *ndo,
     u_int nbt_len;
     const u_char *maxbuf;
 
+    ndo->ndo_protocol = "nbt_tcp";
     if (length < 4)
        goto trunc;
     if (ndo->ndo_snapend < data)
@@ -1088,7 +1088,7 @@ nbt_tcp_print(netdissect_options *ndo,
     }
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 static const struct tok opcode_str[] = {
@@ -1115,6 +1115,7 @@ nbt_udp137_print(netdissect_options *ndo,
     const u_char *p;
     u_int total, i;
 
+    ndo->ndo_protocol = "nbt_udp137";
     ND_TCHECK_2(data + 10);
     name_trn_id = EXTRACT_BE_U_2(data);
     response = (EXTRACT_U_1(data + 2) >> 7);
@@ -1241,7 +1242,7 @@ out:
     ND_PRINT("\n");
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 /*
@@ -1255,6 +1256,7 @@ smb_tcp_print(netdissect_options *ndo,
     u_int smb_len;
     const u_char *maxbuf;
 
+    ndo->ndo_protocol = "smb_tcp";
     if (length < 4)
        goto trunc;
     if (ndo->ndo_snapend < data)
@@ -1284,7 +1286,7 @@ smb_tcp_print(netdissect_options *ndo,
        ND_PRINT(" SMB-over-TCP packet:(raw data or continuation?)\n");
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 /*
@@ -1296,6 +1298,7 @@ nbt_udp138_print(netdissect_options *ndo,
 {
     const u_char *maxbuf = data + length;
 
+    ndo->ndo_protocol = "nbt_udp138";
     if (maxbuf > ndo->ndo_snapend)
        maxbuf = ndo->ndo_snapend;
     if (maxbuf <= data)
@@ -1392,6 +1395,7 @@ netbeui_print(netdissect_options *ndo,
     const u_char *data2;
     int is_truncated = 0;
 
+    ndo->ndo_protocol = "netbeui";
     if (maxbuf > ndo->ndo_snapend)
        maxbuf = ndo->ndo_snapend;
     ND_TCHECK_1(data + 4);
@@ -1473,7 +1477,7 @@ out:
     ND_PRINT("\n");
     return;
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 
@@ -1491,6 +1495,7 @@ ipx_netbios_print(netdissect_options *ndo,
     u_int i;
     const u_char *maxbuf;
 
+    ndo->ndo_protocol = "ipx_netbios";
     maxbuf = data + length;
     /* Don't go past the end of the captured data in the packet. */
     if (maxbuf > ndo->ndo_snapend)