- TCHECK2(*data, 2);
- bcc = EXTRACT_LE_16BITS(data);
- printf("smb_bcc=%u\n", bcc);
- if (f2)
- smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data), maxbuf));
- else
- print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
- return;
-trunc:
- printf("[|SMB]");
- return;
+static void
+print_lockingandx(netdissect_options *ndo,
+ const u_char *words, const u_char *data, const u_char *buf _U_, const u_char *maxbuf)
+{
+ u_int wct, bcc;
+ const u_char *maxwords;
+ const char *f1 = NULL, *f2 = NULL;
+
+ wct = GET_U_1(words);
+ if (request) {
+ f1 = "Com2=[w]\nOff2=[u]\nHandle=[u]\nLockType=[w]\nTimeOut=[D]\nUnlockCount=[u]\nLockCount=[u]\n";
+ if (GET_U_1(words + 7) & 0x10)
+ f2 = "*Process=[u]\n[P2]Offset=[M]\nLength=[M]\n";
+ else
+ f2 = "*Process=[u]\nOffset=[D]\nLength=[U]\n";
+ } else {
+ f1 = "Com2=[w]\nOff2=[u]\n";
+ }
+
+ maxwords = ND_MIN(words + 1 + wct * 2, maxbuf);
+ if (wct)
+ smb_fdata(ndo, words + 1, f1, maxwords, unicodestr);
+
+ bcc = GET_LE_U_2(data);
+ ND_PRINT("smb_bcc=%u\n", bcc);
+ if (bcc > 0) {
+ if (f2)
+ smb_fdata(ndo, data + 2, f2, ND_MIN(data + 2 + GET_LE_U_2(data),
+ maxbuf), unicodestr);
+ else
+ smb_data_print(ndo, data + 2,
+ ND_MIN(GET_LE_U_2(data), ND_BYTES_BETWEEN(data + 2, maxbuf)));
+ }