24.2. slapi_entry2str_with_options()

Generates a description of an entry as an LDIF string. This function behaves much like slapi_entry2str(); however, you can specify output options with this function.
This function generates an LDIF string value conforming to the following syntax:
dn: dn\n 
[attr: value\n]*
For example:
dn: uid=jdoe, ou=People, dc=example,dc=com 
cn: Jane Doe
sn: Doe 
...
To convert an entry described in LDIF string format to an LDAP entry using the Section 14.22, “Slapi_Entry” data type, call the slapi_str2entry() function.
Syntax

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

Parameters

This function takes the following parameters:

e Entry that you want to convert into an LDIF string.
len Length of the LDIF string returned by this function.
options An option set that specifies how you want the string converted.
The Options Parameter

You can OR together any of the following options when you call this function:

Flag Value Description
SLAPI_DUMP_STATEINFO
This is only used internally by replication. This allows access to the internal data used by multi-master replication.
SLAPI_DUMP_UNIQUEID
This option is used when creating an LDIF file to be used to initialize a replica. Each entry will contain the nsuniqueID operational attribute.
SLAPI_DUMP_NOOPATTRS
By default, certain operational attributes (such as creatorName, modifiersName, createTimestamp, modifyTimestamp) may be included in the output. With this option, no operational attributes will be included.
SLAPI_DUMP_NOWRAP
By default, lines will be wrapped as defined in the LDIF specification. With this option, line wrapping is disabled.
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.