s4:python/ntacl: add 'as_sddl' option to dsacl2fsacl()
authorStefan Metzmacher <metze@samba.org>
Thu, 29 Nov 2012 08:57:44 +0000 (09:57 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 3 Dec 2012 11:49:48 +0000 (12:49 +0100)
This allows the caller to ask for a security.descriptor instead of sddl
by passing 'as_sddl=False'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 6f71071381ead9976f4a6d296c9a1ade385484e0)

The last 75 patches address bug #9406 - ACL fixes since 4.0 rc1.

source4/scripting/python/samba/ntacls.py

index d86c5171b39f1e9f6d45b3cfee647c7c07bff90a..b89e9e94803f879ce19a0913ba5d9ae3fdfd1eea 100644 (file)
@@ -209,7 +209,7 @@ def ldapmask2filemask(ldm):
     return filemask
 
 
-def dsacl2fsacl(dssddl, sid):
+def dsacl2fsacl(dssddl, sid, as_sddl=True):
     """
 
     This function takes an the SDDL representation of a DS
@@ -234,4 +234,7 @@ def dsacl2fsacl(dssddl, sid):
             ace.access_mask =  ldapmask2filemask(ace.access_mask)
             fdescr.dacl_add(ace)
 
+    if not as_sddl:
+        return fdescr
+
     return fdescr.as_sddl(sid)