]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: SCLogDebug is real nop when built as release 6197/head
authorPhilippe Antoine <contact@catenacyber.fr>
Thu, 6 May 2021 11:30:49 +0000 (13:30 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 14 Jun 2021 19:22:32 +0000 (21:22 +0200)
Before, even if there were no outputs, all the arguments
were evaluated, which could turn expensive

All variables which are used only in certain build configurations
are now prefixed by underscore to avoid warnings

13 files changed:
rust/src/dcerpc/parser.rs
rust/src/filetracker.rs
rust/src/ftp/mod.rs
rust/src/ike/ikev2.rs
rust/src/log.rs
rust/src/nfs/nfs.rs
rust/src/nfs/nfs4.rs
rust/src/smb/dcerpc.rs
rust/src/smb/smb1.rs
rust/src/smb/smb2.rs
rust/src/smb/smb2_ioctl.rs
rust/src/snmp/snmp.rs
rust/src/ssh/ssh.rs

index e3f40ff3d9a4fb8b951eb71fb3cf864e000b0299..9771a28be0cb117f8adebf0a544003191e8beb10 100644 (file)
@@ -102,22 +102,22 @@ named!(pub parse_dcerpc_udp_header<DCERPCHdrUdp>,
                 serial_hi: serial_hi,
                 objectuuid: match parse_uuid(objectuuid) {
                     Ok((_, vect)) => assemble_uuid(vect),
-                    Err(e) => {
-                        SCLogDebug!("{}", e);
+                    Err(_e) => {
+                        SCLogDebug!("{}", _e);
                         vec![0]
                     },
                 },
                 interfaceuuid: match parse_uuid(interfaceuuid) {
                     Ok((_, vect)) => assemble_uuid(vect),
-                    Err(e) => {
-                        SCLogDebug!("{}", e);
+                    Err(_e) => {
+                        SCLogDebug!("{}", _e);
                         vec![0]
                     },
                 },
                 activityuuid: match parse_uuid(activityuuid){
                     Ok((_, vect)) => assemble_uuid(vect),
-                    Err(e) => {
-                        SCLogDebug!("{}", e);
+                    Err(_e) => {
+                        SCLogDebug!("{}", _e);
                         vec![0]
                     },
                 },
index 2a9bbf0dada22381ba6e6b348066f555d1edbd84..d820dd8aa4fd5ba8668a8ede590d9620b970de98 100644 (file)
@@ -111,10 +111,10 @@ impl FileTransferTracker {
         self.file_is_truncated = true;
     }
 
-    pub fn create(&mut self, name: &[u8], file_size: u64) {
+    pub fn create(&mut self, _name: &[u8], _file_size: u64) {
         if self.file_open == true { panic!("close existing file first"); }
 
-        SCLogDebug!("CREATE: name {:?} file_size {}", name, file_size);
+        SCLogDebug!("CREATE: name {:?} file_size {}", _name, _file_size);
     }
 
     pub fn new_chunk(&mut self, config: &'static SuricataFileContext,
@@ -245,7 +245,7 @@ impl FileTransferTracker {
 
                     if self.chunk_is_ooo == false {
                         loop {
-                            let offset = self.tracked;
+                            let _offset = self.tracked;
                             match self.chunks.remove(&self.tracked) {
                                 Some(c) => {
                                     let res = files.file_append(&self.track_id, &c.chunk, c.contains_gap);
@@ -263,10 +263,10 @@ impl FileTransferTracker {
                                     self.tracked += c.chunk.len() as u64;
                                     self.cur_ooo -= c.chunk.len() as u64;
 
-                                    SCLogDebug!("STORED OOO CHUNK at offset {}, tracked now {}, stored len {}", offset, self.tracked, c.chunk.len());
+                                    SCLogDebug!("STORED OOO CHUNK at offset {}, tracked now {}, stored len {}", _offset, self.tracked, c.chunk.len());
                                 },
                                 _ => {
-                                    SCLogDebug!("NO STORED CHUNK found at offset {}", self.tracked);
+                                    SCLogDebug!("NO STORED CHUNK found at _offset {}", self.tracked);
                                     break;
                                 },
                             };
index 81ccab73bde126203552cefee866f07f39f8d93d..53c3df7d764c0898512af5f0f6ffd65fcde82e8f 100644 (file)
@@ -101,11 +101,9 @@ pub extern "C" fn rs_ftp_pasv_response(input: *const u8, len: u32) -> u16 {
             return dport;
         },
         Err(nom::Err::Incomplete(_)) => {
-            let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
             SCLogDebug!("pasv incomplete: '{:?}'", String::from_utf8_lossy(buf));
         },
         Err(_) => {
-            let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
             SCLogDebug!("pasv error on '{:?}'", String::from_utf8_lossy(buf));
         },
     }
@@ -166,11 +164,9 @@ pub extern "C" fn rs_ftp_epsv_response(input: *const u8, len: u32) -> u16 {
             return dport;
         },
         Err(nom::Err::Incomplete(_)) => {
-            let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
             SCLogDebug!("epsv incomplete: '{:?}'", String::from_utf8_lossy(buf));
         },
         Err(_) => {
-            let buf = unsafe{std::slice::from_raw_parts(input, len as usize)};
             SCLogDebug!("epsv incomplete: '{:?}'", String::from_utf8_lossy(buf));
         },
 
index 8f97c26b117bebd6801c6400dd3bf65b76235f71..53e7072c245c1439e5d5a29e7c461d6ef79ddc9f 100644 (file)
@@ -149,8 +149,8 @@ pub fn handle_ikev2(
                             state.ikev2_container.dh_group = kex.dh_group;
                         }
                     }
-                    IkeV2PayloadContent::Nonce(ref n) => {
-                        SCLogDebug!("Nonce: {:?}", n);
+                    IkeV2PayloadContent::Nonce(ref _n) => {
+                        SCLogDebug!("Nonce: {:?}", _n);
                     }
                     IkeV2PayloadContent::Notify(ref n) => {
                         SCLogDebug!("Notify: {:?}", n);
@@ -207,8 +207,8 @@ pub fn handle_ikev2(
                 }
             }
         }
-        e => {
-            SCLogDebug!("parse_ikev2_payload_with_type: {:?}", e);
+        _e => {
+            SCLogDebug!("parse_ikev2_payload_with_type: {:?}", _e);
             ()
         }
     }
@@ -285,8 +285,8 @@ fn add_proposals(state: &mut IKEState, prop: &Vec<IkeV2Proposal>, direction: u8)
                     }
                     _ => (),
                 },
-                IkeV2Transform::Unknown(tx_type, tx_id) => {
-                    SCLogDebug!("Unknown proposal: type={:?}, id={}", tx_type, tx_id);
+                IkeV2Transform::Unknown(_tx_type, _tx_id) => {
+                    SCLogDebug!("Unknown proposal: type={:?}, id={}", _tx_type, _tx_id);
                     state.set_event(IkeEvent::UnknownProposal);
                 }
                 _ => (),
index 3dcd91ef0182e77b69042048e1e10576d04fb5ad..b61c6cddaf2adcbd9ec1e206bfd9c32c2ded9c0d 100644 (file)
@@ -167,8 +167,7 @@ macro_rules!SCLogDebug {
 #[cfg(not(feature = "debug"))]
 #[macro_export]
 macro_rules!SCLogDebug {
-    ($last:expr) => { let _ = &$last; let _ = $crate::log::Level::Debug; };
-    ($one:expr, $($arg:tt)*) => { let _ = &$one; SCLogDebug!($($arg)*); };
+    ($($arg:tt)*) => ()
 }
 
 /// SCLogMessage wrapper. If the Suricata C context is not registered
index 32d227775532e1e68cc5d46065d63968e4e03eb7..1dfa08bee95dc230245ecbb169d4a5752e371abb 100644 (file)
@@ -1017,9 +1017,9 @@ impl NFSState {
         if self.ts_gap {
             SCLogDebug!("TS trying to catch up after GAP (input {})", cur_i.len());
 
-            let mut cnt = 0;
+            let mut _cnt = 0;
             while cur_i.len() > 0 {
-                cnt += 1;
+                _cnt += 1;
                 match nfs_probe(cur_i, STREAM_TOSERVER) {
                     1 => {
                         SCLogDebug!("expected data found");
@@ -1028,13 +1028,13 @@ impl NFSState {
                     },
                     0 => {
                         SCLogDebug!("incomplete, queue and retry with the next block (input {}). Looped {} times.",
-                                cur_i.len(), cnt);
+                                cur_i.len(), _cnt);
                         return AppLayerResult::incomplete((i.len() - cur_i.len()) as u32, (cur_i.len() + 1) as u32);
                     },
                     -1 => {
                         cur_i = &cur_i[1..];
                         if cur_i.len() == 0 {
-                            SCLogDebug!("all post-GAP data in this chunk was bad. Looped {} times.", cnt);
+                            SCLogDebug!("all post-GAP data in this chunk was bad. Looped {} times.", _cnt);
                         }
                     },
                     _ => {
@@ -1170,9 +1170,9 @@ impl NFSState {
         if self.tc_gap {
             SCLogDebug!("TC trying to catch up after GAP (input {})", cur_i.len());
 
-            let mut cnt = 0;
+            let mut _cnt = 0;
             while cur_i.len() > 0 {
-                cnt += 1;
+                _cnt += 1;
                 match nfs_probe(cur_i, STREAM_TOCLIENT) {
                     1 => {
                         SCLogDebug!("expected data found");
@@ -1181,13 +1181,13 @@ impl NFSState {
                     },
                     0 => {
                         SCLogDebug!("incomplete, queue and retry with the next block (input {}). Looped {} times.",
-                                cur_i.len(), cnt);
+                                cur_i.len(), _cnt);
                         return AppLayerResult::incomplete((i.len() - cur_i.len()) as u32, (cur_i.len() + 1) as u32);
                     },
                     -1 => {
                         cur_i = &cur_i[1..];
                         if cur_i.len() == 0 {
-                            SCLogDebug!("all post-GAP data in this chunk was bad. Looped {} times.", cnt);
+                            SCLogDebug!("all post-GAP data in this chunk was bad. Looped {} times.", _cnt);
                         }
                     },
                     _ => {
index eb6620b3d562054243ed3de8980de0ca2e0f47bd..51d78800e3a77c6acbe5994f90ff454090da24a3 100644 (file)
@@ -186,8 +186,8 @@ impl NFSState {
                         self.commit_v4(r, fh);
                     }
                 }
-                &Nfs4RequestContent::Close(ref rd) => {
-                    SCLogDebug!("CLOSEv4: {:?}", rd);
+                &Nfs4RequestContent::Close(ref _rd) => {
+                    SCLogDebug!("CLOSEv4: {:?}", _rd);
                 }
                 &Nfs4RequestContent::Create(ref rd) => {
                     SCLogDebug!("CREATEv4: {:?}", rd);
@@ -202,11 +202,11 @@ impl NFSState {
                     xidmap.file_name = rd.to_vec();
                     main_opcode = NFSPROC4_REMOVE;
                 }
-                &Nfs4RequestContent::SetClientId(ref rd) => {
+                &Nfs4RequestContent::SetClientId(ref _rd) => {
                     SCLogDebug!("SETCLIENTIDv4: client id {} r_netid {} r_addr {}",
-                            String::from_utf8_lossy(&rd.client_id),
-                            String::from_utf8_lossy(&rd.r_netid),
-                            String::from_utf8_lossy(&rd.r_addr));
+                            String::from_utf8_lossy(&_rd.client_id),
+                            String::from_utf8_lossy(&_rd.r_netid),
+                            String::from_utf8_lossy(&_rd.r_addr));
                 }
                 &_ => { },
             }
@@ -291,13 +291,13 @@ impl NFSState {
         for c in &cr.commands {
             SCLogDebug!("c {:?}", c);
             match c {
-                &Nfs4ResponseContent::ReadDir(s, ref rd) => {
+                &Nfs4ResponseContent::ReadDir(_s, ref rd) => {
                     if let &Some(ref rd) = rd {
-                        SCLogDebug!("READDIRv4: status {} eof {}", s, rd.eof);
+                        SCLogDebug!("READDIRv4: status {} eof {}", _s, rd.eof);
 
                         for d in &rd.listing {
-                            if let &Some(ref d) = d {
-                                SCLogDebug!("READDIRv4: dir {}", String::from_utf8_lossy(&d.name));
+                            if let &Some(ref _d) = d {
+                                SCLogDebug!("READDIRv4: dir {}", String::from_utf8_lossy(&_d.name));
                             }
                         }
 
@@ -329,9 +329,9 @@ impl NFSState {
                         self.process_read_record(r, &reply, Some(&xidmap));
                     }
                 },
-                &Nfs4ResponseContent::Open(s, ref rd) => {
-                    if let &Some(ref rd) = rd {
-                        SCLogDebug!("OPENv4: status {} opendata {:?}", s, rd);
+                &Nfs4ResponseContent::Open(_s, ref rd) => {
+                    if let &Some(ref _rd) = rd {
+                        SCLogDebug!("OPENv4: status {} opendata {:?}", _s, _rd);
                         insert_filename_with_getfh = true;
                     }
                 },
index 5b7907806caa808e28b5e2348ac6b2b5f8586eb3..9d44b39944c7d31a7fc3d2354a756e232119fb07 100644 (file)
@@ -273,10 +273,10 @@ pub fn smb_write_dcerpc_record<'b>(state: &mut SMBState,
                                         i.iface.to_vec()
                                     };
                                     let uuid_str = uuid::Uuid::from_slice(&x.clone());
-                                    let uuid_str = uuid_str.map(|uuid_str| uuid_str.to_hyphenated().to_string()).unwrap();
+                                    let _uuid_str = uuid_str.map(|uuid_str| uuid_str.to_hyphenated().to_string()).unwrap();
                                     let d = DCERPCIface::new(x,i.ver,i.ver_min);
                                     SCLogDebug!("UUID {} version {}/{} bytes {:?}",
-                                            uuid_str,
+                                            _uuid_str,
                                             i.ver, i.ver_min,i.iface);
                                     ifaces.push(d);
                                 }
index 7a00b739ce446805777dfa7199d04f6790d2755c..58f6aded77ab4f3dc429fb5388ab46eeed7cd5ba 100644 (file)
@@ -251,14 +251,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                                             true
 
                                         },
-                                        Err(nom::Err::Incomplete(n)) => {
-                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION INCOMPLETE {:?}", n);
+                                        Err(nom::Err::Incomplete(_n)) => {
+                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION INCOMPLETE {:?}", _n);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
-                                        Err(nom::Err::Error(e)) |
-                                        Err(nom::Err::Failure(e)) => {
-                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", e);
+                                        Err(nom::Err::Error(_e)) |
+                                        Err(nom::Err::Failure(_e)) => {
+                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", _e);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
@@ -279,14 +279,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                                             tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TRANS2);
                                             true
                                         },
-                                        Err(nom::Err::Incomplete(n)) => {
-                                            SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME INCOMPLETE {:?}", n);
+                                        Err(nom::Err::Incomplete(_n)) => {
+                                            SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME INCOMPLETE {:?}", _n);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
-                                        Err(nom::Err::Error(e)) |
-                                        Err(nom::Err::Failure(e)) => {
-                                            SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME ERROR {:?}", e);
+                                        Err(nom::Err::Error(_e)) |
+                                        Err(nom::Err::Failure(_e)) => {
+                                            SCLogDebug!("TRANS2 SET_PATH_INFO DATA RENAME ERROR {:?}", _e);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
@@ -295,14 +295,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                                     false
                                 }
                             },
-                            Err(nom::Err::Incomplete(n)) => {
-                                SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS INCOMPLETE {:?}", n);
+                            Err(nom::Err::Incomplete(_n)) => {
+                                SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS INCOMPLETE {:?}", _n);
                                 events.push(SMBEvent::MalformedData);
                                 false
                             },
-                            Err(nom::Err::Error(e)) |
-                            Err(nom::Err::Failure(e)) => {
-                                SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS ERROR {:?}", e);
+                            Err(nom::Err::Error(_e)) |
+                            Err(nom::Err::Failure(_e)) => {
+                                SCLogDebug!("TRANS2 SET_PATH_INFO PARAMS ERROR {:?}", _e);
                                 events.push(SMBEvent::MalformedData);
                                 false
                             },
@@ -334,14 +334,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                                             true
 
                                         },
-                                        Err(nom::Err::Incomplete(n)) => {
-                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION INCOMPLETE {:?}", n);
+                                        Err(nom::Err::Incomplete(_n)) => {
+                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION INCOMPLETE {:?}", _n);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
-                                        Err(nom::Err::Error(e)) |
-                                        Err(nom::Err::Failure(e)) => {
-                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", e);
+                                        Err(nom::Err::Error(_e)) |
+                                        Err(nom::Err::Failure(_e)) => {
+                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA DISPOSITION ERROR {:?}", _e);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
@@ -367,14 +367,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                                             tx.vercmd.set_smb1_cmd(SMB1_COMMAND_TRANS2);
                                             true
                                         },
-                                        Err(nom::Err::Incomplete(n)) => {
-                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME INCOMPLETE {:?}", n);
+                                        Err(nom::Err::Incomplete(_n)) => {
+                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME INCOMPLETE {:?}", _n);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
-                                        Err(nom::Err::Error(e)) |
-                                        Err(nom::Err::Failure(e)) => {
-                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME ERROR {:?}", e);
+                                        Err(nom::Err::Error(_e)) |
+                                        Err(nom::Err::Failure(_e)) => {
+                                            SCLogDebug!("TRANS2 SET_FILE_INFO DATA RENAME ERROR {:?}", _e);
                                             events.push(SMBEvent::MalformedData);
                                             false
                                         },
@@ -383,14 +383,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                                     false
                                 }
                             },
-                            Err(nom::Err::Incomplete(n)) => {
-                                SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS INCOMPLETE {:?}", n);
+                            Err(nom::Err::Incomplete(_n)) => {
+                                SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS INCOMPLETE {:?}", _n);
                                 events.push(SMBEvent::MalformedData);
                                 false
                             },
-                            Err(nom::Err::Error(e)) |
-                            Err(nom::Err::Failure(e)) => {
-                                SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS ERROR {:?}", e);
+                            Err(nom::Err::Error(_e)) |
+                            Err(nom::Err::Failure(_e)) => {
+                                SCLogDebug!("TRANS2 SET_FILE_INFO PARAMS ERROR {:?}", _e);
                                 events.push(SMBEvent::MalformedData);
                                 false
                             },
@@ -399,14 +399,14 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
                         false
                     }
                 },
-                Err(nom::Err::Incomplete(n)) => {
-                    SCLogDebug!("TRANS2 INCOMPLETE {:?}", n);
+                Err(nom::Err::Incomplete(_n)) => {
+                    SCLogDebug!("TRANS2 INCOMPLETE {:?}", _n);
                     events.push(SMBEvent::MalformedData);
                     false
                 },
-                Err(nom::Err::Error(e)) |
-                Err(nom::Err::Failure(e)) => {
-                    SCLogDebug!("TRANS2 ERROR {:?}", e);
+                Err(nom::Err::Error(_e)) |
+                Err(nom::Err::Failure(_e)) => {
+                    SCLogDebug!("TRANS2 ERROR {:?}", _e);
                     events.push(SMBEvent::MalformedData);
                     false
                 },
@@ -883,11 +883,11 @@ pub fn smb1_trans_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>)
                 let mut frankenfid = pipe.fid.to_vec();
                 frankenfid.extend_from_slice(&u32_as_bytes(r.ssn_id));
 
-                let (filename, is_dcerpc) = match state.get_service_for_guid(&frankenfid) {
+                let (_filename, is_dcerpc) = match state.get_service_for_guid(&frankenfid) {
                     (n, x) => (n, x),
                 };
                 SCLogDebug!("smb1_trans_request_record: name {} is_dcerpc {}",
-                        filename, is_dcerpc);
+                        _filename, is_dcerpc);
                 pipe_dcerpc = is_dcerpc;
             }
 
@@ -924,11 +924,11 @@ pub fn smb1_trans_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>)
             let mut frankenfid = fid.to_vec();
             frankenfid.extend_from_slice(&u32_as_bytes(r.ssn_id));
 
-            let (filename, is_dcerpc) = match state.get_service_for_guid(&frankenfid) {
+            let (_filename, is_dcerpc) = match state.get_service_for_guid(&frankenfid) {
                 (n, x) => (n, x),
             };
             SCLogDebug!("smb1_trans_response_record: name {} is_dcerpc {}",
-                    filename, is_dcerpc);
+                    _filename, is_dcerpc);
 
             // if we get status 'BUFFER_OVERFLOW' this is only a part of
             // the data. Store it in the ssn/tree for later use.
index fcf968e82389e241f8e7de868b98d5cbeab03d3b..c25cf0cca696b7bdcb0dd75db91a76d3085a29d8 100644 (file)
@@ -579,20 +579,20 @@ pub fn smb2_response_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
             if r.nt_status == SMB_NTSTATUS_SUCCESS {
                 match parse_smb2_response_write(r.data)
                 {
-                    Ok((_, wr)) => {
-                        SCLogDebug!("SMBv2: Write response => {:?}", wr);
+                    Ok((_, _wr)) => {
+                        SCLogDebug!("SMBv2: Write response => {:?}", _wr);
 
                         /* search key-guid map */
                         let guid_key = SMBCommonHdr::new(SMBHDR_TYPE_GUID,
                                 r.session_id, r.tree_id, r.message_id);
-                        let guid_vec = match state.ssn2vec_map.remove(&guid_key) {
+                        let _guid_vec = match state.ssn2vec_map.remove(&guid_key) {
                             Some(p) => p,
                             None => {
                                 SCLogDebug!("SMBv2 response: GUID NOT FOUND");
                                 Vec::new()
                             },
                         };
-                        SCLogDebug!("SMBv2 write response for GUID {:?}", guid_vec);
+                        SCLogDebug!("SMBv2 write response for GUID {:?}", _guid_vec);
                     }
                     _ => {
                         events.push(SMBEvent::MalformedData);
index 091d90708b1252e19e151c8559acd93ea03d8a09..22e6de03950dc3c801b53c51a3ec24c3298506c7 100644 (file)
@@ -20,6 +20,7 @@ use crate::smb::smb2::*;
 use crate::smb::smb2_records::*;
 use crate::smb::dcerpc::*;
 use crate::smb::events::*;
+#[cfg(feature = "debug")]
 use crate::smb::funcs::*;
 
 #[derive(Debug)]
index 20136838f2647f89befe0c648695b4a93887378f..88715ccb8122098db525694b5ec7cb12d99d776c 100644 (file)
@@ -195,8 +195,8 @@ impl<'a> SNMPState<'a> {
             Ok((_rem,SnmpGenericMessage::V1(msg))) |
             Ok((_rem,SnmpGenericMessage::V2(msg))) => self.handle_snmp_v12(msg, direction),
             Ok((_rem,SnmpGenericMessage::V3(msg))) => self.handle_snmp_v3(msg, direction),
-            Err(e) => {
-                SCLogDebug!("parse_snmp failed: {:?}", e);
+            Err(_e) => {
+                SCLogDebug!("parse_snmp failed: {:?}", _e);
                 self.set_event(SNMPEvent::MalformedData);
                 -1
             },
index 5330853465b0fc13e17a680d858f943bcac87714..196e18e7e517cc3bc55cb914b859accd47a35502 100644 (file)
@@ -256,15 +256,15 @@ impl SSHState {
                                 panic!("SSH invalid length record header");
                             }
                         }
-                        Err(e) => {
-                            SCLogDebug!("SSH invalid record header {}", e);
+                        Err(_e) => {
+                            SCLogDebug!("SSH invalid record header {}", _e);
                             self.set_event(SSHEvent::InvalidRecord);
                             return AppLayerResult::err();
                         }
                     }
                 }
-                Err(e) => {
-                    SCLogDebug!("SSH invalid record {}", e);
+                Err(_e) => {
+                    SCLogDebug!("SSH invalid record {}", _e);
                     self.set_event(SSHEvent::InvalidRecord);
                     return AppLayerResult::err();
                 }
@@ -294,8 +294,8 @@ impl SSHState {
                 Err(nom::Err::Incomplete(_)) => {
                     return AppLayerResult::incomplete(0 as u32, (input.len() + 1) as u32);
                 }
-                Err(e) => {
-                    SCLogDebug!("SSH invalid banner {}", e);
+                Err(_e) => {
+                    SCLogDebug!("SSH invalid banner {}", _e);
                     self.set_event(SSHEvent::InvalidBanner);
                     return AppLayerResult::err();
                 }
@@ -353,8 +353,8 @@ impl SSHState {
                     }
                 }
             }
-            Err(e) => {
-                SCLogDebug!("SSH invalid banner {}", e);
+            Err(_e) => {
+                SCLogDebug!("SSH invalid banner {}", _e);
                 self.set_event(SSHEvent::InvalidBanner);
                 return AppLayerResult::err();
             }