src/entry.h file

Typedefs

using LDAPAttribute_t = struct LDAPAttribute_s
using ld_entry_t = struct ld_entry_s

Functions

auto add(struct ldap_connection_ctx_t* connection, const char* dn, LDAPMod** attrs) -> enum OperationReturnCode
add This function wraps ldap_add_ext function associating it with connection.
auto add_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection) -> enum OperationReturnCode
add_on_write This callback called on complition of ldap add operation.
auto search(struct ldap_connection_ctx_t* connection, const char* base_dn, int scope, const char* filter, char** attrs, bool attrsonly, search_callback_fn search_callback, void* user_data) -> enum OperationReturnCode
search Function wraps ldap search operation associating it with connection.
auto search_on_read(int rc, LDAPMessage* message, struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
search_on_read This callback called upon complition of ldap search operation.
auto modify(struct ldap_connection_ctx_t* connection, const char* dn, LDAPMod** attrs) -> enum OperationReturnCode
modify This function wraps ldap_modify_ext.
auto modify_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection) -> enum OperationReturnCode
modify_on_read This callback called upon complition of ldap modify operation.
auto ld_delete(struct ldap_connection_ctx_t* connection, const char* dn) -> enum OperationReturnCode
ld_delete Function wraps ldap_delete_ext.
auto delete_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection) -> enum OperationReturnCode
delete_on_read This callback determines result of delete operation.
auto ld_rename(struct ldap_connection_ctx_t* connection, const char* olddn, const char* newdn, const char* new_parent, bool delete_original) -> enum OperationReturnCode
ld_rename Wraps ldap_rename function.
auto rename_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection) -> enum OperationReturnCode
rename_on_read This callback determines result of rename operation.
auto whoami(struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
whoami This operation only supported on OpenLDAP and determines who current user is.
auto whoami_on_read(int rc, LDAPMessage* message, struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
whoami_on_read This callback determines result of whoami operation.
auto ld_entry_new(TALLOC_CTX* ctx, const char* dn) -> ld_entry_t*
ld_entry_new Creates new ld_entry_t;
auto ld_entry_get_dn(ld_entry_t* entry) -> const char*
ld_entry_get_dn Get entry's dn;
auto ld_entry_add_attribute(ld_entry_t* entry, const LDAPAttribute_t* attr) -> enum OperationReturnCode
ld_entry_add_attribute Adds attribute to entry.
auto ld_entry_get_attribute(ld_entry_t* entry, const char* name_or_oid) -> LDAPAttribute_t*
ld_entry_get_attribute Gets attribute from entry.
auto ld_entry_get_attributes(ld_entry_t* entry) -> LDAPAttribute_t**
ld_entry_get_attributes Get all attributes.

Function documentation

enum OperationReturnCode add(struct ldap_connection_ctx_t* connection, const char* dn, LDAPMod** attrs)

add This function wraps ldap_add_ext function associating it with connection.

Parameters
connection in Connection to work with.
dn in The name of the entry to add. If NULL, a zero length DN is sent to the server.
attrs in The entry's attributes, specified using the LDAPMod structure defined for ldap_modify(). The mod_type and mod_vals fields MUST be filled in. The mod_op field is ignored unless ORed with the constant LDAP_MOD_BVALUES, used to select the mod_bvalues case of the mod_vals union.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode add_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection)

add_on_write This callback called on complition of ldap add operation.

Parameters
rc in Return code of ldap_result.
message in Message received from ldap.
connection in Connection to work with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode search(struct ldap_connection_ctx_t* connection, const char* base_dn, int scope, const char* filter, char** attrs, bool attrsonly, search_callback_fn search_callback, void* user_data)

search Function wraps ldap search operation associating it with connection.

Parameters
connection in Connection to work with.
base_dn in The dn of the entry at which to start the search. If NULL, a zero length DN is sent to the server.
scope in One of LDAP_SCOPE_BASE (0x00), LDAP_SCOPE_ONELEVEL (0x01), or LDAP_SCOPE_SUBTREE (0x02), indicating the scope of the search.
filter in A character string as described in [13], representing the search filter. The value NULL can be passed to indicate that the filter "(objectclass=*)" which matches all entries is to be used. Note that if the caller of the API is using LDAPv2, only a subset of the filter functionality described in [13] can be successfully used.
attrs in A NULL-terminated array of strings indicating which attributes to return for each matching entry. Passing NULL for this parameter causes all available user attributes to be retrieved. The special constant string LDAP_NO_ATTRS ("1.1") MAY be used as the only string in the array to indicate that no attribute types are to be returned by the server. The special constant string LDAP_ALL_USER_ATTRS ("*") can be used in the attrs array along with the names of some operational attributes to indicate that all user attributes plus the listed operational attributes are to be returned.
attrsonly in A boolean value that MUST be zero if both attribute types and values are to be returned, and non-zero if only types are wanted.
search_callback in A callback function on search operation.
user_data in An output parameter for returning data after a search.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode search_on_read(int rc, LDAPMessage* message, struct ldap_connection_ctx_t* connection)

search_on_read This callback called upon complition of ldap search operation.

Parameters
rc in Return code of ldap_result.
message in Message received from ldap.
connection in Connection to work with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode modify(struct ldap_connection_ctx_t* connection, const char* dn, LDAPMod** attrs)

modify This function wraps ldap_modify_ext.

Parameters
connection in Connection to work with.
dn in The name of the entry to modify. If NULL, a zero length DN is sent to the server.
attrs in A NULL-terminated array of modifications to make to the entry.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode modify_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection)

modify_on_read This callback called upon complition of ldap modify operation.

Parameters
rc Return code of ldap_result.
message Message received from ldap.
connection Connection to work with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_delete(struct ldap_connection_ctx_t* connection, const char* dn)

ld_delete Function wraps ldap_delete_ext.

Parameters
connection in Connection to work with.
dn in The name of the entry to delete. If NULL, a zero length DN is sent to the server.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode delete_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection)

