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

74 lines
2.4 KiB
Diff
Raw Normal View History

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;
if (argc > 0) {
2009-06-15 15:45:50 +00:00
- gint i;
+ gint i, empty;
2009-06-15 15:45:50 +00:00
strings = g_new0(gchar *, 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));
2009-06-15 15:45:50 +00:00
for (i = 0; i < argc + 2; i ++)
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;
if (argc > 0) {
2009-06-15 15:45:50 +00:00
- gint i;
+ gint i, empty;
2009-06-15 15:45:50 +00:00
strings = g_new0(gchar *, 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));
2009-06-15 15:45:50 +00:00
for (i = 0; i < argc + 2; i ++)
g_free (strings[i]);
2008-06-16 17:41:49 +00:00
@@ -3622,6 +3634,7 @@ func_beginswith(struct _ESExp *f, int ar
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 (""));
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.bool = FALSE;
return r;