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 1979959

Summary: Samba autorid fails to map AD users if id rangesize fits in the id range only once
Product: Red Hat Enterprise Linux 8 Reporter: Aleksandr Sharov <asharov>
Component: sambaAssignee: Andreas Schneider <asn>
Status: CLOSED ERRATA QA Contact: Denis Karpelevich <dkarpele>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: aboscatt, asn, dkarpele, gdeschner, jarrpa
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: samba-4.15.5-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2044231 (view as bug list) Environment:
Last Closed: 2022-05-10 15:27:35 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:
Bug Depends On:    
Bug Blocks: 2044231    

Description Aleksandr Sharov 2021-07-07 13:46:48 UTC
Description of problem:
If you set up a valid config like this:

[root@client78 ~]# testparm -s
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_DOMAIN_MEMBER

# Global parameters
[global]
        debug pid = Yes
        kerberos method = secrets and keytab
        log file = /var/log/samba/log.%m
        max log size = 250000
        realm = WIN23.LOCAL
        security = ADS
        template homedir = /home/%U@%D
        template shell = /bin/bash
        winbind offline logon = Yes
        winbind refresh tickets = Yes
        workgroup = WIN23
        idmap config * :        rangesize = 100000
        idmap config * :        range = 100000-200000
        idmap config * : backend = autorid

Samba will fail to get ID for domain user:
[root@client78 ~]# wbinfo -u | grep winuser
WIN23\winuser
[root@client78 ~]# wbinfo -i WIN23\\winuser
failed to call wbcGetpwnam: WBC_ERR_DOMAIN_NOT_FOUND
Could not get info for user WIN23\winuser

In the logs, you can see message like:
/var/log/samba/log.winbindd-idmap:  High uid-low uid difference of 100001 is not a multiple of the rangesize 100000, limiting ranges to lower boundary number of 1

It seems that if we use idrangesize that is bigger that at least 1/2 of the range, all BUILTIN users get mapped in the first range, and all domains users cannot be mapped because second range is out of range size.

Version-Release number of selected component (if applicable):
samba-4.10.4-11.el7_8.x86_64

How reproducible:
fully reproducable

Steps to Reproduce:
1. Join the domain with samba
2. Setup the ranges as an example
3. Clear cache
4. Request wbinfo -i adusername

Actual results:
mapping failed

Expected results:
if the configuration is invalid, it should prove some feedback on it, if it is valid, it should provide a valid ID mapping

Additional info:

Comment 2 Andreas Schneider 2022-02-07 14:40:33 UTC
Note that the range is too big by 1!

idmap config * :        rangesize = 100000
idmap config * :        range = 100000-199999

100000-200000 => This is a rangesize of 100001

Comment 9 errata-xmlrpc 2022-05-10 15:27: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 (Moderate: samba security, 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/RHSA-2022:2074