Skip to content

Commit 7c99658

Browse files
python: Do not interpret 16 character group names as GUIDs
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15854 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Björn Baumbach <bb@samba.org> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Mon Jun 16 22:22:27 UTC 2025 on atb-devel-224
1 parent f545a77 commit 7c99658

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

python/samba/samdb.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from samba.common import get_bytes, cmp
3636
from samba.dcerpc import security
3737
from samba import is_ad_dc_built
38+
from samba import string_is_guid
3839
from samba import NTSTATUSError, ntstatus
3940
import binascii
4041

@@ -388,6 +389,13 @@ def add_remove_group_members(self, group, members,
388389

389390
partial_groupfilter = None
390391

392+
# If <group> looks like a SID, GUID, or DN, we use it
393+
# accordingly, otherwise as a name.
394+
#
395+
# Because misc.GUID() will read any 16 byte sequence as a
396+
# binary guid, we need to be careful not to read 16 character
397+
# names as GUIDs.
398+
391399
group_sid = None
392400
try:
393401
group_sid = security.dom_sid(group)
@@ -397,7 +405,7 @@ def add_remove_group_members(self, group, members,
397405
partial_groupfilter = "(objectClass=*)"
398406

399407
group_guid = None
400-
if partial_groupfilter is None:
408+
if partial_groupfilter is None and string_is_guid(group):
401409
try:
402410
group_guid = misc.GUID(group)
403411
except NTSTATUSError as e:

selftest/knownfail.d/samba-tool-group-addmember

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)