Skip to main content

Operation

Struct Operation 

Source
pub struct Operation { /* private fields */ }
Expand description

One encoded protocol operation, waiting for a message id.

No Debug. A simple_bind operation’s bytes contain the password in the clear — that is what a simple bind is — and a struct that can be printed is a struct that eventually gets printed into a log.

Implementations§

Source§

impl Operation

Source

pub fn simple_bind(dn: &str, password: &str) -> Result<Operation>

A simple bind: a DN and a password, both in the clear.

§An empty password is an anonymous bind

RFC 4511 §4.2 is explicit: a simple bind with a zero-length password is an unauthenticated bind, and a directory answers it with success. So a login form whose password field was left empty, passed straight through, comes back as “authenticated” — for any username that exists. This has been a real vulnerability in real products more than once.

So it is refused here, at the point the bytes are built, rather than anywhere it could be skipped. A caller that genuinely wants an anonymous bind asks for one by name with Operation::anonymous_bind.

Source

pub fn anonymous_bind() -> Operation

An anonymous bind: no name, no password, no authentication.

A legitimate operation — many directories allow an anonymous search — and spelled out here so that it can never be reached by accident.

Source

pub fn search(request: &SearchRequest) -> Operation

Source

pub fn unbind() -> Operation

UnbindRequest ::= [APPLICATION 2] NULL. There is no unbind response: it means “I am closing this connection”, not “please reply”.

Source

pub fn extended(oid: &str, value: Option<&[u8]>) -> Operation

Source

pub fn start_tls() -> Operation

Source

pub fn with_control(self, control: Control) -> Operation

Source

pub fn kind(&self) -> &'static str

Source

pub fn carries_password(&self) -> bool

Source

pub fn encode(&self, message_id: i64) -> Vec<u8> ⓘ

Wrap the operation in an LDAPMessage with the given id.

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<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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.