1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-19 04:59:10 +03:00

s4-python: More cleanups.

This commit is contained in:
Jelmer Vernooij
2010-04-08 21:01:17 +02:00
parent a35d876537
commit dd4ef4e106
9 changed files with 37 additions and 29 deletions

View File

@ -41,29 +41,37 @@ def checkset_backend(lp,backend,eadbfile):
def getntacl(lp, file, backend=None, eadbfile=None):
checkset_backend(lp, backend, eadbfile)
eadbname = lp.get("posix:eadb")
if eadbname != None and eadbname != "" :
if eadbname is not None and eadbname != "":
try:
attribute = samba.xattr_tdb.wrap_getxattr(eadbname,file,xattr.XATTR_NTACL_NAME)
attribute = samba.xattr_tdb.wrap_getxattr(eadbname, file,
xattr.XATTR_NTACL_NAME)
except:
# FIXME: Don't catch all exceptions, just those related to opening
# xattrdb
print "Fail to open %s" % eadbname
attribute = samba.xattr_native.wrap_getxattr(file,xattr.XATTR_NTACL_NAME)
attribute = samba.xattr_native.wrap_getxattr(file,
xattr.XATTR_NTACL_NAME)
else:
attribute = samba.xattr_native.wrap_getxattr(file,xattr.XATTR_NTACL_NAME)
attribute = samba.xattr_native.wrap_getxattr(file,
xattr.XATTR_NTACL_NAME)
ntacl = ndr_unpack(xattr.NTACL,attribute)
return ntacl
def setntacl(lp, file, sddl, domsid, backend=None, eadbfile=None):
checkset_backend(lp,backend,eadbfile)
checkset_backend(lp, backend, eadbfile)
ntacl=xattr.NTACL()
ntacl.version = 1
sid=security.dom_sid(domsid)
sd = security.descriptor.from_sddl(sddl, sid)
ntacl.info = sd
eadbname = lp.get("posix:eadb")
if eadbname != None and eadbname != "":
if eadbname is not None and eadbname != "":
try:
samba.xattr_tdb.wrap_setxattr(eadbname,file,xattr.XATTR_NTACL_NAME,ndr_pack(ntacl))
samba.xattr_tdb.wrap_setxattr(eadbname,
file,xattr.XATTR_NTACL_NAME,ndr_pack(ntacl))
except:
# FIXME: Don't catch all exceptions, just those related to opening
# xattrdb
print "Fail to open %s"%eadbname
samba.xattr_native.wrap_setxattr(file,xattr.XATTR_NTACL_NAME,ndr_pack(ntacl))
else: