1LDAP_MODIFY(3)             Library Functions Manual             LDAP_MODIFY(3)
2
3
4

NAME

6       ldap_modify_ext, ldap_modify_ext_s - Perform an LDAP modify operation
7

LIBRARY

9       OpenLDAP LDAP (libldap, -lldap)
10

SYNOPSIS

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

DESCRIPTION

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                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  LDAP_MOD_RE‐
54       PLACE.   The  mod_type and mod_values fields specify the attribute type
55       to modify and a null-terminated array of values to add, delete, or  re‐
56       place respectively.  The mod_next field is used only by the LDAP server
57       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  au‐
60       dio  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 en‐
67       try, creating the attribute if necessary.  For LDAP_MOD_DELETE  modifi‐
68       cations,  the given values are deleted from the entry, removing the at‐
69       tribute if no values remain.  If the entire attribute is to be deleted,
70       the mod_values field should be set to NULL.  For LDAP_MOD_REPLACE modi‐
71       fications, the attribute will have the listed values after the  modifi‐
72       cation,  having  been created if necessary.  All modifications are per‐
73       formed 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 it‐
77       self 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

DEPRECATED INTERFACES

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 ex‐
102       pected that documentation (and, eventually, support) for deprecated in‐
103       terfaces to be eliminated.
104

SEE ALSO

106       ldap(3), ldap_error(3),
107

ACKNOWLEDGEMENTS

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.57                   2021/01/18                    LDAP_MODIFY(3)
Impressum