Bug 15972 - Winbind group resolution failure
Summary: Winbind group resolution failure
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Winbind (show other bugs)
Version: 4.22.7
Hardware: All All
: P5 major (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-16 18:28 UTC by paulg
Modified: 2026-02-06 14:16 UTC (History)
2 users (show)

See Also:


Attachments
4.24 patch (9.09 KB, patch)
2026-01-22 09:39 UTC, Pavel Filipenský
asn: review+
Details
4.23 patch (9.09 KB, patch)
2026-01-22 09:42 UTC, Pavel Filipenský
asn: review+
Details
4.22 patch (9.09 KB, patch)
2026-01-22 09:43 UTC, Pavel Filipenský
asn: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description paulg 2026-01-16 18:28:37 UTC
The 'groups' command is not retrieving the complete supplementary group membership and is causing various permissions-based issues.

On a Linux AD client running 4.22.7

% groups webapp
webapp : webappg domain users


On a Linux AD client running 4.21.10

% groups webapp
webapp : webappg domain users faculty hc_server submit hc_prism hc_public privkey

As you can see the Linux AD client running 4.22.7, doesn't return all the groups.


We are aware of the config option 'winbind expand groups = 1' which can help. If this option is enabled, it results in a lookup, which results in a severe performance hit.

Something changed in the Samba 4.22 code.


From a colleague who is also investigating this issue.
-------
When winbind expand groups = 0 (which is the default, and has been for many versions), then during login, the AD controller sends back a token for the user which includes primary group, and secondary groups.  Winbind stores the token in its cache.  If you run "groups" winbind just reads that groups from the cached token.

When winbind expand groups = 1, winbind doesn't rely on that information from login.  It looks up all the groups that contain the user.

So when expand groups = 0, AD gives winbind the complete list of groups at login.  Winbind just reuses that list when you ask.  But when "expand groups = 1" winbind does the work itself.  It's slower, and doesn't rely on the login token.

Now, we know that after reboot, groups is fine, so what happens?

So on login, winbind stores the token in netsamlogon_cache.tdb... it's all good.
At some point, I believe the login token ages out, so I think it has to re-request the info from AD, and that's where the bug probably lies.  Maybe there's a cache corruption at this point under a certain scenario (maybe high load) and the token it gets back must contain only the primary group.  

----------



There is another bug report filed at Red Hat, which is very similar.


https://issues.redhat.com/browse/RHEL-138263


Something has changed in 4.22.7. We tried upgrading to Samba 4.23.4, but there was no resolution.


How do we solve this issue without taking a performance hit? 



On the host in question (Linux AD client 4.22.7 and 4.21.10):
------
egrep -i '^passwd|^group' /etc/nsswitch.conf
passwd:      files winbind systemd
group:       files winbind systemd



/etc/samba/smb.conf
global]
workgroup = HOSTHOSTCA
security = ADS
realm = AD.HOST.HOST.CA
dedicated keytab file = /etc/krb5.keytab
kerberos method = secrets and keytab
winbind use krb5 enterprise principals = no
winbind max clients = 600

idmap config * : backend = tdb
idmap config * : range = 1000000-1999999
 
# idmap config for the HOSTHOSTCA domain
# range should match UNIX ID in AD

idmap config HOSTHOSTCA : backend = ad
idmap config HOSTHOSTCA : schema_mode = rfc2307
idmap config HOSTHOSTCA : range = 1000-999999
idmap config HOSTHOSTCA : unix_primary_group = yes
idmap config HOSTHOSTCA : unix_nss_info = yes

# Renew the kerberos tickets
winbind refresh tickets = yes
 
# Enable offline logins
winbind offline logon = yes
 
# User uid/Gid from AD. (rfc2307)
winbind nss info = rfc2307

# With default domain, wbinfo -u, yes = username, no is SAMBADOM\username
winbind use default domain = yes
 
# Keep no in production, set yes when debugging, this slows down your samba.
winbind enum users  = no
winbind enum groups = no

# For Windows ACL support on member file server, enabled globaly, OBLIGATED
# For a mixed setup of rights, put this per share!
vfs objects = acl_xattr
map acl inherit = yes
store dos attributes = yes

# Template settings for login shell and home directory
template shell = /bin/bash
template homedir = /eecs/home/%U

#log files
debug timestamp = yes
debug uid = yes
debug pid = yes
debug level = 1
max log size = 0

# printing (none)
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes

# security
username map = /xconf/samba/usermap
guest account = nobody
----
Comment 1 Pavel Filipenský 2026-01-19 18:10:21 UTC
I am trying to address it via:

https://gitlab.com/samba-team/samba/-/merge_requests/4379
Comment 2 paulg 2026-01-21 20:52:25 UTC
Pavel, thank you! Do you know when a patch will be ready?
Comment 3 Samba QA Contact 2026-01-22 09:15:03 UTC
This bug was referenced in samba master:

9f3a35991feb01a8d2c2b69fa0b914bbc637a809
7483903575eab97773a992149d64511d5ec6f256
Comment 4 Pavel Filipenský 2026-01-22 09:39:14 UTC
Created attachment 18804 [details]
4.24 patch
Comment 5 Pavel Filipenský 2026-01-22 09:42:34 UTC
Created attachment 18805 [details]
4.23 patch
Comment 6 Pavel Filipenský 2026-01-22 09:43:03 UTC
Created attachment 18806 [details]
4.22 patch
Comment 7 Andreas Schneider 2026-01-22 12:38:21 UTC
Björn, could you please apply the patches to the corresponding branches?
Comment 8 Samba QA Contact 2026-01-22 14:20:03 UTC
This bug was referenced in samba v4-22-test:

1f56c9f8460ca6300afd1fe27d9e45e2ae74809e
124185a1e56e171255ebf040bd428082bd0ffd0f
Comment 9 Samba QA Contact 2026-01-22 16:17:03 UTC
This bug was referenced in samba v4-24-test:

425504a00f5f973cdbcbbd2dc88b240886754aad
9de3dbfe0dcee57520358d49629d8309e5a6b704
Comment 10 Samba QA Contact 2026-01-23 10:10:04 UTC
This bug was referenced in samba v4-23-test:

1652a10806c06bc3c6ac07c0ab4b18b79faba038
573959f753ec410754b1be72915384803c12e6d0
Comment 11 Samba QA Contact 2026-01-23 11:40:01 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.5):

1652a10806c06bc3c6ac07c0ab4b18b79faba038
573959f753ec410754b1be72915384803c12e6d0
Comment 12 Samba QA Contact 2026-02-06 14:16:25 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.0rc2):

425504a00f5f973cdbcbbd2dc88b240886754aad
9de3dbfe0dcee57520358d49629d8309e5a6b704