]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: remove explicit lifetimes where not needed
authorJason Ish <jason.ish@oisf.net>
Thu, 26 Jan 2023 17:26:18 +0000 (11:26 -0600)
committerVictor Julien <vjulien@oisf.net>
Thu, 26 Jan 2023 21:02:54 +0000 (22:02 +0100)
rust/src/ike/parser.rs
rust/src/nfs/nfs.rs
rust/src/nfs/nfs2.rs
rust/src/nfs/nfs3.rs
rust/src/nfs/nfs4.rs
rust/src/smb/dcerpc.rs
rust/src/smb/smb.rs
rust/src/smb/smb1.rs
rust/src/smb/smb1_records.rs
rust/src/smb/smb2.rs
rust/src/smb/smb2_ioctl.rs

index 6947696df1b6d904d0cb6b556066caae554821fc..dcc57453429018e44a94750ca4fb0c13e43be6a1 100644 (file)
@@ -537,8 +537,8 @@ impl fmt::Display for IsakmpPayloadType {
     }
 }
 
-pub fn parse_payload<'a>(
-    payload_type: u8, data: &'a [u8], data_length: u16, domain_of_interpretation: &mut Option<u32>,
+pub fn parse_payload(
+    payload_type: u8, data: &[u8], data_length: u16, domain_of_interpretation: &mut Option<u32>,
     key_exchange: &mut Vec<u8>, nonce: &mut Vec<u8>, transforms: &mut Vec<Vec<SaAttribute>>,
     vendor_ids: &mut Vec<String>, payload_types: &mut HashSet<u8>,
 ) -> Result<(), ()> {
@@ -611,8 +611,8 @@ pub fn parse_payload<'a>(
     }
 }
 
-fn parse_proposal_payload<'a>(
-    data: &'a [u8], data_length: u16, domain_of_interpretation: &mut Option<u32>,
+fn parse_proposal_payload(
+    data: &[u8], data_length: u16, domain_of_interpretation: &mut Option<u32>,
     key_exchange: &mut Vec<u8>, nonce: &mut Vec<u8>, transforms: &mut Vec<Vec<SaAttribute>>,
     vendor_ids: &mut Vec<String>, payload_types: &mut HashSet<u8>,
 ) -> Result<(), ()> {
@@ -658,8 +658,8 @@ fn parse_proposal_payload<'a>(
     }
 }
 
-fn parse_security_association_payload<'a>(
-    data: &'a [u8], data_length: u16, domain_of_interpretation: &mut Option<u32>,
+fn parse_security_association_payload(
+    data: &[u8], data_length: u16, domain_of_interpretation: &mut Option<u32>,
     key_exchange: &mut Vec<u8>, nonce: &mut Vec<u8>, transforms: &mut Vec<Vec<SaAttribute>>,
     vendor_ids: &mut Vec<String>, payload_types: &mut HashSet<u8>,
 ) -> Result<(), ()> {
index 475b7b7be124358cf7db66d0f31ef5a84747fee6..c396b122b1ae29fd45ad9bc6102e5006df0c5f83 100644 (file)
@@ -672,7 +672,7 @@ impl NFSState {
         }
     }
 
