瀏覽代碼

Ticket 48745 Matching Rule caseExactIA5Match indexes incorrectly values with upper cases

Bug Description:
    For new style MR plugin (majority of them) they do not have indexer_create function
    Instead they are assigned (SLAPI_PLUGIN_MR_INDEXER_CREATE_FN) default_mr_indexer_create.

    In slapi_mr_indexer_create, for compatibility reason, we first look for old style MR plugin,
    that define their indexer_create function. But when a new style MR plugin have been previously
    assigned default_mr_indexer_create, this function is called to create the indexer.

    It is called with the MR plugin (that will be use to index) and the MR plugin OID, at this
    point the function does not check if the MR plugin can handle the MR plugin OID.

Fix Description:
    Let default_mr_indexer_create check that the MR plugin is able to handle the OID

    (Plus fix for CI tests 48362/48270)

https://fedorahosted.org/389/ticket/48745

Reviewed by: William Brown (thanks William)

Platforms tested: F23

Flag Day: no

Doc impact: no
Thierry Bordaz 9 年之前
父節點
當前提交
d975431db1

+ 1 - 1
dirsrvtests/tests/tickets/ticket48270_test.py

@@ -34,7 +34,7 @@ class TopologyStandalone(object):
         self.standalone = standalone
 
 
-#@pytest.fixture(scope="module")
[email protected](scope="module")
 def topology(request):
     global installation1_prefix
     if installation1_prefix:

+ 5 - 19
dirsrvtests/tests/tickets/ticket48362_test.py

@@ -14,9 +14,6 @@ from lib389.utils import *
 logging.getLogger(__name__).setLevel(logging.DEBUG)
 log = logging.getLogger(__name__)
 
-installation1_prefix = None
-
-
 PEOPLE_OU='people'
 PEOPLE_DN = "ou=%s,%s" % (PEOPLE_OU, SUFFIX)
 MAX_ACCOUNTS=5
@@ -34,16 +31,11 @@ class TopologyReplication(object):
         self.master2 = master2
 
 
-#@pytest.fixture(scope="module")
[email protected](scope="module")
 def topology(request):
-    global installation1_prefix
-    if installation1_prefix:
-        args_instance[SER_DEPLOYED_DIR] = installation1_prefix
 
     # Creating master 1...
     master1 = DirSrv(verbose=False)
-    if installation1_prefix:
-        args_instance[SER_DEPLOYED_DIR] = installation1_prefix
     args_instance[SER_HOST] = HOST_MASTER_1
     args_instance[SER_PORT] = PORT_MASTER_1
     args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
@@ -59,8 +51,6 @@ def topology(request):
 
     # Creating master 2...
     master2 = DirSrv(verbose=False)
-    if installation1_prefix:
-        args_instance[SER_DEPLOYED_DIR] = installation1_prefix
     args_instance[SER_HOST] = HOST_MASTER_2
     args_instance[SER_PORT] = PORT_MASTER_2
     args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
@@ -244,7 +234,7 @@ def test_ticket48362(topology):
     assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
 
 
-    ent = topology.master1.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
+    ent = topology.master2.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
     log.info('\n======================== BEFORE RESTART ============================\n')
     assert(ent.hasAttr(BINDMETHOD_ATTR) and ent.getValue(BINDMETHOD_ATTR) == BINDMETHOD_VALUE)
     assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
@@ -260,7 +250,7 @@ def test_ticket48362(topology):
     assert(ent.hasAttr(BINDMETHOD_ATTR) and ent.getValue(BINDMETHOD_ATTR) == BINDMETHOD_VALUE)
     assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
 
-    ent = topology.master1.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
+    ent = topology.master2.getEntry(SHARE_CFG_BASE, ldap.SCOPE_ONELEVEL, "(dnaPortNum=%d)" % topology.master2.port)
     log.info('\n=================== AFTER RESTART =================================\n')
     assert(ent.hasAttr(BINDMETHOD_ATTR) and ent.getValue(BINDMETHOD_ATTR) == BINDMETHOD_VALUE)
     assert(ent.hasAttr(PROTOCOLE_ATTR) and ent.getValue(PROTOCOLE_ATTR) == PROTOCOLE_VALUE)
@@ -270,9 +260,5 @@ def test_ticket48362(topology):
 if __name__ == '__main__':
     # Run isolated
     # -s for DEBUG mode
-    global installation1_prefix
-    installation1_prefix='/home/tbordaz/install_1.3.4'
-    topo = topology(True)
-    test_ticket48362(topo)
-#     CURRENT_FILE = os.path.realpath(__file__)
-#     pytest.main("-s %s" % CURRENT_FILE)
+    CURRENT_FILE = os.path.realpath(__file__)
+    pytest.main("-s %s" % CURRENT_FILE)

+ 11 - 0
ldap/servers/slapd/plugin_mr.c

@@ -655,8 +655,19 @@ default_mr_indexer_create(Slapi_PBlock* pb)
 {
 	int rc = -1;
 	struct slapdplugin *pi = NULL;
+        char* oid = NULL;
 	
 	slapi_pblock_get(pb, SLAPI_PLUGIN, &pi);
+        slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &oid);
+        /* this default_mr_indexer_create can be common indexer create to several
+         * MR plugin. We need to check the selected plugin handle the expected OID
+         */
+        if ( oid == NULL || !charray_inlist(pi->plg_mr_names, oid)) {
+            LDAPDebug2Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: warning - plugin [%s] does not handle %s\n",
+                    pi->plg_name,
+                    oid ? oid : "unknown oid");
+            goto done;
+        }
 	if (NULL == pi) {
 		LDAPDebug0Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: error - no plugin specified\n");
 		goto done;