This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.3.8
in repository 389-ds-base.
commit 1c5b9b03151ad312e0d6c7cc535062df1b7061da
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Fri Aug 24 16:30:10 2018 -0400
Revert "Ticket 49432 - filter optimise crash"
This reverts commit d8d57c9b472591628f630bfdc15a6f4db80035ad.
---
Makefile.am | 1 -
ldap/servers/slapd/filter.c | 30 ++++++---------
test/libslapd/filter/optimise.c | 83 -----------------------------------------
test/libslapd/test.c | 1 -
test/test_slapd.h | 3 --
5 files changed, 12 insertions(+), 106 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 3f7bb10..5d570aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2004,7 +2004,6 @@ TESTS = test_slapd \
test_slapd_SOURCES = test/main.c \
test/libslapd/test.c \
test/libslapd/counters/atomic.c \
- test/libslapd/filter/optimise.c \
test/libslapd/pblock/analytics.c \
test/libslapd/pblock/v3_compat.c \
test/libslapd/operation/v3_compat.c \
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 46a2266..87ec0de 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -1561,28 +1561,22 @@ filter_prioritise_element(Slapi_Filter **list, Slapi_Filter **head, Slapi_Filter
static void
filter_merge_subfilter(Slapi_Filter **list, Slapi_Filter **f_prev, Slapi_Filter **f_cur, Slapi_Filter **f_next) {
-
- /* First, graft in the new item between f_cur and f_cur -> f_next */
- Slapi_Filter *remainder = (*f_cur)->f_next;
- (*f_cur)->f_next = (*f_cur)->f_list;
- /* Go to the end of the newly grafted list, and put in our remainder. */
- Slapi_Filter *f_cur_tail = *f_cur;
- while (f_cur_tail->f_next != NULL) {
- f_cur_tail = f_cur_tail->f_next;
- }
- f_cur_tail->f_next = remainder;
-
- /* Now indicate to the caller what the next element is. */
- *f_next = (*f_cur)->f_next;
-
- /* Now that we have grafted our list in, cut out f_cur */
+ /* Cut our current AND/OR out */
if (*f_prev != NULL) {
- (*f_prev)->f_next = *f_next;
+ (*f_prev)->f_next = (*f_cur)->f_next;
} else if (*list == *f_cur) {
- *list = *f_next;
+ *list = (*f_cur)->f_next;
}
+ (*f_next) = (*f_cur)->f_next;
- /* Finally free the f_cur (and/or) */
+ /* Look ahead to the end of our list, without the f_cur. */
+ Slapi_Filter *f_cur_tail = *list;
+ while (f_cur_tail->f_next != NULL) {
+ f_cur_tail = f_cur_tail->f_next;
+ }
+ /* Now append our descendant into the tail */
+ f_cur_tail->f_next = (*f_cur)->f_list;
+ /* Finally free the remainder */
slapi_filter_free(*f_cur, 0);
}
diff --git a/test/libslapd/filter/optimise.c b/test/libslapd/filter/optimise.c
deleted file mode 100644
index bcf4ccd..0000000
--- a/test/libslapd/filter/optimise.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * Copyright (C) 2017 Red Hat, Inc.
- * All rights reserved.
- *
- * License: GPL (version 3 or any later version).
- * See LICENSE for details.
- * END COPYRIGHT BLOCK **/
-
-#include "../../test_slapd.h"
-
-/* To access filter optimise */
-#include <slapi-private.h>
-
-void
-test_libslapd_filter_optimise(void **state __attribute__((unused)))
-{
- char *test_filters[] = {
- "(&(uid=uid1)(sn=last1)(givenname=first1))",
- "(&(uid=uid1)(&(sn=last1)(givenname=first1)))",
- "(&(uid=uid1)(&(&(sn=last1))(&(givenname=first1))))",
- "(&(uid=*)(sn=last3)(givenname=*))",
- "(&(uid=*)(&(sn=last3)(givenname=*)))",
- "(&(uid=uid5)(&(&(sn=*))(&(givenname=*))))",
- "(&(objectclass=*)(uid=*)(sn=last*))",
- "(&(objectclass=*)(uid=*)(sn=last1))",
-
- "(|(uid=uid1)(sn=last1)(givenname=first1))",
- "(|(uid=uid1)(|(sn=last1)(givenname=first1)))",
- "(|(uid=uid1)(|(|(sn=last1))(|(givenname=first1))))",
- "(|(objectclass=*)(sn=last1)(|(givenname=first1)))",
- "(|(&(objectclass=*)(sn=last1))(|(givenname=first1)))",
- "(|(&(objectclass=*)(sn=last))(|(givenname=first1)))",
-
- "(&(uid=uid1)(!(cn=NULL)))",
- "(&(!(cn=NULL))(uid=uid1))",
- "(&(uid=*)(&(!(uid=1))(!(givenname=first1))))",
-
- "(&(|(uid=uid1)(uid=NULL))(sn=last1))",
- "(&(|(uid=uid1)(uid=NULL))(!(sn=NULL)))",
- "(&(|(uid=uid1)(sn=last2))(givenname=first1))",
- "(|(&(uid=uid1)(!(uid=NULL)))(sn=last2))",
- "(|(&(uid=uid1)(uid=NULL))(sn=last2))",
- "(&(uid=uid5)(sn=*)(cn=*)(givenname=*)(uid=u*)(sn=la*)(cn=full*)(givenname=f*)(uid>=u)(!(givenname=NULL)))",
- "(|(&(objectclass=*)(sn=last))(&(givenname=first1)))",
-
- "(&(uid=uid1)(sn=last1)(givenname=NULL))",
- "(&(uid=uid1)(&(sn=last1)(givenname=NULL)))",
- "(&(uid=uid1)(&(&(sn=last1))(&(givenname=NULL))))",
- "(&(uid=uid1)(&(&(sn=last1))(&(givenname=NULL)(sn=*)))(|(sn=NULL)))",
- "(&(uid=uid1)(&(&(sn=last*))(&(givenname=first*)))(&(sn=NULL)))",
-
- "(|(uid=NULL)(sn=NULL)(givenname=NULL))",
- "(|(uid=NULL)(|(sn=NULL)(givenname=NULL)))",
- "(|(uid=NULL)(|(|(sn=NULL))(|(givenname=NULL))))",
-
- "(uid>=uid3)",
- "(&(uid=*)(uid>=uid3))",
- "(|(uid>=uid3)(uid<=uid5))",
- "(&(uid>=uid3)(uid<=uid5))",
- "(|(&(uid>=uid3)(uid<=uid5))(uid=*))",
-
- "(|(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
- "(uid=*))",
- NULL
- };
-
- for (size_t i = 0; test_filters[i] != NULL; i++) {
- char *filter_str = slapi_ch_strdup(test_filters[i]);
-
- struct slapi_filter *filter = slapi_str2filter(filter_str);
- slapi_filter_optimise(filter);
- slapi_filter_free(filter, 1);
- slapi_ch_free_string(&filter_str);
- }
-}
-
diff --git a/test/libslapd/test.c b/test/libslapd/test.c
index 02c6c03..ffa650d 100644
--- a/test/libslapd/test.c
+++ b/test/libslapd/test.c
@@ -28,7 +28,6 @@ run_libslapd_tests(void)
cmocka_unit_test(test_libslapd_operation_v3c_target_spec),
cmocka_unit_test(test_libslapd_counters_atomic_usage),
cmocka_unit_test(test_libslapd_counters_atomic_overflow),
- cmocka_unit_test(test_libslapd_filter_optimise),
cmocka_unit_test(test_libslapd_pal_meminfo),
cmocka_unit_test(test_libslapd_util_cachesane),
};
diff --git a/test/test_slapd.h b/test/test_slapd.h
index efccaea..ad4f73f 100644
--- a/test/test_slapd.h
+++ b/test/test_slapd.h
@@ -26,9 +26,6 @@ int run_plugin_tests(void);
/* libslapd */
void test_libslapd_hello(void **state);
-/* libslapd-filter-optimise */
-void test_libslapd_filter_optimise(void **state);
-
/* libslapd-pblock-analytics */
void test_libslapd_pblock_analytics(void **state);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org/message/45CNQ64E2FOQXX2Q3K4YVPAGJETMPISZ/
No comments:
Post a Comment