ldap/servers/slapd/index_subsystem.c | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit b6be68c54078ec17bf38e5186a26e9d71bbb9644
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 14:28:27 2015 -0700
Ticket #48265 - Complex filter in a search request doen't work as expected. (regression)
Description: commit c2658c14802783d0a8919783aa7123be9e749c18 to fix
Ticket 47521 - Complex filter in a search request doen't work as expected.
regressed this case:
"(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(|(uid=*test*)(cn=*test*))(o=X))"
in which a simple filter follows a complex filter which choice is
different from the outer choice. I.e., '|' for (uid=...)(cn=...)
is different from the first '&'.
The fix for 47521 solves this case:
"(&(&(uid=A)(cn=B))(&(givenname=C))(mail=D)(&(description=E)))"
in this case, (mail=D) used to be dropped from the filter in the
function index_subsys_flatten_filter.
The 47521 fix saved the simple filter "(mail=D)" in the 2nd example,
but it forced to skip the complex filter with the different choice
and converted the 1st example to:
"(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(o=X))"
This patch saves such a complex filter, as well.
https://fedorahosted.org/389/ticket/48265
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit 8c3d3e4648fbb5229e329e2154d46f1ae808ba02)
(cherry picked from commit 3d9dbf2d441e551495a1f3169dc2020324c484b4)
diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c
index eff908e..d0ba1bd 100644
--- a/ldap/servers/slapd/index_subsystem.c
+++ b/ldap/servers/slapd/index_subsystem.c
@@ -441,6 +441,11 @@ static void index_subsys_flatten_filter(Slapi_Filter *flist)
}
else
{
+ /* don't loose a nested filter having a different choice */
+ if (flast) {
+ flast->f_next = f;
+ flast = f;
+ }
fprev = f;
f = f->f_next;
}
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org
dirsrvtests/tickets/ticket48265_test.py | 130 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/index_subsystem.c | 5 +
2 files changed, 135 insertions(+)
New commits:
commit ffbc6be3be7328d93991cec7198cd0933b55e243
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Sep 3 10:16:05 2015 -0700
Ticket #48265 - CI test: added test cases for ticket 48265
Description: Complex filter in a search request doen't work as expected.
(cherry picked from commit bb596ce2170ca956f9cb80e7727f6ebbd46d4834)
diff --git a/dirsrvtests/tickets/ticket48265_test.py b/dirsrvtests/tickets/ticket48265_test.py
new file mode 100644
index 0000000..fb695c5
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48265_test.py
@@ -0,0 +1,130 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+import threading
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+USER_NUM = 20
+TEST_USER = 'test_user'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating standalone instance ...
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ standalone.delete()
+ standalone.create()
+ standalone.open()
+
+ return TopologyStandalone(standalone)
+
+
+def test_ticket48265_test(topology):
+ """
+ Complex filter issues
+ Ticket 47521 type complex filter:
+ (&(|(uid=tuser*)(cn=Test user*))(&(givenname=test*3))(mail=tuser(a)example.com)(&(description=*)))
+ Ticket 48264 type complex filter:
+ (&(&(|(l=EU)(l=AP)(l=NA))(|(c=SE)(c=DE)))(|(uid=*test*)(cn=*test*))(l=eu))
+ """
+
+ log.info("Adding %d test entries..." % USER_NUM)
+ for id in range(USER_NUM):
+ name = "%s%d" % (TEST_USER, id)
+ mail = "%s(a)example.com" % name
+ secretary = "cn=%s,ou=secretary,%s" % (name, SUFFIX)
+ topology.standalone.add_s(Entry(("cn=%s,%s" % (name, SUFFIX), {
+ 'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'sn': name,
+ 'cn': name,
+ 'uid': name,
+ 'givenname': 'test',
+ 'mail': mail,
+ 'description': 'description',
+ 'secretary': secretary,
+ 'l': 'MV',
+ 'title': 'Engineer'})))
+
+ log.info("Search with Ticket 47521 type complex filter")
+ for id in range(USER_NUM):
+ name = "%s%d" % (TEST_USER, id)
+ mail = "%s(a)example.com" % name
+ filter47521 = '(&(|(uid=%s*)(cn=%s*))(&(givenname=test))(mail=%s)(&(description=*)))' % (TEST_USER, TEST_USER, mail)
+ entry = topology.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, filter47521)
+ assert len(entry) == 1
+
+ log.info("Search with Ticket 48265 type complex filter")
+ for id in range(USER_NUM):
+ name = "%s%d" % (TEST_USER, id)
+ mail = "%s(a)example.com" % name
+ filter48265 = '(&(&(|(l=AA)(l=BB)(l=MV))(|(title=admin)(title=engineer)))(|(uid=%s)(mail=%s))(description=description))' % (name, mail)
+ entry = topology.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, filter48265)
+ assert len(entry) == 1
+
+ log.info('Test 48265 complete\n')
+
+
+def test_ticket48265_final(topology):
+ topology.standalone.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation1_prefix
+ installation1_prefix = None
+
+ topo = topology(True)
+ log.info('Testing Ticket 48265 - Complex filter in a search request does not work as expected')
+
+ test_ticket48265_test(topo)
+
+ test_ticket48265_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
commit 3d9dbf2d441e551495a1f3169dc2020324c484b4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 14:28:27 2015 -0700
Ticket #48265 - Complex filter in a search request doen't work as expected. (regression)
Description: commit c2658c14802783d0a8919783aa7123be9e749c18 to fix
Ticket 47521 - Complex filter in a search request doen't work as expected.
regressed this case:
"(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(|(uid=*test*)(cn=*test*))(o=X))"
in which a simple filter follows a complex filter which choice is
different from the outer choice. I.e., '|' for (uid=...)(cn=...)
is different from the first '&'.
The fix for 47521 solves this case:
"(&(&(uid=A)(cn=B))(&(givenname=C))(mail=D)(&(description=E)))"
in this case, (mail=D) used to be dropped from the filter in the
function index_subsys_flatten_filter.
The 47521 fix saved the simple filter "(mail=D)" in the 2nd example,
but it forced to skip the complex filter with the different choice
and converted the 1st example to:
"(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(o=X))"
This patch saves such a complex filter, as well.
https://fedorahosted.org/389/ticket/48265
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit 8c3d3e4648fbb5229e329e2154d46f1ae808ba02)
diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c
index fdaef6a..93bf9d5 100644
--- a/ldap/servers/slapd/index_subsystem.c
+++ b/ldap/servers/slapd/index_subsystem.c
@@ -412,6 +412,11 @@ static void index_subsys_flatten_filter(Slapi_Filter *flist)
}
else
{
+ /* don't loose a nested filter having a different choice */
+ if (flast) {
+ flast->f_next = f;
+ flast = f;
+ }
fprev = f;
f = f->f_next;
}
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org
dirsrvtests/tickets/ticket48265_test.py | 130 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/index_subsystem.c | 5 +
2 files changed, 135 insertions(+)
New commits:
commit bb596ce2170ca956f9cb80e7727f6ebbd46d4834
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Sep 3 10:16:05 2015 -0700
Ticket #48265 - CI test: added test cases for ticket 48265
Description: Complex filter in a search request doen't work as expected.
diff --git a/dirsrvtests/tickets/ticket48265_test.py b/dirsrvtests/tickets/ticket48265_test.py
new file mode 100644
index 0000000..fb695c5
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48265_test.py
@@ -0,0 +1,130 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+import threading
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+USER_NUM = 20
+TEST_USER = 'test_user'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating standalone instance ...
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ standalone.delete()
+ standalone.create()
+ standalone.open()
+
+ return TopologyStandalone(standalone)
+
+
+def test_ticket48265_test(topology):
+ """
+ Complex filter issues
+ Ticket 47521 type complex filter:
+ (&(|(uid=tuser*)(cn=Test user*))(&(givenname=test*3))(mail=tuser(a)example.com)(&(description=*)))
+ Ticket 48264 type complex filter:
+ (&(&(|(l=EU)(l=AP)(l=NA))(|(c=SE)(c=DE)))(|(uid=*test*)(cn=*test*))(l=eu))
+ """
+
+ log.info("Adding %d test entries..." % USER_NUM)
+ for id in range(USER_NUM):
+ name = "%s%d" % (TEST_USER, id)
+ mail = "%s(a)example.com" % name
+ secretary = "cn=%s,ou=secretary,%s" % (name, SUFFIX)
+ topology.standalone.add_s(Entry(("cn=%s,%s" % (name, SUFFIX), {
+ 'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'sn': name,
+ 'cn': name,
+ 'uid': name,
+ 'givenname': 'test',
+ 'mail': mail,
+ 'description': 'description',
+ 'secretary': secretary,
+ 'l': 'MV',
+ 'title': 'Engineer'})))
+
+ log.info("Search with Ticket 47521 type complex filter")
+ for id in range(USER_NUM):
+ name = "%s%d" % (TEST_USER, id)
+ mail = "%s(a)example.com" % name
+ filter47521 = '(&(|(uid=%s*)(cn=%s*))(&(givenname=test))(mail=%s)(&(description=*)))' % (TEST_USER, TEST_USER, mail)
+ entry = topology.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, filter47521)
+ assert len(entry) == 1
+
+ log.info("Search with Ticket 48265 type complex filter")
+ for id in range(USER_NUM):
+ name = "%s%d" % (TEST_USER, id)
+ mail = "%s(a)example.com" % name
+ filter48265 = '(&(&(|(l=AA)(l=BB)(l=MV))(|(title=admin)(title=engineer)))(|(uid=%s)(mail=%s))(description=description))' % (name, mail)
+ entry = topology.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, filter48265)
+ assert len(entry) == 1
+
+ log.info('Test 48265 complete\n')
+
+
+def test_ticket48265_final(topology):
+ topology.standalone.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation1_prefix
+ installation1_prefix = None
+
+ topo = topology(True)
+ log.info('Testing Ticket 48265 - Complex filter in a search request does not work as expected')
+
+ test_ticket48265_test(topo)
+
+ test_ticket48265_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
commit 8c3d3e4648fbb5229e329e2154d46f1ae808ba02
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 14:28:27 2015 -0700
Ticket #48265 - Complex filter in a search request doen't work as expected. (regression)
Description: commit c2658c14802783d0a8919783aa7123be9e749c18 to fix
Ticket 47521 - Complex filter in a search request doen't work as expected.
regressed this case:
"(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(|(uid=*test*)(cn=*test*))(o=X))"
in which a simple filter follows a complex filter which choice is
different from the outer choice. I.e., '|' for (uid=...)(cn=...)
is different from the first '&'.
The fix for 47521 solves this case:
"(&(&(uid=A)(cn=B))(&(givenname=C))(mail=D)(&(description=E)))"
in this case, (mail=D) used to be dropped from the filter in the
function index_subsys_flatten_filter.
The 47521 fix saved the simple filter "(mail=D)" in the 2nd example,
but it forced to skip the complex filter with the different choice
and converted the 1st example to:
"(&(&(|(l=A)(l=B)(l=C))(|(C=D)(c=E)))(o=X))"
This patch saves such a complex filter, as well.
https://fedorahosted.org/389/ticket/48265
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c
index fdaef6a..93bf9d5 100644
--- a/ldap/servers/slapd/index_subsystem.c
+++ b/ldap/servers/slapd/index_subsystem.c
@@ -412,6 +412,11 @@ static void index_subsys_flatten_filter(Slapi_Filter *flist)
}
else
{
+ /* don't loose a nested filter having a different choice */
+ if (flast) {
+ flast->f_next = f;
+ flast = f;
+ }
fprev = f;
f = f->f_next;
}
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org
ldap/servers/plugins/cos/cos_cache.c | 1 -
1 file changed, 1 deletion(-)
New commits:
commit d2b69d51c2d1d7d53be881b0e816b5088295a9c1
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 18:04:27 2015 -0700
Ticket #47981 - COS cache doesn't properly mark vattr cache as invalid when there are multiple suffixes
Description: commit 42e2df3858a4e14706d57b5c907d1d3768f4d970 for fixing
icket 47981 accidentally added "break" to the while loop when a
condition is satisfied:
if(!cos_cache_add_dn_defs(suffixVals[valIndex]->bv_val ,pDefs))
which skips the rest of the definitions. This patch removes the
"break".
https://fedorahosted.org/389/ticket/47981
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit 6557b820dca7980067afc2a33184197b2d154a51)
(cherry picked from commit c1721f1d6e2344eefaec817ed47119c15c43fcfc)
(cherry picked from commit 546aa6b1f4db1eefc426d3dcb6788f5251fd1e82)
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index f41c3de..94c8d77 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -716,7 +716,6 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
{
*vattr_cacheable = -1;
cos_def_available = 1;
- break;
}
}
valIndex++;
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org
ldap/servers/plugins/cos/cos_cache.c | 1 -
1 file changed, 1 deletion(-)
New commits:
commit 546aa6b1f4db1eefc426d3dcb6788f5251fd1e82
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 18:04:27 2015 -0700
Ticket #47981 - COS cache doesn't properly mark vattr cache as invalid when there are multiple suffixes
Description: commit 42e2df3858a4e14706d57b5c907d1d3768f4d970 for fixing
icket 47981 accidentally added "break" to the while loop when a
condition is satisfied:
if(!cos_cache_add_dn_defs(suffixVals[valIndex]->bv_val ,pDefs))
which skips the rest of the definitions. This patch removes the
"break".
https://fedorahosted.org/389/ticket/47981
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit 6557b820dca7980067afc2a33184197b2d154a51)
(cherry picked from commit c1721f1d6e2344eefaec817ed47119c15c43fcfc)
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index 7d8e877..6c1bec0 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -676,7 +676,6 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
{
*vattr_cacheable = -1;
cos_def_available = 1;
- break;
}
}
valIndex++;
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org
ldap/servers/plugins/cos/cos_cache.c | 1 -
1 file changed, 1 deletion(-)
New commits:
commit c1721f1d6e2344eefaec817ed47119c15c43fcfc
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 18:04:27 2015 -0700
Ticket #47981 - COS cache doesn't properly mark vattr cache as invalid when there are multiple suffixes
Description: commit 42e2df3858a4e14706d57b5c907d1d3768f4d970 for fixing
icket 47981 accidentally added "break" to the while loop when a
condition is satisfied:
if(!cos_cache_add_dn_defs(suffixVals[valIndex]->bv_val ,pDefs))
which skips the rest of the definitions. This patch removes the
"break".
https://fedorahosted.org/389/ticket/47981
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit 6557b820dca7980067afc2a33184197b2d154a51)
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index ddb85ab..e0b841d 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -647,7 +647,6 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
{
*vattr_cacheable = -1;
cos_def_available = 1;
- break;
}
}
valIndex++;
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org
ldap/servers/plugins/cos/cos_cache.c | 1 -
1 file changed, 1 deletion(-)
New commits:
commit 6557b820dca7980067afc2a33184197b2d154a51
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 2 18:04:27 2015 -0700
Ticket #47981 - COS cache doesn't properly mark vattr cache as invalid when there are multiple suffixes
Description: commit 42e2df3858a4e14706d57b5c907d1d3768f4d970 for fixing
icket 47981 accidentally added "break" to the while loop when a
condition is satisfied:
if(!cos_cache_add_dn_defs(suffixVals[valIndex]->bv_val ,pDefs))
which skips the rest of the definitions. This patch removes the
"break".
https://fedorahosted.org/389/ticket/47981
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index ddb85ab..e0b841d 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -647,7 +647,6 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
{
*vattr_cacheable = -1;
cos_def_available = 1;
- break;
}
}
valIndex++;
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org