summaryrefslogtreecommitdiff
path: root/source4/scripting/python/samba/ntacls.py
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-07 16:54:28 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-23 15:02:26 +0200
commitb1825c64215ac304eff8fcd3555e9f5943f3ba63 (patch)
tree9131a271997024ed39119e009a7534fc1d0418be /source4/scripting/python/samba/ntacls.py
parenta778662da8b1dfc65bde55644703f2a3146ef7a8 (diff)
downloadsamba-b1825c64215ac304eff8fcd3555e9f5943f3ba63.tar.gz
samba-b1825c64215ac304eff8fcd3555e9f5943f3ba63.tar.bz2
samba-b1825c64215ac304eff8fcd3555e9f5943f3ba63.zip
s4-scripting: Redefine getntacl() as accessing via the smbd VFS or directly
This allows us to write tests that compare the smbd vfs with what is in the DB or xattr. Andrew Bartlett
Diffstat (limited to 'source4/scripting/python/samba/ntacls.py')
-rw-r--r--source4/scripting/python/samba/ntacls.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/source4/scripting/python/samba/ntacls.py b/source4/scripting/python/samba/ntacls.py
index 64dfd17d64..6f8e770bba 100644
--- a/source4/scripting/python/samba/ntacls.py
+++ b/source4/scripting/python/samba/ntacls.py
@@ -55,8 +55,8 @@ def checkset_backend(lp, backend, eadbfile):
raise XattrBackendError("Invalid xattr backend choice %s"%backend)
-def getntacl(lp, file, backend=None, eadbfile=None):
- if use_ntvfs:
+def getntacl(lp, file, backend=None, eadbfile=None, direct_db_access=True):
+ if direct_db_access:
(backend_obj, dbname) = checkset_backend(lp, backend, eadbfile)
if dbname is not None:
try:
@@ -71,8 +71,13 @@ def getntacl(lp, file, backend=None, eadbfile=None):
else:
attribute = samba.xattr_native.wrap_getxattr(file,
xattr.XATTR_NTACL_NAME)
- ntacl = ndr_unpack(xattr.NTACL, attribute)
- return ntacl
+ ntacl = ndr_unpack(xattr.NTACL, attribute)
+ if ntacl.version == 1:
+ return ntacl.info
+ elif ntacl.version == 2:
+ return ntacl.info.sd
+ elif ntacl.version == 3:
+ return ntacl.info.sd
else:
return smbd.get_nt_acl(file)