]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_modify.3
Update copyright statements
[openldap] / doc / man / man3 / ldap_modify.3
1 .TH LDAP_MODIFY 3 "22 September 1998" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2002 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 SYNOPSIS
8 .nf
9 .ft B
10 #include <ldap.h>
11 .LP
12 .ft B
13 .nf
14 int ldap_modify(ld, dn, mods)
15 .ft
16 LDAP *ld;
17 char *dn;
18 LDAPMod *mods[];
19 .LP
20 .ft B
21 .nf
22 int ldap_modify_s(ld, dn, mods)
23 .ft
24 LDAP *ld;
25 char *dn;
26 LDAPMod *mods[];
27 .LP
28 .ft B
29 .nf
30 void ldap_mods_free( mods, freemods )
31 .ft
32 LDAPMod **mods;
33 int freemods;
34 .SH DESCRIPTION
35 The routine
36 .B ldap_modify_s()
37 is used to perform an LDAP modify operation.
38 \fIdn\fP is the DN of the entry to modify, and \fImods\fP is a
39 null-terminated array of modifications to make to the entry.  Each element
40 of the \fImods\fP array is a pointer to an LDAPMod structure, which is
41 defined below.
42 .LP
43 .nf
44 .ft B
45         typedef struct ldapmod {
46             int mod_op;
47             char *mod_type;
48             union {
49                 char **modv_strvals;
50                 struct berval **modv_bvals;
51             } mod_vals;
52             struct ldapmod *mod_next;
53         } LDAPMod;
54         #define mod_values mod_vals.modv_strvals
55         #define mod_bvalues mod_vals.modv_bvals
56 .ft
57 .fi
58 .LP
59 The \fImod_op\fP field is used to specify the type of modification to
60 perform and should be one of LDAP_MOD_ADD, LDAP_MOD_DELETE, or
61 LDAP_MOD_REPLACE.  The \fImod_type\fP and \fImod_values\fP fields
62 specify the attribute type to modify and a null-terminated array of
63 values to add, delete, or replace respectively.  The \fImod_next\fP
64 field is used only by the LDAP server and may be ignored by the
65 client.
66 .LP
67 If you need to specify a non-string value (e.g., to add a
68 photo or audio attribute value), you should set \fImod_op\fP to the
69 logical OR of the operation as above (e.g., LDAP_MOD_REPLACE)
70 and the constant LDAP_MOD_BVALUES.  In this case, \fImod_bvalues\fP
71 should be used instead of \fImod_values\fP, and it should point to
72 a null-terminated array of struct bervals, as defined in <lber.h>.
73 .LP
74 For LDAP_MOD_ADD modifications, the given values are added to the
75 entry, creating the attribute if necessary.  For LDAP_MOD_DELETE
76 modifications, the given values are deleted from the entry, removing
77 the attribute if no values remain.  If the entire attribute is to be deleted,
78 the \fImod_values\fP field should be set to NULL.  For LDAP_MOD_REPLACE
79 modifications, the attribute will have the listed values after the
80 modification, having been created if necessary.  All modifications are
81 performed in the order in which they are listed.
82 .LP
83 .B
84 ldap_modify_s()
85 returns the LDAP error code resulting from the
86 modify operation.  This code can be interpreted by
87 .BR ldap_perror (3)
88 and friends.
89 .LP
90 The
91 .B ldap_modify()
92 operation works the same way as
93 .BR ldap_modify_s() ,
94 except that it is asynchronous, returning the message id of the
95 request it initiates, or -1 on error.  The result of the operation
96 can be obtained by calling
97 .BR ldap_result (3).
98 .LP
99 .B ldap_mods_free()
100 can be used to free each element of a NULL-terminated
101 array of mod structures.  If \fIfreemods\fP is non-zero, the
102 \fImods\fP pointer itself is freed as well.
103 .SH ERRORS
104 .B ldap_modify_s()
105 returns an ldap error code, either LDAP_SUCCESS or
106 an error if there was trouble.
107 .B ldap_modify()
108 returns -1 in case
109 of trouble, setting the
110 .B ld_errno
111 field of \fIld\fP.
112 .SH SEE ALSO
113 .BR ldap (3),
114 .BR ldap_error (3),
115 .BR ldap_add (3)
116 .SH ACKNOWLEDGEMENTS
117 .B      OpenLDAP
118 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
119 .B      OpenLDAP
120 is derived from University of Michigan LDAP 3.3 Release.