ldap_modify_ext_s() instead.
#include <ldap.h>
int ldap_modify_s( LDAP *ld, const char *dn, LDAPMod **mods );
ld |
Connection handle, which is a pointer to an |
dn | |
mods |
Pointer to a NULL-terminated array of pointers to |
ldap_modify_ext_s() function.
ldap_modify_s() function updates an entry in the directory.
A newer version of this function, ldap_modify_ext_s(), is available in this release of the LDAP API. ldap_modify_s() (the older version of the function) is included only for backward-compatibility. If you are writing a new LDAP client, use ldap_modify_ext_s() instead of ldap_modify_s().
If you want more information on ldap_modify_s(), refer to the LDAP C SDK 1.0 Programmer's Guide.
ldap_modify_s() function to makes the following changes to the "Barbara Jensen" entry:
homePhone attribute. telephoneNumber attribute. facsimileTelephoneNumber attribute. #include <ldap.h>
...
LDAP *ld;
LDAPMod *list_of_attrs[4];
LDAPMod attribute1, attribute2, attribute3;
LDAPControl **srvrctrls, **clntctrls;
/* Distinguished name of the entry that you want to modify. */
char *dn = "uid=bjensen, ou=People, o=Airius.com";
/* Values to add or change */
char *homePhone_values[] = { "555-1212", NULL };char *telephoneNumber_values[] = { "869-5309", NULL };...
/* Specify each change in separate LDAPMod structures */
attribute1.mod_type = "homePhone";
attribute1.mod_op = LDAP_MOD_ADD;
attribute1.mod_values = homePhone_values;
attribute2.mod_type = "telephoneNumber";
attribute2.mod_op = LDAP_MOD_REPLACE;
attribute2.mod_values = telephoneNumber_values;
attribute3.mod_type = "facsimileTelephoneNumber";
attribute3.mod_op = LDAP_MOD_DELETE;
attribute3.mod_values = NULL;
/* NOTE: When removing entire attributes, you need to specify a NULL value for the mod_values or mod_bvalues field. */
/* Add the pointers to these LDAPMod structures to an array */
list_of_attrs[0] = &attribute1;
list_of_attrs[1] = &attribute2;
list_of_attrs[2] = &attribute3;
list_of_attrs[3] = NULL;
...
/* Change the entry */
if ( ldap_modify_s( ld, dn, list_of_attrs ) != LDAP_SUCCESS ) {ldap_perror( ld, "ldap_modify_s" );
return( 1 );
}
...
ldap_modify_ext_s().
Last Updated: 10/01/98 17:06:23