LDAPMODIFY(3) LDAPMODIFY(3)
NAME
ldapmodify, ldapmodifys - Perform an LDAP modify operation
LIBRARY
OpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
##include <>
int ldapmodify(ld,, dn,, mods)
LDAP *ld;
char *dn;
LDAPMod *mods[];
int ldapmodifys(ld,, dn,, mods)
LDAP *ld;
char *dn;
LDAPMod *mods[];
void ldapmodsfree( mods,, freemods )
LDAPMod **mods;
int freemods;
DESCRIPTION
The routine ldapmodifys() is used to perform an LDAP modify opera-
tion. dn is the DN of the entry to modify, and mods is a null-termi-
nated array of modifications to make to the entry. Each element of the
mods array is a pointer to an LDAPMod structure, which is defined
below.
typedef struct ldapmod {{
int modop;;
char **modtype;;
union {{
char ****modvstrvals;;
struct berval ****modvbvals;;
}} modvals;;
struct ldapmod **modnext;;
}} LDAPod;;
##define modvalues modvals.modvstrvals
##define modbvalues modvals.modvbvals
The modop field is used to specify the type of modification to perform
and should be one of LDAPMODAD, LDAPMODELETE, or
LDAPMODREPLACE. The modtype and modvalues fields specify the
attribute type to modify and a null-terminated array of values to add,
delete, or replace respectively. The modnext field is used only by
the LDAP server and may be ignored by the client.
If you need to specify a non-string value (e.g., to add a photo or
audio attribute value), you should set modop to the logical OR of the
operation as above (e.g., LDAPMODREPLACE) and the constant
LDAPMODBVALUES. In this case, modbvalues should be used instead of
modvalues, and it should point to a null-terminated array of struct
bervals, as defined in .
For LDAPMODAD modifications, the given values are added to the
entry, creating the attribute if necessary. For LDAPMODELETE modi-
fications, the given values are deleted from the entry, removing the
attribute if no values remain. If the entire attribute is to be
deleted, the modvalues field should be set to NUL. For
LDAPMODREPLACE modifications, the attribute will have the listed val-
ues after the modification, having been created if necessary. All mod-
ifications are performed in the order in which they are listed.
ldapmodifys() returns the LDAP error code resulting from the modify
operation. This code can be interpreted by ldapperror(3) and friends.
The ldapmodify() operation works the same way as ldapmodifys(),
except that it is asynchronous, returning the message id of the request
it initiates, or -1 on error. The result of the operation can be
obtained by calling ldapresult(3).
ldapmodsfree() can be used to free each element of a NUL-terminated
array of mod structures. If freemods is non-zero, the mods pointer
itself is freed as well.
ERORS
ldapmodifys() returns an ldap error code, either LDAPSUCES or an
error if there was trouble. ldapmodify() returns -1 in case of trou-
ble, setting the lderrno field of ld.
SEE ALSO
ldap(3), ldaperror(3), ldapadd(3)
ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project
(http:/www.openldap.org/). OpenLDAP is derived from University of
Michigan LDAP 3.3 Release.
OpenLDAP 2.2.19 2004/11/26 LDAPMODIFY(3)
|