Skip to content

Commit

Permalink
Issue 6227 - dsconf schema does not show inChain matching rule
Browse files Browse the repository at this point in the history
Bug description:
	The registered inChain MR does defined any matching rule
	syntax (mr_syntax).
	When dsconf reads the matching rules (read_schema_dse)
	it only reports those which have OID and SYNTAX.
	As a consequence InChain was not reported.

Fix description:
	The syntax defines that assersion syntax that is
	distinguished name. Add this syntax to the register
	struct

relates: 389ds#6227

Reviewed by: Pierre Rogier (Thanks !)
  • Loading branch information
tbordaz committed Jun 24, 2024
1 parent f76503d commit 80771a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions dirsrvtests/tests/suites/filter/inchain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from lib389.topologies import topology_st as topo
from lib389.plugins import MemberOfPlugin

from lib389.schema import Schema
from lib389.idm.user import UserAccount, UserAccounts
from lib389.idm.account import Accounts
from lib389.idm.account import Anonymous
Expand Down Expand Up @@ -812,6 +813,24 @@ def test_invalid_assertion(topo):
memberof = topo.standalone.search_s(DEFAULT_SUFFIX, SCOPE_SUBTREE, "(member:%s:=%s)" % (INCHAIN_OID, user))
assert len(memberof) == 0

def test_check_dsconf_matchingrule(topo):
"""Test that the matching rule 'inchain' is listed by dsconf
:id: b8dd4049-ccec-4316-bc9c-5aa5c5afcfbd
:setup: Standalone Instance
:steps:
1. fetch matching rules from the schema
2. Checks that matching rules contains inchaineMatch matching rule
:expectedresults:
1. Success
2. Success
"""
schema = Schema(topo.standalone)
mrs = [ f"{mr.oid} {mr.names[0]}" for mr in schema.get_matchingrules() if len(mr.names) > 0 ]
for mr in mrs:
log.info("retrieved matching rules are: %s", mr)
assert '1.2.840.113556.1.4.1941 inchainMatch' in mrs

if __name__ == "__main__":
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s -v %s" % CURRENT_FILE)
4 changes: 2 additions & 2 deletions ldap/servers/plugins/syntaxes/inchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static char *names[] = {"inchain", "inchain", LDAP_MATCHING_RULE_IN_CHAIN_OID, 0
static Slapi_PluginDesc pdesc = {"inchain-matching-rule", VENDOR, DS_PACKAGE_VERSION,
"inchain matching rule plugin"};

static const char *inchainMatch_names[] = {"inchainMatch", "1.2.840.113556.1.4.1941", NULL};
static const char *inchainMatch_names[] = {"inchainMatch", LDAP_MATCHING_RULE_IN_CHAIN_OID, NULL};

static struct mr_plugin_def mr_plugin_table[] = {
{
Expand All @@ -64,7 +64,7 @@ static struct mr_plugin_def mr_plugin_table[] = {
"the AVA comparisons evaluate to Undefined and the remaining AVA "
"comparisons return TRUE then the distinguishedNameMatch rule "
"evaluates to Undefined.",
NULL,
DN_SYNTAX_OID,
0,
NULL /* dn only for now */
}, /* matching rule desc */
Expand Down

0 comments on commit 80771a4

Please sign in to comment.