X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fb2479d733dbe8a991d11909b319341f7db62ab1..0446070756e8f61c29d4c41f4adab08b3bf9d830:/print-smb.c diff --git a/print-smb.c b/print-smb.c index ed721910..d8e66f13 100644 --- a/print-smb.c +++ b/print-smb.c @@ -20,7 +20,6 @@ #include "extract.h" #include "smb.h" -static const char tstr[] = "[|SMB]"; static int request = 0; static int unicodestr = 0; @@ -103,7 +102,7 @@ trans2_findfirst(netdissect_options *ndo, smb_fdata(ndo, param, fmt, param + pcnt, unicodestr); if (dcnt) { ND_PRINT("data:\n"); - smb_print_data(ndo, data, dcnt); + smb_data_print(ndo, data, dcnt); } } @@ -138,11 +137,11 @@ trans2_qfsinfo(netdissect_options *ndo, } if (dcnt) { ND_PRINT("data:\n"); - smb_print_data(ndo, data, dcnt); + smb_data_print(ndo, data, dcnt); } 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); } @@ -420,7 +419,7 @@ print_negprot(netdissect_options *ndo, smb_fdata(ndo, words + 1, f1, min(words + 1 + wct * 2, maxbuf), unicodestr); else - smb_print_data(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); + smb_data_print(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); ND_TCHECK_2(data); bcc = EXTRACT_LE_U_2(data); @@ -430,12 +429,12 @@ print_negprot(netdissect_options *ndo, smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), maxbuf), unicodestr); else - smb_print_data(ndo, data + 2, + smb_data_print(ndo, data + 2, min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); } static void @@ -465,7 +464,7 @@ print_sesssetup(netdissect_options *ndo, smb_fdata(ndo, words + 1, f1, min(words + 1 + wct * 2, maxbuf), unicodestr); else - smb_print_data(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); + smb_data_print(ndo, words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1))); ND_TCHECK_2(data); bcc = EXTRACT_LE_U_2(data); @@ -475,12 +474,12 @@ print_sesssetup(netdissect_options *ndo, smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), maxbuf), unicodestr); else - smb_print_data(ndo, data + 2, + smb_data_print(ndo, data + 2, min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); } static void @@ -516,12 +515,12 @@ print_lockingandx(netdissect_options *ndo, smb_fdata(ndo, data + 2, f2, min(data + 2 + EXTRACT_LE_U_2(data), maxbuf), unicodestr); else - smb_print_data(ndo, data + 2, + smb_data_print(ndo, data + 2, min(EXTRACT_LE_U_2(data), PTR_DIFF(maxbuf, data + 2))); } 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 { @@ -893,7 +892,7 @@ print_smb(netdissect_options *ndo, } else { if (bcc > 0) { ND_PRINT("smb_buf[]=\n"); - smb_print_data(ndo, data + 2, min(bcc, PTR_DIFF(maxbuf, data + 2))); + smb_data_print(ndo, data + 2, min(bcc, PTR_DIFF(maxbuf, data + 2))); } } } @@ -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); @@ -1227,7 +1228,7 @@ nbt_udp137_print(netdissect_options *ndo, } else { if (p >= maxbuf) goto out; - smb_print_data(ndo, p, min(rdlen, length - (p - data))); + smb_data_print(ndo, p, min(rdlen, length - (p - data))); p += rdlen; } } @@ -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)