-    pub fn process_request_record_lookup<'b>(&mut self, r: &RpcPacket<'b>, xidmap: &mut NFSRequestXidMap) {
+    pub fn process_request_record_lookup(&mut self, r: &RpcPacket, xidmap: &mut NFSRequestXidMap) {
         match parse_nfs3_request_lookup(r.prog_data) {
             Ok((_, lookup)) => {
                 SCLogDebug!("LOOKUP {:?}", lookup);
@@ -698,7 +698,7 @@ impl NFSState {
     }
 
     /// complete request record
-    fn process_request_record<'b>(&mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcPacket<'b>) {
+    fn process_request_record(&mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcPacket) {
         SCLogDebug!("REQUEST {} procedure {} ({}) blob size {}",
                 r.hdr.xid, r.procedure, self.requestmap.len(), r.prog_data.len());
 
@@ -845,7 +845,7 @@ impl NFSState {
         return self.process_write_record(r, w);
     }
 
-    fn process_reply_record<'b>(&mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcReplyPacket<'b>) -> u32 {
+    fn process_reply_record(&mut self, flow: *const Flow, stream_slice: &StreamSlice, r: &RpcReplyPacket) -> u32 {
         let mut xidmap;
         match self.requestmap.remove(&r.hdr.xid) {
             Some(p) => { xidmap = p; },
index 506638a740c104948dcb6426a41769ab7f2869b7..f8000b4892a42de5dfa59b1a75370b833f958275 100644 (file)
@@ -27,7 +27,7 @@ use nom7::number::streaming::be_u32;
 
 impl NFSState {
     /// complete request record
-    pub fn process_request_record_v2<'b>(&mut self, r: &RpcPacket<'b>) {
+    pub fn process_request_record_v2(&mut self, r: &RpcPacket) {
         SCLogDebug!("NFSv2: REQUEST {} procedure {} ({}) blob size {}",
                 r.hdr.xid, r.procedure, self.requestmap.len(), r.prog_data.len());
 
@@ -92,7 +92,7 @@ impl NFSState {
         self.requestmap.insert(r.hdr.xid, xidmap);
     }
 
-    pub fn process_reply_record_v2<'b>(&mut self, r: &RpcReplyPacket<'b>, xidmap: &NFSRequestXidMap) {
+    pub fn process_reply_record_v2(&mut self, r: &RpcReplyPacket, xidmap: &NFSRequestXidMap) {
         let mut nfs_status = 0;
         let resp_handle = Vec::new();
 
index 0de27d59650e2712f6f0bd7caf8be445975a78ee..032751f536ca819426ab27443f665df619789db5 100644 (file)
@@ -29,7 +29,7 @@ use nom7::number::streaming::be_u32;
 
 impl NFSState {
     /// complete NFS3 request record
-    pub fn process_request_record_v3<'b>(&mut self, r: &RpcPacket<'b>) {
+    pub fn process_request_record_v3(&mut self, r: &RpcPacket) {
         SCLogDebug!("REQUEST {} procedure {} ({}) blob size {}",
                 r.hdr.xid, r.procedure, self.requestmap.len(), r.prog_data.len());
 
@@ -186,7 +186,7 @@ impl NFSState {
         self.requestmap.insert(r.hdr.xid, xidmap);
     }
 
-    pub fn process_reply_record_v3<'b>(&mut self, r: &RpcReplyPacket<'b>, xidmap: &mut NFSRequestXidMap) {
+    pub fn process_reply_record_v3(&mut self, r: &RpcReplyPacket, xidmap: &mut NFSRequestXidMap) {
         let mut nfs_status = 0;
         let mut resp_handle = Vec::new();
 
index 717fa2eff61f0f5659e1e91522f0af487d15c7f6..b07c35de6924ab75a17a3267608260581c4b5eba 100644 (file)
@@ -124,8 +124,8 @@ impl NFSState {
         }
     }
 
-    fn new_tx_v4<'b>(
-        &mut self, r: &RpcPacket<'b>, xidmap: &NFSRequestXidMap, procedure: u32,
+    fn new_tx_v4(
+        &mut self, r: &RpcPacket, xidmap: &NFSRequestXidMap, procedure: u32,
         _aux_opcodes: &[u32],
     ) {
         let mut tx = self.new_tx();
@@ -238,7 +238,7 @@ impl NFSState {
     }
 
     /// complete request record
-    pub fn process_request_record_v4<'b>(&mut self, r: &RpcPacket<'b>) {
+    pub fn process_request_record_v4(&mut self, r: &RpcPacket) {
         SCLogDebug!(
             "NFSv4 REQUEST {} procedure {} ({}) blob size {}",
             r.hdr.xid,
@@ -381,8 +381,8 @@ impl NFSState {
         }
     }
 
-    pub fn process_reply_record_v4<'b>(
-        &mut self, r: &RpcReplyPacket<'b>, xidmap: &mut NFSRequestXidMap,
+    pub fn process_reply_record_v4(
+        &mut self, r: &RpcReplyPacket, xidmap: &mut NFSRequestXidMap,
     ) {
         if xidmap.procedure == NFSPROC4_COMPOUND {
             let mut data = r.prog_data;
index ee9d0702f3f3c235d4d2f453c94ca4963d3cf1f6..b4c5749eac46bd8542aa84dd44280ed30d3f28bc 100644 (file)
@@ -439,11 +439,11 @@ fn dcerpc_response_handle(tx: &mut SMBTransaction,
 
 /// Handle DCERPC reply record. Called for READ, TRANS, IOCTL
 ///
-pub fn smb_read_dcerpc_record<'b>(state: &mut SMBState,
+pub fn smb_read_dcerpc_record(state: &mut SMBState,
         vercmd: SMBVerCmdStat,
         hdr: SMBCommonHdr,
         guid: &[u8],
-        indata: &'b [u8]) -> bool
+        indata: &[u8]) -> bool
 {
     let (_, ntstatus) = vercmd.get_ntstatus();
 
index ddd99b37c0f1a9f509be07231828e0786f58e211..b36b465db51baaee9b1bd67ec9f746d2f42bd9f5 100644 (file)
@@ -1267,7 +1267,7 @@ impl SMBState {
     }
 
     /// return bytes consumed
-    pub fn parse_tcp_data_ts_partial<'b>(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &'b[u8]) -> usize
+    pub fn parse_tcp_data_ts_partial(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8]) -> usize
     {
         SCLogDebug!("incomplete of size {}", input.len());
         if input.len() < 512 {
@@ -1595,7 +1595,7 @@ impl SMBState {
     }
 
     /// return bytes consumed
-    pub fn parse_tcp_data_tc_partial<'b>(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &'b[u8]) -> usize
+    pub fn parse_tcp_data_tc_partial(&mut self, flow: *const Flow, stream_slice: &StreamSlice, input: &[u8]) -> usize
     {
         SCLogDebug!("incomplete of size {}", input.len());
         if input.len() < 512 {
index e6f42ccfcc04fe3de0df365ee8753c259c20893f..c6644615572edee8af004cb7927acf51b3d12a8f 100644 (file)
@@ -182,7 +182,7 @@ fn smb1_command_is_andx(c: u8) -> bool {
     }
 }
 
-fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command: u8, andx_offset: &mut usize) {
+fn smb1_request_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, andx_offset: &mut usize) {
     let mut events : Vec<SMBEvent> = Vec::new();
     let mut no_response_expected = false;
 
@@ -580,7 +580,7 @@ fn smb1_request_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command:
     }
 }
 
-pub fn smb1_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>) -> u32 {
+pub fn smb1_request_record(state: &mut SMBState, r: &SmbRecord) -> u32 {
     SCLogDebug!("record: command {}: record {:?}", r.command, r);
 
     let mut andx_offset = SMB1_HEADER_SIZE;
@@ -606,7 +606,7 @@ pub fn smb1_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>) -> u32 {
     0
 }
 
-fn smb1_response_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command: u8, andx_offset: &mut usize) {
+fn smb1_response_record_one(state: &mut SMBState, r: &SmbRecord, command: u8, andx_offset: &mut usize) {
     SCLogDebug!("record: command {} status {} -> {:?}", r.command, r.nt_status, r);
 
     let key_ssn_id = r.ssn_id;
@@ -822,7 +822,7 @@ fn smb1_response_record_one<'b>(state: &mut SMBState, r: &SmbRecord<'b>, command
     }
 }
 
-pub fn smb1_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>) -> u32 {
+pub fn smb1_response_record(state: &mut SMBState, r: &SmbRecord) -> u32 {
     let mut andx_offset = SMB1_HEADER_SIZE;
     let mut command = r.command;
     loop {
@@ -846,7 +846,7 @@ pub fn smb1_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>) -> u32
     0
 }
 
-pub fn smb1_trans_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>)
+pub fn smb1_trans_request_record(state: &mut SMBState, r: &SmbRecord)
 {
     let mut events : Vec<SMBEvent> = Vec::new();
 
@@ -885,7 +885,7 @@ pub fn smb1_trans_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>)
     smb1_request_record_generic(state, r, events);
 }
 
-pub fn smb1_trans_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>)
+pub fn smb1_trans_response_record(state: &mut SMBState, r: &SmbRecord)
 {
     let mut events : Vec<SMBEvent> = Vec::new();
 
@@ -932,7 +932,7 @@ pub fn smb1_trans_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>)
 }
 
 /// Handle WRITE, WRITE_ANDX, WRITE_AND_CLOSE request records
-pub fn smb1_write_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>, andx_offset: usize, command: u8)
+pub fn smb1_write_request_record(state: &mut SMBState, r: &SmbRecord, andx_offset: usize, command: u8)
 {
     let mut events : Vec<SMBEvent> = Vec::new();
 
@@ -1019,7 +1019,7 @@ pub fn smb1_write_request_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>, an
     smb1_request_record_generic(state, r, events);
 }
 
-pub fn smb1_read_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>, andx_offset: usize)
+pub fn smb1_read_response_record(state: &mut SMBState, r: &SmbRecord, andx_offset: usize)
 {
     let mut events : Vec<SMBEvent> = Vec::new();
 
@@ -1111,7 +1111,7 @@ pub fn smb1_read_response_record<'b>(state: &mut SMBState, r: &SmbRecord<'b>, an
 /// create a tx for a command / response pair if we're
 /// configured to do so, or if this is a tx especially
 /// for setting an event.
-fn smb1_request_record_generic<'b>(state: &mut SMBState, r: &SmbRecord<'b>, events: Vec<SMBEvent>) {
+fn smb1_request_record_generic(state: &mut SMBState, r: &SmbRecord, events: Vec<SMBEvent>) {
     if smb1_create_new_tx(r.command) || !events.is_empty() {
         let tx_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX);
         let tx = state.new_generic_tx(1, r.command as u16, tx_key);
@@ -1122,7 +1122,7 @@ fn smb1_request_record_generic<'b>(state: &mut SMBState, r: &SmbRecord<'b>, even
 /// update or create a tx for a command / reponse pair based
 /// on the response. We only create a tx for the response side
 /// if we didn't already update a tx, and we have to set events
-fn smb1_response_record_generic<'b>(state: &mut SMBState, r: &SmbRecord<'b>, events: Vec<SMBEvent>) {
+fn smb1_response_record_generic(state: &mut SMBState, r: &SmbRecord, events: Vec<SMBEvent>) {
     let tx_key = SMBCommonHdr::from1(r, SMBHDR_TYPE_GENERICTX);
     if let Some(tx) = state.get_generic_tx(1, r.command as u16, &tx_key) {
         tx.request_done = true;
index 569c7dfd947df65f78ddd6c785481e245c50bc8e..ce3f9194ec600162010c6f7fad2fffa62d1e9250 100644 (file)
@@ -331,7 +331,7 @@ pub fn parse_smb_trans_request_record_data(i: &[u8],
     Ok((i, req))
 }
 
-pub fn parse_smb_trans_request_record<'a, 'b>(i: &'a[u8], r: &SmbRecord<'b>)
+pub fn parse_smb_trans_request_record<'a>(i: &'a[u8], r: &SmbRecord)
     -> IResult<&'a[u8], SmbRecordTransRequest<'a>, SmbError>
 {
     let (rem, (params, pipe)) = parse_smb_trans_request_record_params(i)?;
index e83e312f1f8636464b42d664ac8da1c0dba1f116..685aae487bf5ae897d8e1c1be1f33b05da222961 100644 (file)
@@ -101,7 +101,7 @@ fn smb2_create_new_tx(cmd: u16) -> bool {
     }
 }
 
-fn smb2_read_response_record_generic<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+fn smb2_read_response_record_generic(state: &mut SMBState, r: &Smb2Record)
 {
     if smb2_create_new_tx(r.command) {
         let tx_hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_GENERICTX);
@@ -113,7 +113,7 @@ fn smb2_read_response_record_generic<'b>(state: &mut SMBState, r: &Smb2Record<'b
     }
 }
 
-pub fn smb2_read_response_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+pub fn smb2_read_response_record(state: &mut SMBState, r: &Smb2Record)
 {
     let max_queue_size = unsafe { SMB_CFG_MAX_READ_QUEUE_SIZE };
     let max_queue_cnt = unsafe { SMB_CFG_MAX_READ_QUEUE_CNT };
@@ -264,7 +264,7 @@ pub fn smb2_read_response_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
     }
 }
 
-pub fn smb2_write_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+pub fn smb2_write_request_record(state: &mut SMBState, r: &Smb2Record)
 {
     let max_queue_size = unsafe { SMB_CFG_MAX_WRITE_QUEUE_SIZE };
     let max_queue_cnt = unsafe { SMB_CFG_MAX_WRITE_QUEUE_CNT };
@@ -396,7 +396,7 @@ pub fn smb2_write_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
     }
 }
 
-pub fn smb2_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+pub fn smb2_request_record(state: &mut SMBState, r: &Smb2Record)
 {
     SCLogDebug!("SMBv2 request record, command {} tree {} session {}",
             &smb2_command_string(r.command), r.tree_id, r.session_id);
@@ -638,7 +638,7 @@ pub fn smb2_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
     }
 }
 
-pub fn smb2_response_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+pub fn smb2_response_record(state: &mut SMBState, r: &Smb2Record)
 {
     SCLogDebug!("SMBv2 response record, command {} status {} tree {} session {} message {}",
             &smb2_command_string(r.command), r.nt_status,
index 5a3994ecdc8212c4956bbde5217ca11c6c15e57b..73687aa5568f31d6724b29b7ac46a6c521395e5f 100644 (file)
@@ -57,7 +57,7 @@ impl SMBState {
 }
 
 // IOCTL responses ASYNC don't set the tree id
-pub fn smb2_ioctl_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+pub fn smb2_ioctl_request_record(state: &mut SMBState, r: &Smb2Record)
 {
     let hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER);
     match parse_smb2_request_ioctl(r.data) {
@@ -86,7 +86,7 @@ pub fn smb2_ioctl_request_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
 }
 
 // IOCTL responses ASYNC don't set the tree id
-pub fn smb2_ioctl_response_record<'b>(state: &mut SMBState, r: &Smb2Record<'b>)
+pub fn smb2_ioctl_response_record(state: &mut SMBState, r: &Smb2Record)
 {
     let hdr = SMBCommonHdr::from2(r, SMBHDR_TYPE_HEADER);
     match parse_smb2_response_ioctl(r.data) {