A Lightweight Directory Access Protocol (LDAP) ([RFC4511]) parser, implemented with the nom parser combinator framework.
It is written in pure Rust, fast, and makes extensive use of zero-copy. A lot of care is taken to ensure security and safety of this crate, including design (recursion limit, defensive programming), tests, and fuzzing. It also aims to be panic-free.
The code is available on Github and is part of the Rusticata project.
Parsing an LDAP message (in BER format):
```rust use ldapparser::parseldapmessage; use ldapparser::ldap::{MessageID, ProtocolOp, ProtocolOpTag};
static DATA: &[u8] = include_bytes!("../assets/message-search-request-01.bin");
let res = parseldapmessage(DATA); match res { Ok((rem, msg)) => { assert!(rem.isempty()); // asserteq!(msg.messageid, MessageID(4)); asserteq!(msg.protocolop.tag(), ProtocolOpTag::SearchRequest); match msg.protocolop { ProtocolOp::SearchRequest(req) => { asserteq!(req.baseobject.0, "dc=rccad,dc=net"); }, _ => panic!("Unexpected message type"), } }, _ => panic!("LDAP parsing failed: {:?}", res), } ```
See CHANGELOG.md
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.