]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ldap: return empty buffer in ldap_tx_get_responses_dn
authorAlice Akaki <akakialice@gmail.com>
Mon, 3 Mar 2025 22:52:39 +0000 (18:52 -0400)
committerVictor Julien <victor@inliniac.net>
Wed, 5 Mar 2025 14:59:53 +0000 (15:59 +0100)
Funciton ldap_tx_get_responses_dn returns empty buffer in case
the response doesn't contain the distinguished name field

Fixes: 73ae6e997f6c ("detect: add ldap.responses.dn")
doc/userguide/rules/ldap-keywords.rst
rust/src/ldap/detect.rs

index d33ae02a226e6c3bf03f939c1df0242e3688d491..1e76c99360c66e7068349c3d15db84353c215ab6 100644 (file)
@@ -234,6 +234,12 @@ This keyword maps to the EVE fields:
    - ``ldap.responses[].compare_response.matched_dn``
    - ``ldap.responses[].extended_response.matched_dn``
 
+.. note::
+
+    If a response within the array does not contain the
+    distinguished name field, this field will be interpreted
+    as an empty buffer.
+
 Example
 ^^^^^^^
 
index ee5a081e5c5553d6b892f61f6b5d8b78ae1f660c..1e80c970fe2892924602d6f7303451aa5bd4cdf1 100644 (file)
@@ -371,7 +371,9 @@ unsafe extern "C" fn ldap_tx_get_responses_dn(
         ProtocolOp::ModDnResponse(resp) => resp.matched_dn.0.as_str(),
         ProtocolOp::CompareResponse(resp) => resp.matched_dn.0.as_str(),
         ProtocolOp::ExtendedResponse(resp) => resp.result.matched_dn.0.as_str(),
-        _ => return false,
+        _ => "",
+        // This ensures that the iteration continues,
+        // allowing other responses in the transaction to be processed correctly
     };
 
     *buffer = str_buffer.as_ptr();