mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
python: samdb: Move get_connecting_user_sid to samdb
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
b815abe779
commit
c221f7080c
@ -962,6 +962,11 @@ accountExpires: %u
|
||||
domain_sid = property(get_domain_sid, set_domain_sid,
|
||||
doc="SID for the domain")
|
||||
|
||||
def get_connecting_user_sid(self):
|
||||
"""Returns the SID of the connected user."""
|
||||
msg = self.search(base="", scope=ldb.SCOPE_BASE, attrs=["tokenGroups"])[0]
|
||||
return str(ndr_unpack(security.dom_sid, msg["tokenGroups"][0]))
|
||||
|
||||
def set_invocation_id(self, invocation_id):
|
||||
"""Set the invocation id for this SamDB handle.
|
||||
|
||||
|
@ -69,8 +69,7 @@ class GMSAPasswordTest(BlackboxTestCase):
|
||||
cls.base_dn = f"CN=Managed Service Accounts,{cls.samdb.domain_dn()}"
|
||||
cls.user_dn = f"CN={cls.username},{cls.base_dn}"
|
||||
|
||||
msg = cls.samdb.search(base="", scope=SCOPE_BASE, attrs=["tokenGroups"])[0]
|
||||
connecting_user_sid = str(ndr_unpack(security.dom_sid, msg["tokenGroups"][0]))
|
||||
connecting_user_sid = cls.samdb.get_connecting_user_sid()
|
||||
|
||||
domain_sid = security.dom_sid(cls.samdb.get_domain_sid())
|
||||
allow_sddl = f"O:SYD:(A;;RP;;;{connecting_user_sid})"
|
||||
|
Loading…
Reference in New Issue
Block a user