1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

s4-provision: fixed eadb automatic and manual setting in provision

we should not set posix:eadb in lp in the acl native test code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andrew Tridgell
2010-11-26 12:10:55 +11:00
parent cfa7510e19
commit 5e8cb67605
3 changed files with 18 additions and 21 deletions

View File

@ -28,23 +28,23 @@ class XattrBackendError(Exception):
def checkset_backend(lp, backend, eadbfile):
# if posix:eadb is set, then force the backend
if backend is not None:
if backend == "native":
lp.set("posix:eadb", "")
elif backend == "tdb":
if eadbfile is not None:
lp.set("posix:eadb", eadbfile)
else:
os.path.abspath(os.path.join(lp.get("private dir"), "eadb.tdb"))
'''return the path to the eadb, or None'''
if backend is None:
return lp.get("posix:eadb")
elif backend == "native":
return None
elif backend == "tdb":
if eadbfile is not None:
return eadbfile
else:
raise XattrBackendError("Invalid xattr backend choice %s"%backend)
return os.path.abspath(os.path.join(lp.get("private dir"), "eadb.tdb"))
else:
raise XattrBackendError("Invalid xattr backend choice %s"%backend)
def getntacl(lp, file, backend=None, eadbfile=None):
checkset_backend(lp, backend, eadbfile)
eadbname = lp.get("posix:eadb")
if eadbname is not None and eadbname != "":
eadbname = checkset_backend(lp, backend, eadbfile)
if eadbname is not None:
try:
attribute = samba.xattr_tdb.wrap_getxattr(eadbname, file,
xattr.XATTR_NTACL_NAME)
@ -62,14 +62,13 @@ def getntacl(lp, file, backend=None, eadbfile=None):
def setntacl(lp, file, sddl, domsid, backend=None, eadbfile=None):
checkset_backend(lp, backend, eadbfile)
eadbname = 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 is not None and eadbname != "":
if eadbname is not None:
try:
samba.xattr_tdb.wrap_setxattr(eadbname,
file, xattr.XATTR_NTACL_NAME, ndr_pack(ntacl))