Crate ldap_utils

Source
Expand description

§ldap-utils

Implements some LDAP utility functionality around OpenLDAP config files and the ldap3 Rust library

Structs§

ConnectParameters
a set of parameters for connecting to an LDAP server, including client-side certificate auth support
ConnectParametersBuilder
Builder for ConnectParameters.
OIDError
an error type in case parsing an OID fails when querying the RootDSE from ldap3 during the parsing of supported controls, extensions and features

Enums§

ConnectError
errors which can happen when connecting to an LDAP server
ConnectParametersBuilderError
Error type for ConnectParametersBuilder
LdapOperationError
an error during normal ldap operations (search, add, modify, update, delete,…)
LdapSchemaError
error which can happen while retrieving and parsing the LDAP schema
OpenLdapConnectParameterError
errors which can happen when trying to retrieve connect parameters from openldap config
ScopeParserError
error which can occur while parsing a scope
TomlConfigError
error which can happen while reading connect parameters from a file

Functions§

apply_ldap_operations
apply the LDAP operations on a given LDAP server.
connect
try to connect to an LDAP server using ldap3 using the OpenLDAP config files supplemented by hardcoded default values
connect_with_parameters
connect to an LDAP server using ldap3 with the given set of default parameters
default_connect_parameters
fill the builder with hardcoded default parameters
delete_recursive
delete an LDAP entry recursively using ldap3
diff_entries
diff two sets of LDAPEntries which had their base DNs removed and generates LDAP operations (add, update, delete) to apply to the destination to make it identical to the source
ldap_search
perform an LDAP search via ldap3, logging a proper error message if it fails and returning an iterator to already unwrapped search entries
mod_value
generate an ldap3::Mod if there is a DN-valued attribute in the source entry that needs its base DN translated to the destination base DN
mods_as_bin_mods
of the same modify operation because otherwise we might successfully apply the textual modifications and then fail on the binary ones, leaving behind a half-modified object
noop_control
creates a noop_control object for use with ldap3
openldap_connect_parameters
try to detect OpenLDAP connect parameters from its config files (ldap.conf in /etc/ldap or /etc/openldap and .ldaprc in the user home dir)
parse_scope
parse an ldap3::Scope from the string one would specify to use the same scope with OpenLDAP’s ldapsearch -s parameter
query_ldap_schema
Retrieve the LDAP schema from an LDAP server using ldap3
query_root_dse
retrieve the RootDSE from an LDAP server using ldap3
search_entries
helper function to search an LDAP server and generate LDAPEntry values with the base DN removed to make them server-independent
success_or_noop_success
check if an ldap3::LdapResult is either a success or the success code returned by an operation using the noop_control
toml_connect_parameters
load ldap connect parameters from a toml file