Creates an LDAPControl structure based on a BerElement, an OID, and a criticality flag.
#include "slapi-plugin.h" int slapi_build_control( char const *oid, BerElement const *ber, char iscritical, LDAPControl **ctrlp );
This function takes the following parameters:
The OID (object identifier) for the control that is to be created.
A BerElement that contains the control value. Pass NULL if the control has no value.
The criticality flag. If non-zero, the control will be marked as critical. If 0, it will not be marked as critical.
Pointer that will receive the allocated LDAPControl structure.
This function returns LDAP_SUCCESS (LDAP result code) if successful.
You can construct a BerElement using ber_init(3LDAP) for example.
Directory Server makes a copy of the oid string.
The contents of the ber parameter are the responsibility of the caller.
You can free the ber parameter of the slapi_build_control() using ber_free (3LDAP).
The LDAPControl pointer that is returned in ctrlp should be freed by calling ldap_control_free(3LDAP), which is an LDAP API function.
ber_free(3LDAP) ber_init(3LDAP) ldap_control_free(3LDAP)