Ethereal-dev: [Ethereal-dev] patch for smbtrans2 findfirst info level 2 (EA's)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jim McDonough <jmcd@xxxxxxxxxx>
Date: Wed, 23 Apr 2003 17:13:03 -0400


The following patch fixes smb transact2 findfirst decoding of info level
2's (including EA sizes, requested by os2 clients).  The name length in the
response doesn't include the NULL terminator.  The code was already in
there to account for this, but after the name was already displayed, so it
was too late.  This patch just moves it to do the same as for the info
level 1 (same info minus EA size).

Index: packet-smb.c
===================================================================
RCS file: /cvsroot/ethereal/packet-smb.c,v
retrieving revision 1.332
diff -u -r1.332 packet-smb.c
--- packet-smb.c  20 Apr 2003 11:36:15 -0000    1.332
+++ packet-smb.c  23 Apr 2003 21:07:24 -0000
@@ -11852,6 +11852,10 @@
      fn_len = tvb_get_guint8(tvb, offset);
      proto_tree_add_uint(tree, hf_smb_file_name_len, tvb, offset, 1,
fn_len);
      COUNT_BYTES_SUBR(1);
+     if (si->unicode)
+           fn_len += 2;      /* include terminating '\0' */
+     else
+           fn_len++;   /* include terminating '\0' */

      /* file name */
      fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len,
FALSE, TRUE, bcp);
@@ -11859,10 +11863,6 @@
      proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len,
            fn);
      COUNT_BYTES_SUBR(fn_len);
-     if (si->unicode)
-           fn_len += 2;      /* include terminating '\0' */
-     else
-           fn_len++;   /* include terminating '\0' */

      if (check_col(pinfo->cinfo, COL_INFO)) {
            col_append_fstr(pinfo->cinfo, COL_INFO, " %s",

----------------------------
Jim McDonough
IBM Linux Technology Center
Samba Team
6 Minuteman Drive
Scarborough, ME 04074
USA

jmcd@xxxxxxxxxx
jmcd@xxxxxxxxx

Phone: (207) 885-5565
IBM tie-line: 776-9984