ldap/servers/plugins/replication/windows_protocol_util.c | 20 ++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
New commits:
commit d6deb25c214e523b582a246ed60ac15d3f65c271
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 23 14:19:03 2012 -0600
Ticket #324 - Sync with group attribute containing () fails
https://fedorahosted.org/389/ticket/324
Resolves: Ticket #324
Bug Description: Sync with group attribute containing () fails
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: When constructing the ldap filter used to retrieve the
entry, the values must be filter escaped.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c
b/ldap/servers/plugins/replication/windows_protocol_util.c
index eb7fd00..0c16bdd 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -2789,8 +2789,15 @@ find_entry_by_attr_value_remote(const char *attribute, const char
*value, Slapi_
char *filter = NULL;
const char *searchbase = NULL;
Slapi_Entry *found_entry = NULL;
-
- filter = PR_smprintf("(%s=%s)",attribute,value);
+ char *filter_escaped_value = NULL;
+ size_t vallen = 0;
+
+ vallen = value ? strlen(value) : 0;
+ filter_escaped_value = slapi_ch_calloc(sizeof(char), vallen*3+1);
+ escape_filter_value(value, vallen, filter_escaped_value);
+ /* should not have to escape attribute names */
+ filter = PR_smprintf("(%s=%s)",attribute,filter_escaped_value);
+ slapi_ch_free_string(&filter_escaped_value);
searchbase = slapi_sdn_get_dn(windows_private_get_windows_subtree(prp->agmt));
cres = windows_search_entry(prp->conn, (char*)searchbase, filter, &found_entry);
if (cres)
@@ -2915,11 +2922,18 @@ find_entry_by_attr_value(const char *attribute, const char *value,
Slapi_Entry *
int scope = LDAP_SCOPE_SUBTREE;
char **attrs = NULL;
LDAPControl **server_controls = NULL;
+ char *filter_escaped_value = NULL;
+ size_t vallen = 0;
if (pb == NULL)
goto done;
- query = slapi_ch_smprintf("(%s=%s)", attribute, value);
+ vallen = value ? strlen(value) : 0;
+ filter_escaped_value = slapi_ch_calloc(sizeof(char), vallen*3+1);
+ escape_filter_value(value, vallen, filter_escaped_value);
+ /* should not have to escape attribute names */
+ query = slapi_ch_smprintf("(%s=%s)", attribute, filter_escaped_value);
+ slapi_ch_free_string(&filter_escaped_value);
if (query == NULL)
goto done;