evolution-data-server/evolution-data-server-1.8.0-fix-ldap-query.patch

73 lines
2.1 KiB
Diff
Raw Normal View History

--- evolution-data-server-1.8.0/addressbook/backends/ldap/e-book-backend-ldap.c.fix-ldap-query 2006-09-02 02:36:49.000000000 -0400
+++ evolution-data-server-1.8.0/addressbook/backends/ldap/e-book-backend-ldap.c 2007-07-02 14:21:14.000000000 -0400
@@ -3209,22 +3209,28 @@
char ** strings;
if (argc > 0) {
- int i;
+ int i, empty;
strings = g_new0(char*, argc+3);
strings[0] = g_strdup ("(&");
strings[argc+3 - 2] = g_strdup (")");
+ empty = 0;
for (i = 0; i < argc; i ++) {
GList *list_head = ldap_data->list;
if (!list_head)
break;
+ if (strlen (list_head->data) == 0)
+ empty++;
strings[argc - i] = list_head->data;
ldap_data->list = g_list_remove_link(list_head, list_head);
g_list_free_1(list_head);
}
- ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
+ if (empty == argc)
+ ldap_data->list = g_list_prepend(ldap_data->list, g_strdup(" "));
+ else
+ ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
for (i = 0 ; i < argc + 2; i ++)
g_free (strings[i]);
@@ -3246,22 +3252,28 @@
char ** strings;
if (argc > 0) {
- int i;
+ int i, empty;
strings = g_new0(char*, argc+3);
strings[0] = g_strdup ("(|");
strings[argc+3 - 2] = g_strdup (")");
+ empty = 0;
for (i = 0; i < argc; i ++) {
GList *list_head = ldap_data->list;
if (!list_head)
break;
+ if (strlen (list_head->data) == 0)
+ empty++;
strings[argc - i] = list_head->data;
ldap_data->list = g_list_remove_link(list_head, list_head);
g_list_free_1(list_head);
}
- ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
+ if (empty == argc)
+ ldap_data->list = g_list_prepend(ldap_data->list, g_strdup(" "));
+ else
+ ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
for (i = 0 ; i < argc + 2; i ++)
g_free (strings[i]);
@@ -3410,6 +3422,7 @@
char *ldap_attr = query_prop_to_ldap(propname);
if (strlen (str) == 0) {
+ ldap_data->list = g_list_prepend(ldap_data->list, g_strdup (""));
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.bool = FALSE;
return r;