Bug 14335 - samba-tool group show only finds global security groups
Summary: samba-tool group show only finds global security groups
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Douglas Bagnall
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-02 08:19 UTC by Rowland Penny
Modified: 2020-05-14 13:32 UTC (History)
0 users

See Also:


Attachments
Patch to fix bugreport (1.13 KB, patch)
2020-04-02 08:37 UTC, Rowland Penny
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rowland Penny 2020-04-02 08:19:07 UTC
Ask samba-tool to show an existing group:

root@dc4:~# samba-tool group show grouptest4
ERROR: Unable to find group "grouptest4"

Edit /usr/lib/python3/dist-packages/samba/netcmd/group.py

Change 

        filter = ("(&(sAMAccountType=%d)(sAMAccountName=%s))" %
                  (ATYPE_SECURITY_GLOBAL_GROUP,
                   ldb.binary_encode(groupname)))

To:

        filter = ("(&(objectCategory=group)(sAMAccountName=%s))" %
                   ldb.binary_encode(groupname))

Now ask for the group again:

root@dc4:~# samba-tool group show grouptest4
dn: CN=grouptest4,CN=Users,DC=samdom,DC=example,DC=com
objectClass: top
objectClass: group
cn: grouptest4
instanceType: 4
whenCreated: 20190403090537.0Z
whenChanged: 20190403090537.0Z
uSNCreated: 472146
uSNChanged: 472146
name: grouptest4
objectGUID: 53c65522-b0eb-4e20-baaf-383ef21e6a09
objectSid: S-1-5-21-1768301897-3342589593-1064908849-5150
sAMAccountName: grouptest4
sAMAccountType: 536870913
groupType: 4
objectCategory: CN=Group,CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=co
 m
distinguishedName: CN=grouptest4,CN=Users,DC=samdom,DC=example,DC=com

I will prepare a patch.

This was found by a user, see here:

https://lists.samba.org/archive/samba/2020-March/229069.html
Comment 1 Rowland Penny 2020-04-02 08:37:32 UTC
Created attachment 15888 [details]
Patch to fix bugreport

Patch to fix bug attached.
Comment 2 Rowland Penny 2020-05-14 13:32:52 UTC
Closing bug report, now in master.