Bug 2165091 - Failing to create a new attribute with the CLI when specifying a matching rule.
Summary: Failing to create a new attribute with the CLI when specifying a matching rule.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Directory Server
Classification: Red Hat
Component: Command Line Utilities
Version: 11.6
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: DS12.2
: dirsrv-12.2
Assignee: mreynolds
QA Contact: LDAP QA Team
URL:
Whiteboard: sync-to-jira
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-27 16:10 UTC by Têko Mihinto
Modified: 2023-05-30 09:40 UTC (History)
4 users (show)

Fixed In Version: redhat-ds-12-9020020230314150545.1674d574
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-30 09:40:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker IDMDS-2963 0 None None None 2023-04-24 08:59:29 UTC
Red Hat Product Errata RHBA-2023:3344 0 None None None 2023-05-30 09:40:44 UTC

Description Têko Mihinto 2023-01-27 16:10:02 UTC
Description of problem:
A customer needed to extend the LDAP schema.
When trying to add a matching rule, the command fails.
This works fine when the matching rule option is not used.

Version-Release number of selected component (if applicable):
$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.7 (Ootpa)
$

$ rpm -qa | grep 389-ds
389-ds-base-1.4.3.31-11.module+el8dsrv+17815+4f95348d.x86_64
cockpit-389-ds-1.4.3.31-11.module+el8dsrv+17815+4f95348d.noarch
389-ds-base-legacy-tools-1.4.3.31-11.module+el8dsrv+17815+4f95348d.x86_64
389-ds-base-libs-1.4.3.31-11.module+el8dsrv+17815+4f95348d.x86_64
$

How reproducible:
Always.

Steps to Reproduce:
For instance:

$ dsconf -j ldapi://%2fvar%2frun%2fslapd-<INSTANCE>.socket schema attributetypes add newAttr --syntax 1.3.6.1.4.1.1466.115.121.1.15 --equality caseexactmatch --single-value --user-mod --usage userApplications --desc Case_XXX
{
    "desc": "value has to be of str, was 'caseexactmatch'"
}
$

Customer was initially trying to add the "numericstringsubstringsmatch" to an existing attribute using the RHDS Console.
I could reproduce the issue with any type of matching rule.

# dsconf --verbose ldapi://%2fvar%2frun%2fslapd-<INSTANCE>.socket schema attributetypes add newAttr --syntax 1.3.6.1.4.1.1466.115.121.1.36 --substr numericstringsubstringsmatch --single-value --user-mod --usage userApplications --desc Test
...
vendorVersion: 389-Directory/1.4.3.31 B2023.012.1725

]
DEBUG: cn=schema get_attr_vals('attributeTypes')
DEBUG: value has to be of str, was 'numericstringsubstringsmatch'
Traceback (most recent call last):
  File "/usr/sbin/dsconf", line 138, in <module>
    result = args.func(inst, None, log, args)
  File "/usr/lib/python3.6/site-packages/lib389/cli_conf/schema.py", line 137, in add_attributetype
    schema.add_attributetype(parameters)
  File "/usr/lib/python3.6/site-packages/lib389/schema.py", line 344, in add_attributetype
    return self._add_schema_object(parameters, AttributeType)
  File "/usr/lib/python3.6/site-packages/lib389/schema.py", line 225, in _add_schema_object
    return self.add(attr_name, str(schema_object))
  File "/usr/lib64/python3.6/site-packages/ldap/schema/models.py", line 305, in __str__
    result.append(self.key_attr('SUBSTR',self.substr))
  File "/usr/lib64/python3.6/site-packages/ldap/schema/models.py", line 69, in key_attr
    assert value is None or type(value)==str,TypeError("value has to be of str, was %r" % value)
AssertionError: value has to be of str, was 'numericstringsubstringsmatch'
ERROR: Error: value has to be of str, was 'numericstringsubstringsmatch'
$

Actual results:
Failing to modify the custom schema.

Expected results:
Allow to add matching rules.

Additional info:

Comment 2 mreynolds 2023-02-13 15:19:50 UTC
Upstream ticket:

https://github.com/389ds/389-ds-base/issues/5658

Comment 6 Viktor Ashirov 2023-05-09 10:09:44 UTC
Automated test passed
============================================================= test session starts =============================================================
platform linux -- Python 3.9.16, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
389-ds-base: 2.2.7-2.module+el9dsrv+18726+78959e84
nss: 3.79.0-18.el9_1
nspr: 4.34.0-18.el9_1
openldap: 2.6.2-3.el9
cyrus-sasl: not installed
FIPS: disabled
rootdir: /root/ds/dirsrvtests, configfile: pytest.ini
collected 1 item

dirsrvtests/tests/suites/clu/schema_test.py::test_mrs PASSED                                                                            [100%]

============================================================= 1 passed in 17.89s ==============================================================

Marking as VERIFIED.

Comment 8 errata-xmlrpc 2023-05-30 09:40:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (redhat-ds:12 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:3344


Note You need to log in before you can comment on or make changes to this bug.