aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorghenry <ghenry@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-12 16:21:53 +0000
committerghenry <ghenry@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-12 16:21:53 +0000
commitcc3aca8647d775514d11533ec445a6cc341da765 (patch)
treea1b073995eb1579aa08a264f6b5d6157068521fd /res
parent58eea662ee2e64af46370e685ba8118fc7737caf (diff)
Merged revisions 211767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r211767 | ghenry | 2009-08-12 17:00:46 +0100 (Wed, 12 Aug 2009) | 33 lines Added three new attributes and applied a patch to res_config_ldap.c attributetype ( AstAccountSubscribeContext NAME 'AstAccountSubscribeContext' DESC 'Asterisk subscribe context' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) attributetype ( AstAccountIpAddr NAME 'AstAccountIpAddr' DESC 'Asterisk aaccount IP address' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) attributetype ( AstAccountUserAgent NAME 'AstAccountUserAgent' DESC 'Asterisk account user context' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15) and patch fix_empty_attributes_1.6.1.4_v2.patch (closes issue #13725) Reported by: macogeek Patches: fix_empty_attributes_1.6.1.4_v2.patch uploaded by xvisor (license 863) Tested by: suretec ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@211785 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_config_ldap.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index c70574139..d06476279 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1229,16 +1229,21 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
mods_size++;
ldap_mods = ast_realloc(ldap_mods, sizeof(LDAPMod *) * mods_size);
ldap_mods[mods_size - 1] = NULL;
+
ldap_mods[mods_size - 2] = ast_calloc(1, sizeof(LDAPMod));
- ldap_mods[mods_size - 2]->mod_op = LDAP_MOD_REPLACE;
-
ldap_mods[mods_size - 2]->mod_type = ast_calloc(sizeof(char), strlen(newparam) + 1);
strcpy(ldap_mods[mods_size - 2]->mod_type, newparam);
- ldap_mods[mods_size - 2]->mod_values = ast_calloc(sizeof(char *), 2);
- ldap_mods[mods_size - 2]->mod_values[0] = ast_calloc(sizeof(char), strlen(newval) + 1);
- strcpy(ldap_mods[mods_size - 2]->mod_values[0], newval);
+ if (strlen(newval) == 0) {
+ ldap_mods[mods_size - 2]->mod_op = LDAP_MOD_DELETE;
+ } else {
+ ldap_mods[mods_size - 2]->mod_op = LDAP_MOD_REPLACE;
+
+ ldap_mods[mods_size - 2]->mod_values = ast_calloc(sizeof(char *), 2);
+ ldap_mods[mods_size - 2]->mod_values[0] = ast_calloc(sizeof(char), strlen(newval) + 1);
+ strcpy(ldap_mods[mods_size - 2]->mod_values[0], newval);
+ }
}
}
/* freeing ldap_mods further down */
@@ -1280,9 +1285,13 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
/* Ready to update */
if ((num_entries = ldap_count_entries(ldapConn, ldap_result_msg)) > 0) {
ast_debug(3, "LINE(%d) Modifying %s=%s hits: %d\n", __LINE__, attribute, lookup, num_entries);
- for (i = 0; option_debug > 2 && i < mods_size - 1; i++)
- ast_debug(3, "LINE(%d) %s=%s \n", __LINE__, ldap_mods[i]->mod_type, ldap_mods[i]->mod_values[0]);
-
+ for (i = 0; option_debug > 2 && i < mods_size - 1; i++) {
+ if (ldap_mods[i]->mod_op != LDAP_MOD_DELETE) {
+ ast_debug(3, "LINE(%d) %s=%s \n", __LINE__, ldap_mods[i]->mod_type, ldap_mods[i]->mod_values[0]);
+ } else {
+ ast_debug(3, "LINE(%d) deleting %s \n", __LINE__, ldap_mods[i]->mod_type);
+ }
+ }
ldap_entry = ldap_first_entry(ldapConn, ldap_result_msg);
for (i = 0; ldap_entry; i++) {