|
41 |
import tempfile |
41 |
import tempfile |
42 |
import samba.dsdb |
42 |
import samba.dsdb |
43 |
|
43 |
|
|
|
44 |
from samba import ntstatus |
45 |
import ctypes |
46 |
|
44 |
import ldb |
47 |
import ldb |
45 |
|
48 |
|
46 |
from samba.auth import system_session, admin_session |
49 |
from samba.auth import system_session, admin_session |
|
1659 |
else: |
1662 |
else: |
1660 |
return "VFS" |
1663 |
return "VFS" |
1661 |
|
1664 |
|
|
|
1665 |
def _uint32(v): |
1666 |
return ctypes.c_uint32(v).value |
1667 |
|
1668 |
def check_runtime_error(runtime, val): |
1669 |
if runtime is None: |
1670 |
return False |
1671 |
|
1672 |
err32 = _uint32(runtime[0]) |
1673 |
if err32 == val: |
1674 |
return True |
1675 |
return False |
1676 |
|
1662 |
def check_dir_acl(path, acl, lp, domainsid, direct_db_access): |
1677 |
def check_dir_acl(path, acl, lp, domainsid, direct_db_access): |
1663 |
fsacl = getntacl(lp, path, direct_db_access=direct_db_access, service=SYSVOL_SERVICE) |
1678 |
try: |
1664 |
fsacl_sddl = fsacl.as_sddl(domainsid) |
1679 |
fsacl = getntacl(lp, path, direct_db_access=direct_db_access, service=SYSVOL_SERVICE) |
1665 |
|
1680 |
fsacl_sddl = fsacl.as_sddl(domainsid) |
|
|
1681 |
except TypeError as error: |
1682 |
return |
1683 |
except NTSTATUSError as error: |
1684 |
if check_runtime_error(error, ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND): |
1685 |
print "ERROR: File not found", path |
1686 |
return |
1687 |
else: |
1688 |
raise |
1666 |
"""changed acl in if-statements to acl_sddl""" |
1689 |
"""changed acl in if-statements to acl_sddl""" |
1667 |
if isinstance(domainsid, str): |
1690 |
if isinstance(domainsid, str): |
1668 |
sid = security.dom_sid(domainsid) |
1691 |
sid = security.dom_sid(domainsid) |