1LDAP_MODIFY(3) Library Functions Manual LDAP_MODIFY(3)
2
3
4
6 ldap_modify_ext, ldap_modify_ext_s - Perform an LDAP modify operation
7
9 OpenLDAP LDAP (libldap, -lldap)
10
12 #include <ldap.h>
13
14 int ldap_modify_ext(
15 LDAP *ld,
16 char *dn,
17 LDAPMod *mods[],
18 LDAPControl **sctrls,
19 LDAPControl **cctrls,
20 int *msgidp );
21
22 int ldap_modify_ext_s(
23 LDAP *ld,
24 char *dn,
25 LDAPMod *mods[],
26 LDAPControl **sctrls,
27 LDAPControl **cctrls );
28
29 void ldap_mods_free(
30 LDAPMod **mods,
31 int freemods );
32
34 The routine ldap_modify_ext_s() is used to perform an LDAP modify oper‐
35 ation. dn is the DN of the entry to modify, and mods is a null-termi‐
36 nated array of modifications to make to the entry. Each element of the
37 mods array is a pointer to an LDAPMod structure, which is defined be‐
38 low.
39
40 typedef struct ldapmod {
41 int mod_op;
42 char *mod_type;
43 union {
44 char **modv_strvals;
45 struct berval **modv_bvals;
46 } mod_vals;
47 } LDAPMod;
48 #define mod_values mod_vals.modv_strvals
49 #define mod_bvalues mod_vals.modv_bvals
50
51 The mod_op field is used to specify the type of modification to perform
52 and should be one of LDAP_MOD_ADD, LDAP_MOD_DELETE, or LDAP_MOD_RE‐
53 PLACE. The mod_type and mod_values fields specify the attribute type
54 to modify and a null-terminated array of values to add, delete, or re‐
55 place respectively.
56
57 If you need to specify a non-string value (e.g., to add a photo or au‐
58 dio attribute value), you should set mod_op to the logical OR of the
59 operation as above (e.g., LDAP_MOD_REPLACE) and the constant
60 LDAP_MOD_BVALUES. In this case, mod_bvalues should be used instead of
61 mod_values, and it should point to a null-terminated array of struct
62 bervals, as defined in <lber.h>.
63
64 For LDAP_MOD_ADD modifications, the given values are added to the en‐
65 try, creating the attribute if necessary. For LDAP_MOD_DELETE modifi‐
66 cations, the given values are deleted from the entry, removing the at‐
67 tribute if no values remain. If the entire attribute is to be deleted,
68 the mod_values field should be set to NULL. For LDAP_MOD_REPLACE modi‐
69 fications, the attribute will have the listed values after the modifi‐
70 cation, having been created if necessary. All modifications are per‐
71 formed in the order in which they are listed.
72
73 ldap_mods_free() can be used to free each element of a NULL-terminated
74 array of mod structures. If freemods is non-zero, the mods pointer it‐
75 self is freed as well.
76
77 ldap_modify_ext_s() returns a code indicating success or, in the case
78 of failure, indicating the nature of the failure. See ldap_error(3)
79 for details
80
81 The ldap_modify_ext() operation works the same way as ldap_mod‐
82 ify_ext_s(), except that it is asynchronous. The integer that msgidp
83 points to is set to the message id of the modify request. The result
84 of the operation can be obtained by calling ldap_result(3).
85
86 Both ldap_modify_ext() and ldap_modify_ext_s() allows server and client
87 controls to be passed in via the sctrls and cctrls parameters, respec‐
88 tively.
89
91 The ldap_modify() and ldap_modify_s() routines are deprecated in favor
92 of the ldap_modify_ext() and ldap_modify_ext_s() routines, respec‐
93 tively.
94
95 Deprecated interfaces generally remain in the library. The macro
96 LDAP_DEPRECATED can be defined to a non-zero value (e.g., -DLDAP_DEPRE‐
97 CATED=1) when compiling program designed to use deprecated interfaces.
98 It is recommended that developers writing new programs, or updating old
99 programs, avoid use of deprecated interfaces. Over time, it is ex‐
100 pected that documentation (and, eventually, support) for deprecated in‐
101 terfaces to be eliminated.
102
104 ldap(3), ldap_error(3),
105
107 OpenLDAP Software is developed and maintained by The OpenLDAP Project
108 <http://www.openldap.org/>. OpenLDAP Software is derived from the Uni‐
109 versity of Michigan LDAP 3.3 Release.
110
111
112
113
114OpenLDAP 2.6.3 2022/07/14 LDAP_MODIFY(3)