]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_modify.3
fc6e7ff84a61b01f21f856eb953e922a0f9f27bd
[openldap] / doc / man / man3 / ldap_modify.3
1 .TH LDAP_MODIFY 3 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2016 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_modify_ext, ldap_modify_ext_s \- Perform an LDAP modify operation
7 .SH LIBRARY
8 OpenLDAP LDAP (libldap, \-lldap)
9 .SH SYNOPSIS
10 .nf
11 .ft B
12 #include <ldap.h>
13 .LP
14 .ft B
15 int ldap_modify_ext(
16 .RS
17 .ft B
18 LDAP *\fIld\fB,
19 char *\fIdn\fB,
20 LDAPMod *\fImods[]\fB,
21 LDAPControl **\fIsctrls\fB,
22 LDAPControl **\fIcctrls\fB,
23 int *\fImsgidp\fB );
24 .RE
25 .LP
26 .nf
27 .ft B
28 int ldap_modify_ext_s(
29 .RS
30 .ft B
31 LDAP *\fIld\fB,
32 char *\fIdn\fB,
33 LDAPMod *\fImods[]\fB,
34 LDAPControl **\fIsctrls\fB,
35 LDAPControl **\fIcctrls\fB );
36 .RE
37 .LP
38 .nf
39 .ft B
40 void ldap_mods_free(
41 .RS
42 .ft B
43 LDAPMod **\fImods\fB,
44 int \fIfreemods\fB );
45 .RE
46 .SH DESCRIPTION
47 The routine
48 .B ldap_modify_ext_s()
49 is used to perform an LDAP modify operation.
50 \fIdn\fP is the DN of the entry to modify, and \fImods\fP is a
51 null-terminated array of modifications to make to the entry.  Each element
52 of the \fImods\fP array is a pointer to an LDAPMod structure, which is
53 defined below.
54 .LP
55 .nf
56         typedef struct ldapmod {
57             int mod_op;
58             char *mod_type;
59             union {
60                 char **modv_strvals;
61                 struct berval **modv_bvals;
62             } mod_vals;
63             struct ldapmod *mod_next;
64         } LDAPMod;
65         #define mod_values mod_vals.modv_strvals
66         #define mod_bvalues mod_vals.modv_bvals
67 .ft
68 .fi
69 .LP
70 The \fImod_op\fP field is used to specify the type of modification to
71 perform and should be one of LDAP_MOD_ADD, LDAP_MOD_DELETE, or
72 LDAP_MOD_REPLACE.  The \fImod_type\fP and \fImod_values\fP fields
73 specify the attribute type to modify and a null-terminated array of
74 values to add, delete, or replace respectively.  The \fImod_next\fP
75 field is used only by the LDAP server and may be ignored by the
76 client.
77 .LP
78 If you need to specify a non-string value (e.g., to add a
79 photo or audio attribute value), you should set \fImod_op\fP to the
80 logical OR of the operation as above (e.g., LDAP_MOD_REPLACE)
81 and the constant LDAP_MOD_BVALUES.  In this case, \fImod_bvalues\fP
82 should be used instead of \fImod_values\fP, and it should point to
83 a null-terminated array of struct bervals, as defined in <lber.h>.
84 .LP
85 For LDAP_MOD_ADD modifications, the given values are added to the
86 entry, creating the attribute if necessary.  For LDAP_MOD_DELETE
87 modifications, the given values are deleted from the entry, removing
88 the attribute if no values remain.  If the entire attribute is to be deleted,
89 the \fImod_values\fP field should be set to NULL.  For LDAP_MOD_REPLACE
90 modifications, the attribute will have the listed values after the
91 modification, having been created if necessary.  All modifications are
92 performed in the order in which they are listed.
93 .LP
94 .B ldap_mods_free()
95 can be used to free each element of a NULL-terminated
96 array of mod structures.  If \fIfreemods\fP is non-zero, the
97 \fImods\fP pointer itself is freed as well.
98 .LP
99 .B ldap_modify_ext_s()
100 returns a code indicating success or, in the case of failure,
101 indicating the nature of the failure.  See
102 .BR ldap_error (3)
103 for details
104 .LP
105 The
106 .B ldap_modify_ext()
107 operation works the same way as
108 .BR ldap_modify_ext_s() ,
109 except that it is asynchronous. The integer that \fImsgidp\fP points
110 to is set to the message id of the modify request.  The result of
111 the operation can be obtained by calling
112 .BR ldap_result (3).
113 .LP
114 Both
115 .B ldap_modify_ext() 
116 and
117 .B ldap_modify_ext_s() 
118 allows server and client controls to be passed in
119 via the sctrls and cctrls parameters, respectively.
120 .SH DEPRECATED INTERFACES
121 The
122 .B ldap_modify()
123 and
124 .B ldap_modify_s()
125 routines are deprecated in favor of the
126 .B ldap_modify_ext()
127 and
128 .B ldap_modify_ext_s()
129 routines, respectively.
130 .LP
131 .so Deprecated
132 .SH SEE ALSO
133 .BR ldap (3),
134 .BR ldap_error (3),
135 .SH ACKNOWLEDGEMENTS
136 .so ../Project
137