2008-06-16 17:41:49 +00:00
|
|
|
diff -up evolution-data-server-2.23.4/addressbook/backends/ldap/e-book-backend-ldap.c.fix-ldap-query evolution-data-server-2.23.4/addressbook/backends/ldap/e-book-backend-ldap.c
|
|
|
|
--- evolution-data-server-2.23.4/addressbook/backends/ldap/e-book-backend-ldap.c.fix-ldap-query 2008-06-15 23:18:08.000000000 -0400
|
|
|
|
+++ evolution-data-server-2.23.4/addressbook/backends/ldap/e-book-backend-ldap.c 2008-06-16 10:34:29.000000000 -0400
|
2009-06-15 15:45:50 +00:00
|
|
|
@@ -3417,22 +3417,28 @@ func_and(struct _ESExp *f, gint argc, str
|
|
|
|
gchar ** strings;
|
2007-10-19 16:59:47 +00:00
|
|
|
|
|
|
|
if (argc > 0) {
|
2009-06-15 15:45:50 +00:00
|
|
|
- gint i;
|
|
|
|
+ gint i, empty;
|
2007-10-19 16:59:47 +00:00
|
|
|
|
2009-06-15 15:45:50 +00:00
|
|
|
strings = g_new0(gchar *, argc+3);
|
2007-10-19 16:59:47 +00:00
|
|
|
strings[0] = g_strdup ("(&");
|
|
|
|
strings[argc+3 - 2] = g_strdup (")");
|
2007-12-03 23:05:27 +00:00
|
|
|
|
2007-10-19 16:59:47 +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));
|
|
|
|
|
2009-06-15 15:45:50 +00:00
|
|
|
for (i = 0; i < argc + 2; i ++)
|
2007-10-19 16:59:47 +00:00
|
|
|
g_free (strings[i]);
|
2009-06-15 15:45:50 +00:00
|
|
|
@@ -3454,22 +3460,28 @@ func_or(struct _ESExp *f, gint argc, stru
|
|
|
|
gchar ** strings;
|
2007-10-19 16:59:47 +00:00
|
|
|
|
|
|
|
if (argc > 0) {
|
2009-06-15 15:45:50 +00:00
|
|
|
- gint i;
|
|
|
|
+ gint i, empty;
|
2007-10-19 16:59:47 +00:00
|
|
|
|
2009-06-15 15:45:50 +00:00
|
|
|
strings = g_new0(gchar *, argc+3);
|
2007-10-19 16:59:47 +00:00
|
|
|
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));
|
|
|
|
|
2009-06-15 15:45:50 +00:00
|
|
|
for (i = 0; i < argc + 2; i ++)
|
2007-10-19 16:59:47 +00:00
|
|
|
g_free (strings[i]);
|
2008-06-16 17:41:49 +00:00
|
|
|
@@ -3622,6 +3634,7 @@ func_beginswith(struct _ESExp *f, int ar
|
2007-10-19 16:59:47 +00:00
|
|
|
if (strlen (str) == 0) {
|
2008-06-16 17:41:49 +00:00
|
|
|
g_free (str);
|
|
|
|
|
|
|
|
+ ldap_data->list = g_list_prepend (ldap_data->list, g_strdup (""));
|
2007-10-19 16:59:47 +00:00
|
|
|
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
|
|
|
|
r->value.bool = FALSE;
|
|
|
|
return r;
|