diff options
author | zuul <zuul@gerrit.asterisk.org> | 2017-02-21 17:57:24 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-02-21 17:57:24 -0600 |
commit | d5e25d8e3d8702587d8f72f48c3dc9f5aee041e7 (patch) | |
tree | 027f87c7e121f5082306b7222bbdd923c89280ff /res | |
parent | 16b0bb39c13e75b4d01c00aebb1d61b83f919a76 (diff) | |
parent | d6d86f1c09f041ef00c1d106d924cf918172974a (diff) |
Merge "res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modify"
Diffstat (limited to 'res')
-rw-r--r-- | res/res_config_ldap.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c index 5e95853d4..a8a8fe696 100644 --- a/res/res_config_ldap.c +++ b/res/res_config_ldap.c @@ -1292,12 +1292,15 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a mods_size = 2; /* one for the first param/value pair and one for the the terminating NULL */ ldap_mods = ldap_memcalloc(sizeof(LDAPMod *), mods_size); ldap_mods[0] = ldap_memcalloc(1, sizeof(LDAPMod)); - - ldap_mods[0]->mod_op = LDAP_MOD_REPLACE; ldap_mods[0]->mod_type = ldap_strdup(newparam); - ldap_mods[0]->mod_values = ast_calloc(sizeof(char *), 2); - ldap_mods[0]->mod_values[0] = ldap_strdup(field->value); + if (strlen(field->value) == 0) { + ldap_mods[0]->mod_op = LDAP_MOD_DELETE; + } else { + ldap_mods[0]->mod_op = LDAP_MOD_REPLACE; + ldap_mods[0]->mod_values = ast_calloc(sizeof(char *), 2); + ldap_mods[0]->mod_values[0] = ldap_strdup(field->value); + } while ((field = field->next)) { newparam = convert_attribute_name_to_ldap(table_config, field->name); |