delete_on_read This callback determines result of delete operation.

Parameters
rc in Return code of ldap_result.
message in Message received from ldap.
connection in Connection to work with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode ld_rename(struct ldap_connection_ctx_t* connection, const char* olddn, const char* newdn, const char* new_parent, bool delete_original)

ld_rename Wraps ldap_rename function.

Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode rename_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection)

rename_on_read This callback determines result of rename operation.

Parameters
rc in Return code of ldap_result.
message in Message received from ldap.
connection in Connection to work with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode whoami(struct ldap_connection_ctx_t* connection)

whoami This operation only supported on OpenLDAP and determines who current user is.

Parameters
connection in Connection to work with.

enum OperationReturnCode whoami_on_read(int rc, LDAPMessage* message, struct ldap_connection_ctx_t* connection)

whoami_on_read This callback determines result of whoami operation.

Parameters
rc in Return code of ldap_result.
message in Message received from ldap.
connection in Connection to work with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

ld_entry_t* ld_entry_new(TALLOC_CTX* ctx, const char* dn)

ld_entry_new Creates new ld_entry_t;

Parameters
ctx in Talloc ctx to use.
dn
Returns
  • Valid pointer to ld_entry_t.
  • NULL on error.

const char* ld_entry_get_dn(ld_entry_t* entry)

ld_entry_get_dn Get entry's dn;

Parameters
entry in Entry to use.
Returns
  • NULL - on error.
  • DN on success.

enum OperationReturnCode ld_entry_add_attribute(ld_entry_t* entry, const LDAPAttribute_t* attr)

ld_entry_add_attribute Adds attribute to entry.

Parameters
entry in Entry to use.
attr in Attribute to add.
Returns
  • RETURN_CODE_FAILURE - on error.
  • RETURN_CODE_SUCCESS - when attribute was added successduly.

LDAPAttribute_t* ld_entry_get_attribute(ld_entry_t* entry, const char* name_or_oid)

ld_entry_get_attribute Gets attribute from entry.

Parameters
entry in Entry to use.
name_or_oid in Name of attribute.
Returns
  • NULL - if attribute not found.
  • Pointer to LDAPAttribute_t if attribute was found.

LDAPAttribute_t** ld_entry_get_attributes(ld_entry_t* entry)

ld_entry_get_attributes Get all attributes.

Parameters
entry in Entry to get attributes from.
Returns
  • NULL terminated array of attributes on success.
  • NULL on error.