Chapter 24. Functions for Managing Entries

This chapter contains reference information on routines for managing entries.

Table 24.1. Entry Routines

Function Description
slapi_entry2str() Generates an LDIF string description.
slapi_entry2str_with_options() Generates an LDIF string descriptions with options.
slapi_entry_add_rdn_values() Add components in an entry's RDN.
slapi_entry_add_string() Adds a string value to an attribute in an entry.
slapi_entry_add_value() Adds a data value to an attribute in an entry.
slapi_entry_add_values_sv() Adds an array of data values to an attribute in an entry.
slapi_entry_add_valueset() Adds a data value to an attribute in an entry.
slapi_entry_alloc() Allocates memory for a new entry.
Section 24.9, “slapi_entry_apply_mods()” Applies an array of LDAPMod to a Slapi_Entry.
slapi_entry_attr_delete() Deletes an attribute from an entry.
slapi_entry_attr_find() Checks if an entry contains a specific attribute.
slapi_entry_attr_get_bool() Gets a given attribute value as a boolean.
slapi_entry_attr_get_charptr() Gets the first value as a string.
slapi_entry_attr_get_charray() Gets the values of a multi-valued attribute of an entry.
slapi_entry_attr_get_int() Gets the first value as an integer.
slapi_entry_attr_get_long() Gets the first value as a long.
slapi_entry_attr_get_uint() Gets the first value as an unsigned integer.
slapi_entry_attr_get_ulong() Gets the first value as an unsigned long.
slapi_entry_attr_has_syntax_value() Checks if an attribute in an entry contains a value.
slapi_entry_attr_merge_sv() Adds an array to the attribute values in an entry.
slapi_entry_attr_replace_sv() Replaces the values of an attribute.
slapi_entry_attr_set_charptr() Replaces the values of an attribute with a string.
slapi_entry_attr_set_int() Replaces the value of an attribute with an integer.
slapi_entry_attr_set_long() Replaces the value of an attribute with a long.
slapi_entry_attr_set_uint() Replaces the value of an attribute with an unsigned integer.
slapi_entry_attr_set_ulong() Replaces the value of an attribute with an unsigned long.
slapi_entry_delete_string() Deletes a string from an attribute.
slapi_entry_delete_values_sv() Removes a Slapi_Value array from an attribute.
slapi_entry_dup() Copies an entry, its DN, and its attributes.
slapi_entry_first_attr() Finds the first attribute in an entry.
slapi_entry_free() Frees an entry from memory.
slapi_entry_get_dn() Gets the DN from an entry.
slapi_entry_get_dn_const() Returns the DN of an entry as a constant.
slapi_entry_get_ndn() Returns the NDN of an entry.
slapi_entry_get_sdn() Returns the Slapi_DN from an entry.
slapi_entry_get_sdn_const() Returns a Slapi_DN from an entry as a constant.
slapi_entry_get_uniqueid() Gets the unique ID from an entry.
slapi_entry_has_children() Determines if the specified entry has child entries.
slapi_entry_init() Initializes the values of an entry.
slapi_entry_merge_values_sv() Adds an array of data values to an attribute in an entry.
slapi_entry_next_attr() Finds the next attribute in an entry.
slapi_entry_rdn_values_present() Checks if values present in an entry's RDN are also present as attribute values.
slapi_entry_schema_check() Determines if an entry complies with the schema for its object class.
slapi_entry_set_dn() Sets the DN of an entry.
slapi_entry_set_sdn() Sets the Slapi_DN value in an entry.
slapi_entry_set_uniqueid() Sets the unique ID in an entry.
slapi_entry_size() Returns the size of an entry.
slapi_is_rootdse() Determines if an entry is the root DSE.
slapi_str2entry() Converts an LDIF description into an entry.

24.1. slapi_entry2str()

Generates an LDIF string description of an LDAP entry.
Description

This function generates an LDIF string value conforming to the following format:

					dn: dn\n 
					[attr: value\n]*
For example:
					dn: uid=jdoe, ou=People, dc=example,dc=com 
					cn: Jane Doe
					sn: Doe
					...
To convert a string description in LDIF format to an entry of the Section 14.22, “Slapi_Entry” data type, call the slapi_str2entry() function.
Syntax

#include "slapi-plugin.h"
char *slapi_entry2str( Slapi_Entry *e, int *len );

Parameters

This function takes the following parameters:

e
Entry that you want to convert into an LDIF string.
len
Length of the returned LDIF string.
Returns

This function returns one of the following values:

  • The LDIF string representation of the entry you specify.
  • NULL if an error occurs.
Memory Concerns

When you no longer need to use the string, you should free it from memory by calling the slapi_ch_free() function.