NAME
ldapmodify, ldapmodifys - Perform an LDAP modify operation
LLIIBBRRAARRYYOpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
##iinncclluuddee <
iinntt llddaappmmooddiiffyy((lldd,, ddnn,, mmooddss)) LDAP *ld; char *dn; LDAPMod *mods[]; iinntt llddaappmmooddiiffyyss((lldd,, ddnn,, mmooddss)) LDAP *ld; char *dn; LDAPMod *mods[]; vvooiidd llddaappmmooddssffrreeee(( mmooddss,, ffrreeeemmooddss )) LDAPMod **mods; int freemods;> DESCRIPTION
The routine llddaappmmooddiiffyyss(()) 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. ttyyppeeddeeff ssttrruucctt llddaappmmoodd {{ iinntt mmooddoopp;; cchhaarr **mmooddttyyppee;; uunniioonn {{ cchhaarr ****mmooddvvssttrrvvaallss;; struct berval **modvbvals; }} mmooddvvaallss;; ssttrruucctt llddaappmmoodd **mmooddnneexxtt;; }} LLDDAAPPMMoodd;;##ddeeffiinnee mmooddvvaalluueess mmooddvvaallss..mmooddvvssttrrvvaallss
#define modbvalues modvals.modvbvals
The modop field is used to specify the type of modification to perform and should be one of LDAPMODADD, LDAPMODDELETE, or LDAPMODREPLACE. The modtype and modvalues fields specify theattribute 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 ofmodvalues, and it should point to a null-terminated array of struct
bervals, as defined in. For LDAPMODADD modifications, the given values are added to the entry, creating the attribute if necessary. For LDAPMODDELETE 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 NULL. ForLDAPMODREPLACE 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. llddaappmmooddiiffyyss(()) returns the LDAP error code resulting from the modify operation. This code can be interpreted by llddaappppeerrrroorr(3) and friends. The llddaappmmooddiiffyy(()) operation works the same way as llddaappmmooddiiffyyss(()), except that it is asynchronous, returning the message id of the requestit initiates, or -1 on error. The result of the operation can be
obtained by calling llddaapprreessuulltt(3).llddaappmmooddssffrreeee(()) can be used to free each element of a NULL-terminated
array of mod structures. If freemods is non-zero, the mods pointer
itself is freed as well. EERRRROORRSS llddaappmmooddiiffyyss(()) returns an ldap error code, either LDAPSUCCESS or anerror if there was trouble. llddaappmmooddiiffyy(()) returns -1 in case of trou-
ble, setting the llddeerrrrnnoo field of ld.SEE ALSO
llddaapp(3), llddaappeerrrroorr(3), llddaappaadddd(3) AACCKKNNOOWWLLEEDDGGEEMMEENNTTSS OOppeennLLDDAAPP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OOppeennLLDDAAPP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.2.19 2004/11/26 LDAPMODIFY(3)