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
38 below.
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 struct ldapmod *mod_next;
48 } LDAPMod;
49 #define mod_values mod_vals.modv_strvals
50 #define mod_bvalues mod_vals.modv_bvals
51
52 The mod_op field is used to specify the type of modification to perform
53 and should be one of LDAP_MOD_ADD, LDAP_MOD_DELETE, or
54 LDAP_MOD_REPLACE. The mod_type and mod_values fields specify the
55 attribute type to modify and a null-terminated array of values to add,
56 delete, or replace respectively. The mod_next field is used only by
57 the LDAP server and may be ignored by the client.
58
59 If you need to specify a non-string value (e.g., to add a photo or
60 audio attribute value), you should set mod_op to the logical OR of the
61 operation as above (e.g., LDAP_MOD_REPLACE) and the constant
62 LDAP_MOD_BVALUES. In this case, mod_bvalues should be used instead of
63 mod_values, and it should point to a null-terminated array of struct
64 bervals, as defined in <lber.h>.
65
66 For LDAP_MOD_ADD modifications, the given values are added to the
67 entry, creating the attribute if necessary. For LDAP_MOD_DELETE modi‐
68 fications, the given values are deleted from the entry, removing the
69 attribute if no values remain. If the entire attribute is to be
70 deleted, the mod_values field should be set to NULL. For
71 LDAP_MOD_REPLACE modifications, the attribute will have the listed val‐
72 ues after the modification, having been created if necessary. All mod‐
73 ifications are performed in the order in which they are listed.
74
75 ldap_mods_free() can be used to free each element of a NULL-terminated
76 array of mod structures. If freemods is non-zero, the mods pointer
77 itself is freed as well.
78
79 ldap_modify_ext_s() returns a code indicating success or, in the case
80 of failure, indicating the nature of the failure. See ldap_error(3)
81 for details
82
83 The ldap_modify_ext() operation works the same way as ldap_mod‐
84 ify_ext_s(), except that it is asynchronous. The integer that msgidp
85 points to is set to the message id of the modify request. The result
86 of the operation can be obtained by calling ldap_result(3).
87
88 Both ldap_modify_ext() and ldap_modify_ext_s() allows server and client
89 controls to be passed in via the sctrls and cctrls parameters, respec‐
90 tively.
91
93 The ldap_modify() and ldap_modify_s() routines are deprecated in favor
94 of the ldap_modify_ext() and ldap_modify_ext_s() routines, respec‐
95 tively.
96
97 Deprecated interfaces generally remain in the library. The macro
98 LDAP_DEPRECATED can be defined to a non-zero value (e.g., -DLDAP_DEPRE‐
99 CATED=1) when compiling program designed to use deprecated interfaces.
100 It is recommended that developers writing new programs, or updating old
101 programs, avoid use of deprecated interfaces. Over time, it is
102 expected that documentation (and, eventually, support) for deprecated
103 interfaces to be eliminated.
104
106 ldap(3), ldap_error(3),
107
109 OpenLDAP Software is developed and maintained by The OpenLDAP Project
110 <http://www.openldap.org/>. OpenLDAP Software is derived from the Uni‐
111 versity of Michigan LDAP 3.3 Release.
112
113
114
115
116OpenLDAP 2.4.46 2018/03/22 LDAP_MODIFY(3)