Struct ldap3::LdapConn

source ·
pub struct LdapConn { /* private fields */ }
Available on crate feature sync only.
Expand description

Synchronous connection to an LDAP server.

In this version of the interface, new() will return a struct encapsulating a runtime, the connection, and an operation handle. All operations are performed through that struct, synchronously: the thread will wait until the result is available or the operation times out.

The API is virtually identical to the asynchronous one. The chief difference is that LdapConn is not cloneable: if you need another handle, you must open a new connection.

Implementations§

source§

impl LdapConn

source

pub fn new(url: &str) -> Result<Self>

Open a connection to an LDAP server specified by url.

See LdapConnAsync::new() for the details of the supported URL formats.

source

pub fn with_settings(settings: LdapConnSettings, url: &str) -> Result<Self>

Open a connection to an LDAP server specified by url, using settings to specify additional parameters.

source

pub fn from_url(url: &Url) -> Result<Self>

Open a connection to an LDAP server specified by an already parsed Url.

source

pub fn from_url_with_settings( settings: LdapConnSettings, url: &Url ) -> Result<Self>

Open a connection to an LDAP server specified by an already parsed Url, using settings to specify additional parameters.

source

pub fn with_search_options(&mut self, opts: SearchOptions) -> &mut Self

source

pub fn with_controls<V: IntoRawControlVec>(&mut self, ctrls: V) -> &mut Self

source

pub fn with_timeout(&mut self, duration: Duration) -> &mut Self

source

pub fn simple_bind( &mut self, bind_dn: &str, bind_pw: &str ) -> Result<LdapResult>

source

pub fn sasl_external_bind(&mut self) -> Result<LdapResult>

source

pub fn sasl_gssapi_bind(&mut self, server_fqdn: &str) -> Result<LdapResult>

Available on crate feature gssapi only.
source

pub fn search<'a, S: AsRef<str> + Send + Sync + 'a, A: AsRef<[S]> + Send + Sync + 'a>( &mut self, base: &str, scope: Scope, filter: &str, attrs: A ) -> Result<SearchResult>

Perform a Search, but unlike search(), which returns all results at once, return a handle which will be used for retrieving entries one by one. See EntryStream for the explanation of the protocol which must be adhered to in this case.

source

pub fn streaming_search_with<'a, 'b, V: IntoAdapterVec<'a, S, A>, S: AsRef<str> + Send + Sync + 'a, A: AsRef<[S]> + Send + Sync + 'a>( &'b mut self, adapters: V, base: &str, scope: Scope, filter: &str, attrs: A ) -> Result<EntryStream<'a, 'b, S, A>>

Perform a streaming Search internally modified by a chain of adapters. See Ldap::streaming_search_with().

source

pub fn add<S: AsRef<[u8]> + Eq + Hash>( &mut self, dn: &str, attrs: Vec<(S, HashSet<S>)> ) -> Result<LdapResult>

source

pub fn compare<B: AsRef<[u8]>>( &mut self, dn: &str, attr: &str, val: B ) -> Result<CompareResult>

source

pub fn delete(&mut self, dn: &str) -> Result<LdapResult>

source

pub fn modify<S: AsRef<[u8]> + Eq + Hash>( &mut self, dn: &str, mods: Vec<Mod<S>> ) -> Result<LdapResult>

source

pub fn modifydn( &mut self, dn: &str, rdn: &str, delete_old: bool, new_sup: Option<&str> ) -> Result<LdapResult>

source

pub fn unbind(&mut self) -> Result<()>

source

pub fn extended<E>(&mut self, exop: E) -> Result<ExopResult>where E: Into<Exop>,

source

pub fn last_id(&mut self) -> RequestId

source

pub fn abandon(&mut self, msgid: RequestId) -> Result<()>

source

pub fn is_closed(&mut self) -> bool

source

pub fn get_peer_certificate(&mut self) -> Result<Option<Vec<u8>>>

Trait Implementations§

source§

impl Debug for LdapConn

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more