Enum LdapError

Source
pub enum LdapError {
    InvalidString,
    InvalidAuthenticationType,
    InvalidDN,
    InvalidSubstring,
    InvalidFilterType,
    InvalidMessageType,
    Unknown,
    Ber(Error),
    NomError(ErrorKind),
}
Expand description

An error that can occur while parsing or validating a certificate.

Variants§

§

InvalidString

§

InvalidAuthenticationType

§

InvalidDN

§

InvalidSubstring

§

InvalidFilterType

§

InvalidMessageType

§

Unknown

§

Ber(Error)

§

NomError(ErrorKind)

Trait Implementations§

Source§

impl Debug for LdapError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for LdapError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for LdapError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for LdapError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ErrorKind> for LdapError

Source§

fn from(e: ErrorKind) -> LdapError

Converts to this type from the input type.
Source§

impl From<LdapError> for Err<LdapError>

Source§

fn from(e: LdapError) -> Err<LdapError>

Converts to this type from the input type.
Source§

impl<'a> FromBer<'a, LdapError> for AddRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for Attribute<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for AttributeValueAssertion<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for AuthenticationChoice<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for BindRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for BindResponse<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for Change<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for CompareRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for Control<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for ExtendedRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for ExtendedResponse<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for Filter<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for IntermediateResponse<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for LdapDN<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for LdapMessage<'a>

Parse a single LDAP message and return a structure borrowing fields from the input buffer

use ldap_parser::FromBer;
use ldap_parser::ldap::{LdapMessage, MessageID, ProtocolOp, ProtocolOpTag};

static DATA: &[u8] = include_bytes!("../assets/message-search-request-01.bin");

let res = LdapMessage::from_ber(DATA);
match res {
    Ok((rem, msg)) => {
        assert!(rem.is_empty());
        //
        assert_eq!(msg.message_id, MessageID(4));
        assert_eq!(msg.protocol_op.tag(), ProtocolOpTag::SearchRequest);
        match msg.protocol_op {
            ProtocolOp::SearchRequest(req) => {
                assert_eq!(req.base_object.0, "dc=rccad,dc=net");
            },
            _ => panic!("Unexpected message type"),
        }
    },
    _ => panic!("LDAP parsing failed: {:?}", res),
}
Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for LdapOID<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for LdapString<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for MessageID

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for ModDnRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for ModifyRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for PartialAttribute<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for RelativeLdapDN<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for SearchRequest<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<'a> FromBer<'a, LdapError> for SearchResultEntry<'a>

Source§

fn from_ber(bytes: &'a [u8]) -> ParseResult<'a, Self, LdapError>

Attempt to parse input bytes into a BER object
Source§

impl<I, E> FromExternalError<I, E> for LdapError

Source§

fn from_external_error(_input: I, kind: ErrorKind, _e: E) -> LdapError

Creates a new error from an input position, an ErrorKind indicating the wrapping parser, and an external error
Source§

impl<I> ParseError<I> for LdapError

Source§

fn from_error_kind(_input: I, kind: ErrorKind) -> Self

Creates an error from the input position and an ErrorKind
Source§

fn append(_input: I, kind: ErrorKind, _other: Self) -> Self

Combines an existing error with a new one created from the input position and an ErrorKind. This is useful when backtracking through a parse tree, accumulating error context on the way
Source§

fn from_char(input: I, _: char) -> Self

Creates an error from an input position and an expected character
Source§

fn or(self, other: Self) -> Self

Combines two existing errors. This function is used to compare errors generated in various branches of alt.
Source§

impl PartialEq for LdapError

Source§

fn eq(&self, other: &LdapError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LdapError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.