⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

LdapClient

Struct LdapClient 

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

LDAP client for directory operations.

Encodes requests and decodes responses using ASN.1/BER. Does not manage network transport directly; callers provide a send/receive mechanism.

Implementations§

Source§

impl LdapClient

Source

pub fn new(base_dn: &str) -> Self

Create a new LDAP client with the given base DN.

Source

pub fn is_bound(&self) -> bool

Whether the client is currently bound.

Source

pub fn base_dn(&self) -> &str

Get the base DN.

Source

pub fn encode_bind_request(&mut self, dn: &str, password: &str) -> Vec<u8>

Encode a simple bind request (DN + password).

Returns the BER-encoded LDAPMessage bytes.

Source

pub fn parse_bind_response( &mut self, data: &[u8], ) -> Result<LdapResultCode, KernelError>

Parse a bind response. Returns the result code.

Source

pub fn bind(&mut self, dn: &str, password: &str) -> (Vec<u8>, LdapResultCode)

Convenience: encode bind, parse response, return result.

Source

pub fn encode_search_request( &mut self, base_dn: &str, scope: SearchScope, filter: &LdapFilter, attributes: &[&str], ) -> Vec<u8>

Encode a search request.

Returns BER-encoded LDAPMessage bytes.

Source

pub fn decode_search_result( &self, data: &[u8], ) -> Result<SearchResult, KernelError>

Parse search result entries from a response buffer.

A search operation may return multiple SearchResultEntry messages followed by a SearchResultDone. This parses a single message.

Source

pub fn search( &mut self, scope: SearchScope, filter: &LdapFilter, attributes: &[&str], ) -> Vec<u8>

Convenience: build a search request with the client’s base DN.

Source

pub fn encode_compare_request( &mut self, dn: &str, attribute: &str, value: &str, ) -> Vec<u8>

Encode a compare request.

Source

pub fn encode_modify_request( &mut self, dn: &str, modifications: &[(ModifyOperation, &str, &[&str])], ) -> Vec<u8>

Encode a modify request.

modifications is a list of (operation, attribute, values) tuples.

Source

pub fn encode_add_request( &mut self, dn: &str, attributes: &[(&str, &[&str])], ) -> Vec<u8>

Encode an add request.

attributes is a list of (attribute_name, values).

Source

pub fn encode_delete_request(&mut self, dn: &str) -> Vec<u8>

Encode a delete request.

Source

pub fn encode_unbind_request(&mut self) -> Vec<u8>

Encode an unbind request.

Source

pub fn unbind(&mut self) -> Vec<u8>

Unbind and reset state.

Auto Trait Implementations§

§

impl Freeze for LdapClient

§

impl RefUnwindSafe for LdapClient

§

impl Send for LdapClient

§

impl Sync for LdapClient

§

impl Unpin for LdapClient

§

impl UnwindSafe for LdapClient

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.