]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_modify.3
3fce2b1185e56b2270f022a3cbfdcb1438c82fc8
[openldap] / doc / man / man3 / ldap_modify.3
1 .TH LDAP_MODIFY 3 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2006 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_modify, ldap_modify_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_modify_ext_s()
95 returns the LDAP error code resulting from the
96 modify operation.
97 .LP
98 Both
99 .B ldap_abandon_ext() 
100 and
101 .B ldap_abandon_ext() 
102 allows server and client controls to be passed in
103 via the sctrls and cctrls parameters, respectively.
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 .B ldap_mods_free()
115 can be used to free each element of a NULL-terminated
116 array of mod structures.  If \fIfreemods\fP is non-zero, the
117 \fImods\fP pointer itself is freed as well.
118 .SH ERRORS
119 .B ldap_modify_ext_s()
120 and
121 .B ldap_modify_ext()
122 returns an ldap error code, either LDAP_SUCCESS or
123 an error if there was trouble.
124
125 See
126 .BR ldap_error (3)
127 for details
128 .SH DEPRECATED INTERFACES
129 The
130 .B ldap_modify()
131 and
132 .B ldap_modify_s()
133 routines are deprecated in favor of the
134 .B ldap_modify_ext()
135 and
136 .B ldap_modify_ext_s()
137 routines, respectively.
138
139 .so Deprecated
140 .SH SEE ALSO
141 .BR ldap (3),
142 .BR ldap_error (3),
143 .SH ACKNOWLEDGEMENTS
144 .so ../Project
145