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

74 lines
2.4 KiB
Diff
Raw Normal View History

2007-12-03 23:05:27 +00:00
diff -up evolution-data-server-2.21.3/addressbook/backends/ldap/e-book-backend-ldap.c.fix-ldap-query evolution-data-server-2.21.3/addressbook/backends/ldap/e-book-backend-ldap.c
--- evolution-data-server-2.21.3/addressbook/backends/ldap/e-book-backend-ldap.c.fix-ldap-query 2007-11-29 07:53:49.000000000 -0500
+++ evolution-data-server-2.21.3/addressbook/backends/ldap/e-book-backend-ldap.c 2007-12-03 16:12:33.000000000 -0500
@@ -3339,22 +3339,28 @@ func_and(struct _ESExp *f, int argc, str
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 (")");
2007-12-03 23:05:27 +00:00
+ 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]);
2007-12-03 23:05:27 +00:00
@@ -3376,22 +3382,28 @@ func_or(struct _ESExp *f, int argc, stru
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]);
2007-12-03 23:05:27 +00:00
@@ -3540,6 +3552,7 @@ func_beginswith(struct _ESExp *f, int ar
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;