Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2160399

Summary: get_ranges - [file ipa_sidgen_common.c, line 276]: Failed to convert LDAP entry to range struct
Product: Red Hat Enterprise Linux 9 Reporter: Sudhir Menon <sumenon>
Component: ipaAssignee: Florence Blanc-Renaud <frenaud>
Status: CLOSED ERRATA QA Contact: Sudhir Menon <sumenon>
Severity: low Docs Contact:
Priority: low    
Version: 9.2CC: gkaihoro, pasik, rcritten, tscherf
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-4.10.2-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:34:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sudhir Menon 2023-01-12 09:34:16 UTC
Description of problem: get_ranges - [file ipa_sidgen_common.c, line 276]: Failed to convert LDAP entry to range struct

Version-Release number of selected component (if applicable):
ipa-server-4.9.11-3.module+el8.8.0+17608+39b88723.x86_64
389-ds-base-1.4.3.32-1.module+el8.8.0+17275+1a8f9618.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install IPA server
2. Check the dirsrv logs.

Actual results:
[12/Jan/2023:03:11:13.974906427 -0500] - ERR - get_ranges - [file ipa_sidgen_common.c, line 276]: Failed to convert LDAP entry to range struct.

Expected results:
Fix the issue seen above

Additional info:

Comment 3 Florence Blanc-Renaud 2023-01-12 17:01:16 UTC
The master installation has the following steps:

* [25/42]: adding default layout
This step creates cn=xx_id_range,cn=ranges,cn=etc,$SUFFIX with ipaBaseID and ipaIDRangeSize.

* [40/42]: activating sidgen plugin
This step creates the entry cn=IPA SIGEN,cn=plugins,cn=config with nsslapd-pluginenabled: on
At this point the plugin is enabled but skips any processing as there is no domain SID below $SUFFIX:
https://github.com/freeipa/freeipa/blob/5419864c7ef893abc4717847fa6ea272d0c659fe/daemons/ipa-slapi-plugins/ipa-sidgen/ipa_sidgen.c#L104
    if (ctx->dom_sid == NULL) {
        ret = get_dom_sid(ctx->plugin_id, ctx->base_dn, &ctx->dom_sid);
        if (ret != 0) {
            LOG("Domain SID not available, nothing to do.\n");
            ret = 0;
            goto done;
        }
    }

* [1/8]: creating samba domain object
This step creates the entry cn=$DOMAIN,cn=ad,cn=etc,dc=ipa,dc=test with ipaNTSecurityIdentifier=SID of the ipa domain.
From this point, the sidgen plugin is enabled and is able to find the domain sid, meaning it gets triggered for all ldap operations.
It starts by getting the RID ranges but the cn=xx_id_range entry doesn't contain ipaBaseRID or ipaSecondaryBaseRID and this is the cause for the error message:
ERR - get_ranges - [file ipa_sidgen_common.c, line 276]: Failed to convert LDAP entry to range struct.

* [3/8]: adding RID bases
This step adds the ipaBaseRID and ipaSecondaryBaseRID values to cn=xx_id_range, fixing the plugin issue.

It looks ok to call "adding RID bases" earlier but should be tested.

Anyway, the issue is really minor: if entries are created before the baseRID is added, they won't get a SID but the sidgen task is called later and generates the missing SIDs.

Comment 4 Florence Blanc-Renaud 2023-01-12 17:39:13 UTC
I am removing the Regression keyword as it's not a regression.

The installation of ipa server in RHEL 7.9 (ipa-server-trust-ad-4.6.8-5.el7.x86_64) with adtrust was already producing the same log. So the error has not been introduced recently.

Comment 5 Florence Blanc-Renaud 2023-01-16 13:37:23 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/9309

Comment 6 Florence Blanc-Renaud 2023-01-17 14:53:40 UTC
Fixed upstream
master:
https://pagure.io/freeipa/c/ad05218450876a302f80b3e851d4f7cef931fdb6

Comment 7 Florence Blanc-Renaud 2023-01-17 14:54:26 UTC
Planning to fix in 9.3, the fix will be picked with the rebase to 4.10.next

Comment 8 Florence Blanc-Renaud 2023-01-17 21:44:08 UTC
Fixed upstream
ipa-4-10:
https://pagure.io/freeipa/c/7d1a35852fa53bcf3b88a8a80a2e86ef88a75795

Comment 13 Sudhir Menon 2023-06-22 17:06:06 UTC
Verified using nightly  with ipa-server-4.10.2-1.el9.x86_64

Comment 15 errata-xmlrpc 2023-11-07 08:34:04 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 (ipa 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:6477