HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Table 5-1 Front end functions for manipulating entries and attributes (continued)
DescriptionFront end function
Get the attributes of an entry.“slapi_entry_first_attr()”
“slapi_entry_next_attr()”
Find the values for a specified attribute.“slapi_entry_attr_find()”
Merge an attribute and its values into an entry.slapi_entry_attr_merge_sv()
Add values to an attribute in an entry.slapi_entry_add_values_sv()
5.5.1 Creating a new entry
In some situations, you might need to create a new entry. You can create a new entry in two
ways:
By allocating memory for a new entry.
To allocate memory for a new entry, call the “slapi_entry_alloc()” function. This function
returns a pointer to a new entry of the opaque datatype “Slapi_Entry”. Then, call the function
“slapi_entry_init()” to initialize the entry for use with the other slapi functions. After you
create and initialize a new entry, you should call other front end routines to set the DN and
attributes of the entry.
NOTE:
Failing to call “slapi_entry_init()” after “slapi_entry_alloc()” may cause severe memory
problems.
By copying an existing entry.
To make a copy of an existing entry, call the “slapi_entry_dup()” routine. This function
returns a pointer to a new entry of the data type Slapi_Entry that contains the copied
data.
When you are finished using the entry, you should free it from memory by calling the
“slapi_entry_free()” function.
5.5.2 Converting between entries and strings
Entries can be stored in LDIF files. When stored in these files, entries are converted into a string
representation. The following format is the LDIF string representation for a directory entry:
dn:[:]dn\n
[<attr>:[:]<value>\n]
[<attr>:[:]<value>\n]
[<spacecontinuedvalue>\n]*
...
To continue the specification of a value on additional lines (that is, if the value wraps to another
line), use a single space (the ASCII 32 character) at the beginning of subsequent lines. For example:
dn: cn=Jane Doe
inski, ou=Accoun
ting, dc=ex
ample
dc=com
Refer to the HP-UX Directory Server administrator guide for details on DN syntax.
If a double-colon is used after a data type, it indicates that the value after the double-colon is
encoded as a base-64 string. Data is sometimes encoded as a base-64 string. For example, it might
be encoded this way if the value contains a non-printing character or newline.
5.5 Working with entries, attributes, and values 51