| Crates.io | ldappostaladdr |
| lib.rs | ldappostaladdr |
| version | 1.0.1 |
| created_at | 2025-08-18 10:15:32.522046+00 |
| updated_at | 2025-08-18 10:24:24.893637+00 |
| description | LDAP postal address parsing (zero-copy) and escape / unescape utilities |
| homepage | |
| repository | https://github.com/JonathanWilbur/asn1.rs/tree/master/ldappostaladdr |
| max_upload_size | |
| id | 1800227 |
| size | 18,608 |
This Rust crate parses Lightweight Directory Access Protocol (LDAP) postal
addresses according to the syntax in
IETF RFC 4517.
It has no dependencies. This crate can function without a standard library
(no_std), but alloc is required if you want to actually replace escape
sequences or create new postal address strings. Without alloc, this crate
merely detects escape sequences used in postal address lines, but does nothing
about them.
This crate has been fuzz-tested. It checks for an odd number of trailing slashes in attribute values to prevent injection attacks.
You can parse and unescape LDAP postal addresses like so:
use ldappostaladdr::{parse_postal_address, unescape_postal_address_line};
let input = "\\241,000,000 Sweepstakes$PO Box 1000000$Anytown, CA 12345$USA";
let mut postal_address = parse_postal_address(input);
for (line, backslash_escaped, dollar_escaped) in postal_address {
// This line returns Cow::Borrowed() if the line doesn't contain escape sequences.
let unescaped_line = unescape_postal_address_line(line, backslash_escaped, dollar_escaped);
info!(unescaped_line.as_ref());
}
None of the code in this crate was produced by an AI or LLM of any kind.