]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ldap: avoid unneeded renaming of variables
authorPierre Chifflier <chifflier@wzdftpd.net>
Wed, 11 Jun 2025 07:29:05 +0000 (09:29 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 11 Jun 2025 18:49:15 +0000 (20:49 +0200)
rust/src/ldap/ldap.rs

index 65b0b066dda6b1185416b20511fd408381dab23d..4e20e4a95fd2dc79ba1b59488d1eb993f0834289 100644 (file)
@@ -227,14 +227,13 @@ impl LdapState {
                 SCLogDebug!("ts: pdu {:?}", self.request_frame);
             }
             match ldap_parse_msg(start) {
-                Ok((rem, msg)) => {
+                Ok((rem, request)) => {
                     let tx = self.new_tx();
                     if tx.is_none() {
                         return AppLayerResult::err();
                     }
                     let mut tx = tx.unwrap();
                     let tx_id = tx.id();
-                    let request = msg;
                     // check if STARTTLS was requested
                     if let ProtocolOp::ExtendedRequest(request) = &request.protocol_op {
                         if request.request_name.0 == STARTTLS_OID {
@@ -298,8 +297,7 @@ impl LdapState {
                 SCLogDebug!("tc: pdu {:?}", self.response_frame);
             }
             match ldap_parse_msg(start) {
-                Ok((rem, msg)) => {
-                    let response = msg;
+                Ok((rem, response)) => {
                     // check if STARTTLS was requested
                     if self.request_tls {
                         if let ProtocolOp::ExtendedResponse(response) = &response.protocol_op {
@@ -389,13 +387,12 @@ impl LdapState {
         SCLogDebug!("ts: pdu {:?}", self.request_frame);
 
         match ldap_parse_msg(input) {
-            Ok((_, msg)) => {
+            Ok((_, request)) => {
                 let tx = self.new_tx();
                 if tx.is_none() {
                     return AppLayerResult::err();
                 }
                 let mut tx = tx.unwrap();
-                let request = msg;
                 tx.complete |= tx_is_complete(&request.protocol_op, Direction::ToServer);
                 tx.request = Some(request.to_static());
                 self.transactions.push_back(tx);
@@ -435,8 +432,7 @@ impl LdapState {
                 SCLogDebug!("tc: pdu {:?}", self.response_frame);
             }
             match ldap_parse_msg(start) {
-                Ok((rem, msg)) => {
-                    let response = msg;
+                Ok((rem, response)) => {
                     if let Some(tx) = self.find_request(response.message_id) {
                         tx.complete |= tx_is_complete(&response.protocol_op, Direction::ToClient);
                         let tx_id = tx.id();
@@ -534,8 +530,7 @@ fn tx_is_complete(op: &ProtocolOp, dir: Direction) -> bool {
 
 fn probe(input: &[u8], direction: Direction, rdir: *mut u8) -> AppProto {
     match ldap_parse_msg(input) {
-        Ok((_, msg)) => {
-            let ldap_msg = msg;
+        Ok((_, ldap_msg)) => {
             if direction == Direction::ToServer && !ldap_is_request(&ldap_msg) {
                 unsafe {
                     *rdir = Direction::ToClient.into();