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

NAME

6       ldap_modify, ldap_modify_s - Perform an LDAP modify operation
7

LIBRARY

9       OpenLDAP LDAP (libldap, -lldap)
10

SYNOPSIS

12       #include <ldap.h>
13
14       int ldap_modify(ld, dn, mods)
15       LDAP *ld;
16       char *dn;
17       LDAPMod *mods[];
18
19       int ldap_modify_s(ld, dn, mods)
20       LDAP *ld;
21       char *dn;
22       LDAPMod *mods[];
23
24       void ldap_mods_free( mods, freemods )
25       LDAPMod **mods;
26       int freemods;
27

DESCRIPTION

29       The  routine  ldap_modify_s()  is used to perform an LDAP modify opera‐
30       tion.  dn is the DN of the entry to modify, and mods is  a  null-termi‐
31       nated array of modifications to make to the entry.  Each element of the
32       mods array is a pointer to  an  LDAPMod  structure,  which  is  defined
33       below.
34
35            typedef struct ldapmod {
36                int mod_op;
37                char *mod_type;
38                union {
39                    char **modv_strvals;
40                    struct berval **modv_bvals;
41                } mod_vals;
42                struct ldapmod *mod_next;
43            } LDAPMod;
44            #define mod_values mod_vals.modv_strvals
45            #define mod_bvalues mod_vals.modv_bvals
46
47       The mod_op field is used to specify the type of modification to perform
48       and   should   be   one   of    LDAP_MOD_ADD,    LDAP_MOD_DELETE,    or
49       LDAP_MOD_REPLACE.   The  mod_type  and  mod_values  fields  specify the
50       attribute type to modify and a null-terminated array of values to  add,
51       delete,  or  replace  respectively.  The mod_next field is used only by
52       the LDAP server and may be ignored by the client.
53
54       If you need to specify a non-string value (e.g.,  to  add  a  photo  or
55       audio  attribute value), you should set mod_op to the logical OR of the
56       operation  as  above  (e.g.,   LDAP_MOD_REPLACE)   and   the   constant
57       LDAP_MOD_BVALUES.   In this case, mod_bvalues should be used instead of
58       mod_values, and it should point to a null-terminated  array  of  struct
59       bervals, as defined in <lber.h>.
60
61       For  LDAP_MOD_ADD  modifications,  the  given  values  are added to the
62       entry, creating the attribute if necessary.  For LDAP_MOD_DELETE  modi‐
63       fications,  the  given  values are deleted from the entry, removing the
64       attribute if no values remain.   If  the  entire  attribute  is  to  be
65       deleted,   the   mod_values   field   should   be  set  to  NULL.   For
66       LDAP_MOD_REPLACE modifications, the attribute will have the listed val‐
67       ues after the modification, having been created if necessary.  All mod‐
68       ifications are performed in the order in which they are listed.
69
70       ldap_modify_s() returns the LDAP error code resulting from  the  modify
71       operation.  This code can be interpreted by ldap_perror(3) and friends.
72
73       The  ldap_modify()  operation  works  the  same way as ldap_modify_s(),
74       except that it is asynchronous, returning the message id of the request
75       it  initiates,  or  -1  on  error.   The result of the operation can be
76       obtained by calling ldap_result(3).
77
78       ldap_mods_free() can be used to free each element of a  NULL-terminated
79       array  of  mod  structures.   If freemods is non-zero, the mods pointer
80       itself is freed as well.
81

ERRORS

83       ldap_modify_s() returns an ldap error code, either LDAP_SUCCESS  or  an
84       error  if there was trouble.  ldap_modify() returns -1 in case of trou‐
85       ble, setting the ld_errno field of ld.
86

SEE ALSO

88       ldap(3), ldap_error(3), ldap_add(3)
89

ACKNOWLEDGEMENTS

91       OpenLDAP  is  developed  and  maintained  by   The   OpenLDAP   Project
92       (http://www.openldap.org/).   OpenLDAP  is  derived  from University of
93       Michigan LDAP 3.3 Release.
94
95
96
97OpenLDAP 2.3.34                    2007/2/16                    LDAP_MODIFY(3)
Impressum