]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
CHANGES: Add changes backported to 4.99
[tcpdump] / smbutil.c
index 97217a8d9fc6a8a4def9fbd160b9217e37cd2d92..fa5e133fa2a82e3767c203b3a477c06da98abca7 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -6,9 +6,7 @@
  * or later
  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -251,7 +249,7 @@ name_len(netdissect_options *ndo,
        s += GET_U_1(s) + 1;
        ND_TCHECK_1(s);
     }
-    return(ND_BYTES_BETWEEN(s, s0) + 1);
+    return(ND_BYTES_BETWEEN(s0, s) + 1);
 
 trunc:
     return(-1);        /* name goes past the end of the buffer */
@@ -334,7 +332,7 @@ write_bits(netdissect_options *ndo,
     u_int i = 0;
 
     while ((p = strchr(fmt, '|'))) {
-       u_int l = ND_BYTES_BETWEEN(p, fmt);
+       u_int l = ND_BYTES_BETWEEN(fmt, p);
        if (l && (val & (1 << i)))
            ND_PRINT("%.*s ", (int)l, fmt);
        fmt = p + 1;
@@ -493,7 +491,7 @@ smb_fdata1(netdissect_options *ndo,
            u_int l;
 
            p = strchr(++fmt, '}');
-           l = ND_BYTES_BETWEEN(p, fmt);
+           l = ND_BYTES_BETWEEN(fmt, p);
 
            if (l > sizeof(bitfmt) - 1)
                l = sizeof(bitfmt)-1;
@@ -742,8 +740,9 @@ smb_fdata1(netdissect_options *ndo,
 
            switch (t) {
            case 1:
-               name_type = name_extract(ndo, startbuf, ND_BYTES_BETWEEN(buf, startbuf),
-                   maxbuf, nbuf);
+               name_type = name_extract(ndo, startbuf,
+                                         ND_BYTES_BETWEEN(startbuf, buf),
+                                         maxbuf, nbuf);
                if (name_type < 0)
                    goto trunc;
                len = name_len(ndo, buf, maxbuf);
@@ -799,8 +798,8 @@ smb_fdata1(netdissect_options *ndo,
                break;
            }
            if (t != 0) {
-                   tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y",
-                   localtime(&t));
+               tstring = nd_format_time(buffer, sizeof(buffer), "%Y-%m-%d %T",
+                                        localtime(&t));
            } else
                tstring = "NULL";
            ND_PRINT("%s\n", tstring);
@@ -933,7 +932,7 @@ smb_fdata(netdissect_options *ndo,
        }
     }
     if (!depth && buf < maxbuf) {
-       u_int len = ND_BYTES_BETWEEN(maxbuf, buf);
+       u_int len = ND_BYTES_BETWEEN(buf, maxbuf);
        ND_PRINT("Data: (%u bytes)\n", len);
        smb_data_print(ndo, buf, len);
        return(buf + len);