Chapter 33. Functions for LDAPMod Manipulation

This chapter contains reference information on LDAPMod manipulation routines.

Table 33.1. LDAPMod Manipulation Routines

Function Description
slapi_entry2mods() Creates an array of LDAPMod from a Slapi_Entry.
slapi_mod_add_value() Adds a value to a Slapi_Mod structure.
slapi_mod_done() Frees internals of Slapi_Mod structure.
slapi_mod_dump() Dumps the contents of an LDAPMod to the server log.
slapi_mod_free() Frees a Slapi_Mod structure.
slapi_mod_get_first_value() Initializes a Slapi_Mod iterator and returns the first attribute value.
slapi_mod_get_ldapmod_byref() Gets a reference to the LDAPMod in a Slapi_Mod structure.
slapi_mod_get_ldapmod_passout() Retrieves the LDAPMod contained in a Slapi_Mod structure.
slapi_mod_get_next_value() Increments the Slapi_Mod iterator and returns the next attribute value.
slapi_mod_get_num_values() Gets the number of values in a Slapi_Mod structure.
slapi_mod_get_operation() Gets the operation type of Slapi_Mod structure.
slapi_mod_get_type() Gets the attribute type of a Slapi_Mod structure.
slapi_mod_init() Initializes a Slapi_Mod structure.
slapi_mod_init_byref() Initializes a Slapi_Mod structure that is a wrapper for an existing LDAPMod.
slapi_mod_init_byval() Initializes a Slapi_Mod structure with a copy of an LDAPMod.
slapi_mod_init_passin() Initializes a Slapi_Mod from an LDAPMod.
slapi_mod_init_valueset_byval() Initializes the given smod with the given LDAP operation and attribute type.
slapi_mod_isvalid() Determines whether a Slapi_Mod structure is valid.
slapi_mod_new() Allocates a new Slapi_Mod structure.
slapi_mod_remove_value() Removes the value at the current Slapi_Mod iterator position.
slapi_mod_set_operation() Sets the operation type of a Slapi_Mod structure.
slapi_mod_set_type() Sets the attribute type of a Slapi_Mod.
slapi_mods2entry() Creates a Slapi_Entry from an array of LDAPMod.
slapi_mods_add() Appends a new mod with a single attribute value to Slapi_Mods structure.
slapi_mods_add_ldapmod() Appends an LDAPMod to a Slapi_Mods structure.
slapi_mods_add_mod_values() Appends a new mod to a Slapi_Mods structure with attribute values provided as an array of Slapi_Value.
slapi_mods_add_modbvps() Appends a new mod to a Slapi_Mods structure,with attribute values provided as an array of berval.
slapi_mods_add_smod() Appends a new smod to a Slapi_Mods structure.
slapi_mods_add_string() Appends a new mod to Slapi_Mods structure with a single attribute value provided as a string.
slapi_mods_done() Frees internals of a Slapi_Mods structure.
slapi_mods_dump() Dumps the contents of a Slapi_Mods structure to the server log.
slapi_mods_free() Frees a Slapi_Mods structure.
slapi_mods_get_first_mod() Initializes a Slapi_Mods iterator and returns the first LDAPMod.
slapi_mods_get_first_smod() Initializes a Slapi_Mods iterator and returns the first mod wrapped in a Slapi_Mods structure.
slapi_mods_get_ldapmods_byref() Gets a reference to the array of LDAPMod in a Slapi_Mods structure.
slapi_mods_get_ldapmods_passout() Retrieves the array of LDAPMod contained in a Slapi_Mods structure.
slapi_mods_get_next_mod() Increments the Slapi_Mods iterator and returns the next LDAPMod.
slapi_mods_get_next_smod() Increments the Slapi_Mods iterator and returns the next mod wrapped in a Slapi_Mods.
slapi_mods_get_num_mods() Gets the number of mods in a Slapi_Mods structure.
Section 33.40, “slapi_mods_init()” Initializes a Slapi_Mods.
slapi_mods_init_byref() Initializes a Slapi_Mods that is a wrapper for an existing array of LDAPMod.
slapi_mods_init_passin() Initializes a Slapi_Mods structure from an array of LDAPMod.
slapi_mods_insert_after() Inserts an LDAPMod into a Slapi_Mods structure after the current iterator position.
slapi_mods_insert_at() Inserts an LDAPMod anywhere in a Slapi_Mods.
slapi_mods_insert_before() Inserts an LDAPMod into a Slapi_Mods structure before the current iterator position.
slapi_mods_insert_smod_at() Inserts an smod anywhere in a Slapi_Mods structure.
slapi_mods_insert_smod_before() Inserts an smod before a Slapi_Mods structure.
slapi_mods_iterator_backone() Decrements the Slapi_Mods current iterator position.
slapi_mods_new() Allocates a new uninitialized Slapi_Mods structure.
slapi_mods_remove() Removes the mod at the current Slapi_Mods iterator position.

33.1. slapi_entry2mods()

Description

This function creates an array of LDAPMod of type LDAP_MOD_ADD from a Slapi_Entry.

Syntax

#include "slapi-plugin.h"
int slapi_entry2mods(const Slapi_Entry *e, char **dn, LDAPMod ***attrs);

Parameters

This function takes the following parameters:

e
Pointer to a Slapi_Entry.
dn
Address of a char* that will be set on return to the entry DN.
attrs
Address of an array of LDAPMod that will be set on return to a copy of the entry attributes.
Returns

This function returns one of the following values:

  • 0 if successful.
  • A non-zero value if not successful.