diff options
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-ldap.c | 18 |
2 files changed, 12 insertions, 14 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d7f2827dd3..252425b7bf 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-07-25 Chris Toshok <toshok@ximian.com> + + * backend/pas/pas-backend-ldap.c (func_contains): change the way + x-evolution-any-field is converted to an ldap query. it used to + be we'd nest queries like: (|(|(|(foo=*x*))(bar=*x*))(baz=*x*)). + now we build it like: (|(foo=*x*)(bar=*x*)(baz=*x*)). much more + efficient (both in the building, and on the server side no doubt). + 2001-07-25 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-destination.c (e_destination_get_name): Properly dup diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 056e56f28f..f4d0fc78a9 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -1539,39 +1539,29 @@ func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data int i; int query_length; char *big_query; - char *header, *footer; char *match_str; - header = g_malloc0((num_prop_infos - 1) * 2 + 1); - footer = g_malloc0(num_prop_infos + 1); - for (i = 0; i < num_prop_infos - 1; i ++) { - strcat (header, "(|"); - strcat (footer, ")"); - } - match_str = g_strdup_printf("=*%s%s)", str, one_star ? "" : "*"); - query_length = strlen (header) + strlen (footer); + query_length = 3; /* strlen ("(|") + strlen (")") */ for (i = 0; i < num_prop_infos; i ++) { - query_length += 1 + strlen(prop_info[i].ldap_attr) + strlen (match_str); + query_length += 1 /* strlen ("(") */ + strlen(prop_info[i].ldap_attr) + strlen (match_str); } big_query = g_malloc0(query_length + 1); - strcat (big_query, header); + strcat (big_query, "(|"); for (i = 0; i < num_prop_infos; i ++) { strcat (big_query, "("); strcat (big_query, prop_info[i].ldap_attr); strcat (big_query, match_str); } - strcat (big_query, footer); + strcat (big_query, ")"); *list = g_list_prepend(*list, big_query); g_free (match_str); - g_free (header); - g_free (footer); } else { char *ldap_attr = query_prop_to_ldap(propname); |