diff options
author | zuul <zuul@gerrit.asterisk.org> | 2017-02-21 15:54:01 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-02-21 15:54:01 -0600 |
commit | 5333c2782c5a1ad952e6373f54b1a67e29231918 (patch) | |
tree | c4063cf48569a115270229f3c04a383fe8ba046e /res | |
parent | 90f661303362493ae92a26663635b1572630932b (diff) | |
parent | 6d5e9993b22f10d14cd221e32ac64f72430aa7c7 (diff) |
Merge "res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modify" into 13
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 fd21aab80..ea7bbadaa 100644 --- a/res/res_config_ldap.c +++ b/res/res_config_ldap.c @@ -1294,12 +1294,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); |