diff options
author | zuul <zuul@gerrit.asterisk.org> | 2017-02-21 17:10:55 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-02-21 17:10:55 -0600 |
commit | 49c3a3419be5a36c50d3f9bf31a171bc57ee4731 (patch) | |
tree | 630900d5fbf35d581b7eadadab9f4e52069edee1 /res/res_config_ldap.c | |
parent | 12f14dbaa35cd2232ce11e3cccdaf9b125476d9e (diff) | |
parent | 91d209e59032cf34e2954676ba95b676fe9af9d9 (diff) |
Merge "res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modify" into 14
Diffstat (limited to 'res/res_config_ldap.c')
-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 99e7736fc..bfc959f1c 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); |