From c5932c4794b13a7975ec3c951e576a71152f4835 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Tue, 7 Nov 2023 15:43:29 +1300 Subject: [PATCH] =?UTF-8?q?netcmd:=20Add=20=E2=80=98allow=5Fdevice=5Fin=5F?= =?UTF-8?q?sddl=E2=80=99=20parameter=20to=20SDDLField()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- python/samba/netcmd/domain/models/fields.py | 22 ++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/python/samba/netcmd/domain/models/fields.py b/python/samba/netcmd/domain/models/fields.py index 845b34d10ab..52f288c6d60 100644 --- a/python/samba/netcmd/domain/models/fields.py +++ b/python/samba/netcmd/domain/models/fields.py @@ -315,6 +315,17 @@ class GUIDField(Field): class SDDLField(Field): """A SDDL field encodes and decodes SDDL data.""" + def __init__(self, + name, + *, + many=False, + default=None, + hidden=False, + allow_device_in_sddl=True): + """Create a new SDDLField.""" + self.allow_device_in_sddl = allow_device_in_sddl + super().__init__(name, many=many, default=default, hidden=hidden) + def from_db_value(self, ldb, value): if value is None: return @@ -330,13 +341,18 @@ class SDDLField(Field): return elif isinstance(value, list): return MessageElement([ndr_pack(security.descriptor.from_sddl( - item, domain_sid)) for item in value], + item, + domain_sid, + allow_device_in_sddl=self.allow_device_in_sddl)) + for item in value], flags, self.name) else: return MessageElement( - ndr_pack(security.descriptor.from_sddl(value, - domain_sid)), + ndr_pack(security.descriptor.from_sddl( + value, + domain_sid, + allow_device_in_sddl=self.allow_device_in_sddl)), flags, self.name )