X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/546558eabd81cfc36a81a4df728fdfea0d83b41a..10dd76aef1d2b2b6563bc0f3ef066c76461c84d0:/print-smb.c diff --git a/print-smb.c b/print-smb.c index 49d51091..6592c5eb 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; @@ -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); } @@ -349,7 +348,7 @@ print_trans(netdissect_options *ndo, param = buf + EXTRACT_LE_U_2(w + 10 * 2); datalen = EXTRACT_LE_U_2(w + 11 * 2); data = buf + EXTRACT_LE_U_2(w + 12 * 2); - f1 = "TotParamCnt=[u] \nTotDataCnt=[u] \nMaxParmCnt=[u] \nMaxDataCnt=[u]\nMaxSCnt=[u] \nTransFlags=[w] \nRes1=[w] \nRes2=[w] \nRes3=[w]\nParamCnt=[u] \nParamOff=[u] \nDataCnt=[u] \nDataOff=[u] \nSUCnt=[u]\n"; + f1 = "TotParamCnt=[u]\nTotDataCnt=[u]\nMaxParmCnt=[u]\nMaxDataCnt=[u]\nMaxSCnt=[u]\nTransFlags=[w]\nRes1=[w]\nRes2=[w]\nRes3=[w]\nParamCnt=[u]\nParamOff=[u]\nDataCnt=[u]\nDataOff=[u]\nSUCnt=[u]\n"; f2 = "|Name=[S]\n"; f3 = "|Param "; f4 = "|Data "; @@ -359,7 +358,7 @@ print_trans(netdissect_options *ndo, param = buf + EXTRACT_LE_U_2(w + 4 * 2); datalen = EXTRACT_LE_U_2(w + 6 * 2); data = buf + EXTRACT_LE_U_2(w + 7 * 2); - f1 = "TotParamCnt=[u] \nTotDataCnt=[u] \nRes1=[u]\nParamCnt=[u] \nParamOff=[u] \nRes2=[u] \nDataCnt=[u] \nDataOff=[u] \nRes3=[u]\nLsetup=[u]\n"; + f1 = "TotParamCnt=[u]\nTotDataCnt=[u]\nRes1=[u]\nParamCnt=[u]\nParamOff=[u]\nRes2=[u]\nDataCnt=[u]\nDataOff=[u]\nRes3=[u]\nLsetup=[u]\n"; f2 = "|Unknown "; f3 = "|Param "; f4 = "|Data "; @@ -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); } @@ -1089,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[] = { @@ -1200,7 +1199,7 @@ nbt_udp137_print(netdissect_options *ndo, p = smb_fdata(ndo, p, "NumNames=[B]\n", p + 1, 0); if (p == NULL) goto out; - while (numnames--) { + while (numnames) { p = smb_fdata(ndo, p, "Name=[n2]\t#", maxbuf, 0); if (p == NULL) goto out; @@ -1225,6 +1224,7 @@ nbt_udp137_print(netdissect_options *ndo, ND_PRINT(" "); ND_PRINT("\n"); p += 2; + numnames--; } } else { if (p >= maxbuf) @@ -1243,7 +1243,7 @@ out: ND_PRINT("\n"); return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); } /* @@ -1287,7 +1287,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); } /* @@ -1478,7 +1478,7 @@ out: ND_PRINT("\n"); return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); }