#include <ldap.h> typedef struct ldapmod { int mod_op; char *mod_type; union { char **modv_strvals; struct berval **modv_bvals; } mod_vals; } LDAPMod; #define mod_values mod_vals.modv_strvals #define mod_bvalues mod_vals.modv_bvals int ldap_modify_ext( LDAP *ld, const char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp)
The ldap_modify_ext() routine initiates an asynchronous modify operation with controls. dn is the Distinguished name of the entry to modify, and mods is a NULL-terminated array of modifications to make to the entry. Each element of the mods array is a pointer to an LDAPMod structure.
The mod_op field is used to specify the type of modification to perform and should be one of the following:
LDAP_MOD_ADD | 0x00 |
LDAP_MOD_DELETE | 0x01 |
LDAP_MOD_REPLACE | 0x02 |
This field also indicates the type of values included in the mod_vals union. For binary data, you must also bitwise OR the operation type with LDAP_MOD_BVALUES (0x80). This indicates that the values are specified in a NULL-terminated array of struct berval structures. Otherwise, the mod_values will be used (that is, the values are assumed to be a NULL-terminated array of NULL-terminated character strings).
The mod_type field specifies the name of attribute to add, delete, or replace.
The mod_vals field specifies a pointer to a NULL-terminated array of values to add, replace, or delete. Only one of the mod_values or mod_bvalues variants should be used, with mod_bvalues being selected by ORing the mod_op field with the constant LDAP_MOD_BVALUES. mod_values is a NULL-terminated array of NULL-terminated strings and mod_bvalues is a NULL-terminated array of berval structures that can be used to pass binary values such as images.
For LDAP_MOD_ADD modifications, the given values are added to the entry, creating the attribute if necessary.
For LDAP_MOD_DELETE modifications, the given values are deleted from the entry, removing the attribute if no values remain. If the entire attribute is to be deleted, the mod_values field should be set to NULL. The server will return an error if the attribute doesn't exist.
For LDAP_MOD_REPLACE modifications, the attribute will have the listed values after the modification, having been created if necessary, or removed if the mod_vals field is NULL. The server should NOT return an error if the value doesn't exist.
All modifications are performed in the order in which they are listed.
No i5/OS authority is required. All authority checking is done by the LDAP server.
The ldap_modify_ext() API will return an LDAP error code if not successful. See LDAP Client API Error Conditions for possible LDAP error code values.
The following message may be sent from this function.
Message ID | Error Message Text |
---|---|
CPF3CF2 E | Error(s) occurred during running of ldap_modify_ext API. |
The ldap_modify_ext() API supports LDAP V3 server controls and client controls.
Top | LDAP APIs | APIs by category |