]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-smb.c
More UNALIGNED_MEM{CPY,CMP} on IP addresses.
[tcpdump] / print-smb.c
index 68c73659f84f0627a25f589f5ec507b578a5c7f7..32edd196d261152dabff6f9340110d0e7cedcd7c 100644 (file)
 #include "config.h"
 #endif
 
-#ifndef lint
-static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.47 2007-12-09 00:30:47 guy Exp $";
-#endif
-
 #include <tcpdump-stdinc.h>
 
 #include <stdio.h>
@@ -24,6 +19,8 @@ static const char rcsid[] _U_ =
 #include "extract.h"
 #include "smb.h"
 
+static const char tstr[] = "[|SMB]";
+
 static int request = 0;
 static int unicodestr = 0;
 
@@ -65,8 +62,8 @@ struct smbfnsint
 
 #define FLG_CHAIN      (1 << 0)
 
-static struct smbfns *
-smbfind(int id, struct smbfns *list)
+static const struct smbfns *
+smbfind(int id, const struct smbfns *list)
 {
     int sindex;
 
@@ -77,8 +74,8 @@ smbfind(int id, struct smbfns *list)
     return(&list[0]);
 }
 
-static struct smbfnsint *
-smbfindint(int id, struct smbfnsint *list)
+static const struct smbfnsint *
+smbfindint(int id, const struct smbfnsint *list)
 {
     int sindex;
 
@@ -140,11 +137,11 @@ trans2_qfsinfo(const u_char *param, const u_char *data, int pcnt, int dcnt)
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
-struct smbfnsint trans2_fns[] = {
+static const struct smbfnsint trans2_fns[] = {
     { 0, "TRANSACT2_OPEN", 0,
        { "Flags2=[w]\nMode=[w]\nSearchAttrib=[A]\nAttrib=[A]\nTime=[T2]\nOFun=[w]\nSize=[D]\nRes=([w, w, w, w, w])\nPath=[S]",
          NULL,
@@ -173,7 +170,7 @@ static void
 print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_char *maxbuf)
 {
     u_int bcc;
-    static struct smbfnsint *fn = &trans2_fns[0];
+    static const struct smbfnsint *fn = &trans2_fns[0];
     const u_char *data, *param;
     const u_char *w = words + 1;
     const char *f1 = NULL, *f2 = NULL;
@@ -234,7 +231,7 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -316,7 +313,7 @@ print_browse(const u_char *param, int paramlen, const u_char *data, int datalen)
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -389,7 +386,7 @@ print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -431,7 +428,7 @@ print_negprot(const u_char *words, const u_char *data, const u_char *buf _U_, co
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -475,7 +472,7 @@ print_sesssetup(const u_char *words, const u_char *data, const u_char *buf _U_,
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -515,12 +512,12 @@ print_lockingandx(const u_char *words, const u_char *data, const u_char *buf _U_
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
 
-static struct smbfns smb_fns[] = {
+static const struct smbfns smb_fns[] = {
     { -1, "SMBunknown", 0, DEFDESCRIPT },
 
     { SMBtcon, "SMBtcon", 0,
@@ -799,7 +796,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
     int command;
     u_int32_t nterror;
     const u_char *words, *maxwords, *data;
-    struct smbfns *fn;
+    const struct smbfns *fn;
     const char *fmt_smbheader =
         "[P4]SMB Command   =  [B]\nError class   =  [BP1]\nError code    =  [d]\nFlags1        =  [B]\nFlags2        =  [B][P13]\nTree ID       =  [d]\nProc ID       =  [d]\nUID           =  [d]\nMID           =  [d]\nWord Count    =  [b]\n";
     int smboffset;
@@ -898,7 +895,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
        if (command == 0xFF)
            break;
        TCHECK2(words[3], 2);
-       newsmboffset = EXTRACT_LE_16BITS(words + 3); 
+       newsmboffset = EXTRACT_LE_16BITS(words + 3);
 
        fn = smbfind(command, smb_fns);
 
@@ -914,7 +911,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
     printf("\n");
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -1078,7 +1075,7 @@ nbt_tcp_print(const u_char *data, int length)
     }
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -1240,7 +1237,7 @@ out:
     fflush(stdout);
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -1282,7 +1279,7 @@ smb_tcp_print (const u_char * data, int length)
        printf("SMB-over-TCP packet:(raw data or continuation?)\n");
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }
 
@@ -1471,7 +1468,7 @@ out:
     printf("\n");
     return;
 trunc:
-    printf("[|SMB]");
+    printf("%s", tstr);
     return;
 }