]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
log2pcaphex: Fix nonempty line endings
authorVolker Lendecke <vl@samba.org>
Sun, 18 Aug 2013 17:19:14 +0000 (17:19 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 18 Aug 2013 23:08:13 +0000 (11:08 +1200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/utils/log2pcaphex.c

index 0b1230efe7992b58a86c1c585cfd493e4258d2a2..8425a5e71de4d9b9a9200a49371a38253356b830 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    Utility to extract pcap files from samba (log level 10) log files
 
@@ -154,7 +154,6 @@ static void print_hex_packet(FILE *out, unsigned char *data, long length)
                for(i = cur; i < length && i < cur + 16; i++) {
                        fprintf(out, "%02x ", data[i]);
                }
-       
                cur = i;
                fprintf(out, "\n");
        }
@@ -162,10 +161,10 @@ static void print_hex_packet(FILE *out, unsigned char *data, long length)
 
 static void print_netbios_packet(FILE *out, unsigned char *data, long length,
                                 long actual_length)
-{      
+{
        unsigned char *newdata; long offset = 0;
        long newlen;
-       
+
        newlen = length+sizeof(HDR_IP)+sizeof(HDR_TCP);
        newdata = (unsigned char *)malloc(newlen);
 
@@ -176,7 +175,7 @@ static void print_netbios_packet(FILE *out, unsigned char *data, long length,
        memcpy(newdata+offset, &HDR_IP, sizeof(HDR_IP));offset+=sizeof(HDR_IP);
        memcpy(newdata+offset, &HDR_TCP, sizeof(HDR_TCP));offset+=sizeof(HDR_TCP);
        memcpy(newdata+offset,data,length);
-       
+
        print_pcap_packet(out, newdata, newlen, actual_length+offset);
        free(newdata);
 }
@@ -312,12 +311,12 @@ int main (int argc, char **argv)
                { "hex", 'h', POPT_ARG_NONE, &hexformat, 0, "Output format readable by text2pcap" },
                POPT_TABLEEND
        };
-       
+
        pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
                            POPT_CONTEXT_KEEP_FIRST);
        poptSetOtherOptionHelp(pc, "[<infile> [<outfile>]]");
-       
-       
+
+
        while((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt) {
                }
@@ -334,13 +333,13 @@ int main (int argc, char **argv)
                        return 1;
                }
        } else in = stdin;
-       
+
        outfile = poptGetArg(pc);
 
        if(outfile) {
                out = fopen(outfile, "w+");
-               if(!out) { 
-                       perror("fopen"); 
+               if(!out) {
+                       perror("fopen");
                        fprintf(stderr, "Can't find %s, using stdout...\n", outfile);
                        return 1;
                }
@@ -359,15 +358,15 @@ int main (int argc, char **argv)
                                read_log_msg(in, &curpacket, &curpacket_len, &data_offset, &data_length);
                        } else if(in_packet && strstr(buffer, "dump_data")) {
                                data_bytes_read = read_log_data(in, curpacket+data_offset, data_length);
-                       }  else { 
-                               if(in_packet){ 
-                                       if(hexformat) print_hex_packet(out, curpacket, curpacket_len); 
+                       }  else {
+                               if(in_packet){
+                                       if(hexformat) print_hex_packet(out, curpacket, curpacket_len);
                                        else print_netbios_packet(out, curpacket, curpacket_len, data_bytes_read+data_offset);
-                                       free(curpacket); 
+                                       free(curpacket);
                                }
                                in_packet = 0;
                        }
-               } 
+               }
        }
 
        if (in != stdin) {