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

ntacl: Use existing infrastructure.

This commit is contained in:
Jelmer Vernooij
2010-03-01 04:39:53 +01:00
parent da96d3fdba
commit 6d9c0724a6
2 changed files with 27 additions and 27 deletions

View File

@ -18,7 +18,7 @@
#
import optparse
from samba import getopt as options, Ldb
from samba import getopt as options
import sys

View File

@ -26,15 +26,13 @@ from samba import Ldb
from samba.ndr import ndr_unpack
from ldb import SCOPE_BASE
import ldb
import os
import sys
from samba.auth import system_session
from samba.netcmd import (
Command,
SuperCommand,
CommandError,
SuperCommand,
Option,
)
@ -67,17 +65,19 @@ class cmd_acl_set(Command):
try:
ldb = Ldb(path, session_info=system_session(), credentials=creds,lp=lp)
except:
print "Unable to read domain SID from configuration files"
sys.exit(1)
# XXX: Should catch a particular exception type
raise CommandError("Unable to read domain SID from configuration files")
attrs = ["objectSid"]
print lp.get("realm")
res = ldb.search(expression="(objectClass=*)",base="flatname=%s,cn=Primary Domains"%lp.get("workgroup"), scope=SCOPE_BASE, attrs=attrs)
res = ldb.search(expression="(objectClass=*)",
base="flatname=%s,cn=Primary Domains" % lp.get("workgroup"),
scope=SCOPE_BASE, attrs=attrs)
if len(res) !=0:
domainsid = ndr_unpack(security.dom_sid, res[0]["objectSid"][0])
setntacl(lp, file, acl, str(domainsid), xattr_backend, eadb_file)
else:
print "Unable to read domain SID from configuration files"
sys.exit(1)
raise CommandError("Unable to read domain SID from configuration files")
class cmd_acl_get(Command):
"""Set ACLs on a file"""