1ldap_modify(3LDAP)          LDAP Library Functions          ldap_modify(3LDAP)
2
3
4

NAME

6       ldap_modify,  ldap_modify_s, ldap_mods_free, ldap_modify_ext, ldap_mod‐
7       ify_ext_s - LDAP entry modification functions
8

SYNOPSIS

10       cc[ flag... ] file... -lldap[ library... ]
11       #include <lber.h>
12       #include <ldap.h>
13
14       int ldap_modify(LDAP *ld, char *dn, LDAPMod *mods[]);
15
16
17       int ldap_modify_s(LDAP *ld, char *dn, LDAPMod *mods[]);
18
19
20       void ldap_mods_free(LDAPMod **mods, int freemods);
21
22
23       int ldap_modify_ext(LDAP *ld, char *dn, LDAPMod **mods,
24            LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
25
26
27       int ldap_modify_ext_s(LDAP *ld, char *dn, LDAPMod **mods,
28            LDAPControl **serverctrls, LDAPControl **clientctrls);
29
30

DESCRIPTION

32       The function ldap_modify_s() is used to perform an LDAP  modify  opera‐
33       tion.  dn  is  the DN of the entry to modify, and mods is a null-termi‐
34       nated array of modifications to make to the entry.    Each  element  of
35       the  mods array is a pointer to an  LDAPMod structure, which is defined
36       below.
37
38              typedef struct ldapmod {
39                  int mod_op;
40                  char *mod_type;
41                  union {
42                   char **modv_strvals;
43                   struct berval **modv_bvals;
44                    } mod_vals;
45                  } LDAPMod;
46              #define mod_values mod_vals.modv_strvals
47              #define mod_bvalues mod_vals.modv_bvals
48
49
50
51       The mod_op field is used to specify the type of modification to perform
52       and    should    be   one   of    LDAP_MOD_ADD,   LDAP_MOD_DELETE,   or
53       LDAP_MOD_REPLACE.  The  mod_type  and  mod_values  fields  specify  the
54       attribute  type to modify and a null-terminated array of values to add,
55       delete, or replace respectively.
56
57
58       If you need to specify a non-string value (for example, to add a  photo
59       or  audio  attribute value), you should set mod_op to the logical OR of
60       the operation as above (for example,  LDAP_MOD_REPLACE)  and  the  con‐
61       stant   LDAP_MOD_BVALUES.  In  this  case,  mod_bvalues  should be used
62       instead of mod_values, and it should point to a  null-terminated  array
63       of struct bervals, as defined in  <lber.h>.
64
65
66       For   LDAP_MOD_ADD  modifications,  the  given  values are added to the
67       entry, creating the attribute if necessary.  For  LDAP_MOD_DELETE modi‐
68       fications,  the  given  values are deleted from the entry, removing the
69       attribute if no values remain.   If  the  entire  attribute  is  to  be
70       deleted,   the   mod_values   field   should   be  set  to  NULL.   For
71       LDAP_MOD_REPLACE modifications, the attribute will have the listed val‐
72       ues after the modification, having been created if necessary.  All mod‐
73       ifications are performed in the order in which they are listed.
74
75
76       ldap_modify_s() returns the LDAP error code resulting from  the  modify
77       operation.
78
79
80       The  ldap_modify()  operation  works  the  same way as ldap_modify_s(),
81       except that it is asynchronous, returning the message id of the request
82       it  initiates,  or   −1  on  error.  The result of the operation can be
83       obtained by calling ldap_result(3LDAP).
84
85
86       ldap_mods_free() can be used to free each element of a  null-terminated
87       array  of  mod  structures.   If freemods is non-zero, the mods pointer
88       itself is freed as well.
89
90
91       The  ldap_modify_ext() function initiates an asynchronous modify opera‐
92       tion  and returns  LDAP_SUCCESS if the request was successfully sent to
93       the server,  or  else  it  returns  a  LDAP  error  code  if  not.  See
94       ldap_error(3LDAP). If successful,  ldap_modify_ext() places the message
95       id   of   the   request   in    *msgidp.   A   subsequent    call    to
96       ldap_result(3LDAP),  can  be  used  to  obtain  the  result  of the add
97       request.
98
99
100       The  ldap_modify_ext_s() function initiates a synchronous modify opera‐
101       tion and returns the result of the operation itself.
102

ERRORS

104       ldap_modify_s()  returns an LDAP error code, either  LDAP_SUCCESS or an
105       error. See ldap_error(3LDAP).
106
107
108       ldap_modify() returns  −1 in case of trouble, setting the  error  field
109       of ld.
110

ATTRIBUTES

112       See attributes(5) for a description of the following attributes:
113
114
115
116
117       ┌─────────────────────────────┬─────────────────────────────┐
118       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
119       │Availability                 │SUNWcsl (32-bit)             │
120       │                             │SUNWcslx (64-bit)            │
121       │Interface Stability          │Evolving                     │
122       └─────────────────────────────┴─────────────────────────────┘
123

SEE ALSO

125       ldap(3LDAP),             ldap_add(3LDAP),            ldap_error(3LDAP),
126       ldap_get_option(3LDAP), attributes(5)
127
128
129
130SunOS 5.11                        28 Jan 2002               ldap_modify(3LDAP)
Impressum