summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2018-11-23 09:46:38 +1300
committerTim Beale <timbeale@samba.org>2018-11-27 03:43:17 +0100
commitcbcd8eec6ea7eb32d4860eefdec5009ff274e967 (patch)
tree1b2d3fecf95307643c38892da3b0e4ae3cd5bab4 /python
parent738418ea3ee669b1b917f4b8a6da1f69fa3558f1 (diff)
downloadsamba-cbcd8eec6ea7eb32d4860eefdec5009ff274e967.tar.gz
tests: Work out DOMSID via samdb rather than environs
Not all testenvs have the DOMSID set as an environment variable. However, it's easy enough to work out from querying the samdb. This is a slight change in that we use a source4-generated loadparm to connect to the DB (self.lp is source3-generated, presumably for some SMB connection dependency). This change is so we can run the ntacls_backup tests against a DC with SMBv1 disabled (the restoredc). Note that currently the tests fail in the smb.SMB() connection in the setUp(), so we can't run them as part of autobuild just yet (because we can't known-fail test errors). BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/ntacls_backup.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/python/samba/tests/ntacls_backup.py b/python/samba/tests/ntacls_backup.py
index bb1bc97ef43..0ee044f1336 100644
--- a/python/samba/tests/ntacls_backup.py
+++ b/python/samba/tests/ntacls_backup.py
@@ -25,9 +25,8 @@ from samba import samdb
from samba import ntacls
from samba.auth import system_session
-from samba.param import LoadParm
from samba.dcerpc import security
-from samba.tests import TestCaseInTempDir
+from samba.tests import TestCaseInTempDir, env_loadparm
class NtaclsBackupRestoreTests(TestCaseInTempDir):
@@ -47,21 +46,20 @@ class NtaclsBackupRestoreTests(TestCaseInTempDir):
os.environ["LOCAL_PATH"], self.service)
self.smb_conf_path = os.environ['SMB_CONF_PATH']
- self.dom_sid = security.dom_sid(os.environ['DOMSID'])
-
self.creds = self.insta_creds(template=self.get_credentials())
+ self.samdb_conn = samdb.SamDB(
+ url=samdb_url, session_info=system_session(),
+ credentials=self.creds, lp=env_loadparm())
+
+ self.dom_sid = security.dom_sid(self.samdb_conn.get_domain_sid())
+
# helper will load conf into lp, that's how smbd can find services.
self.ntacls_helper = ntacls.NtaclsHelper(self.service,
self.smb_conf_path,
self.dom_sid)
-
self.lp = self.ntacls_helper.lp
- self.samdb_conn = samdb.SamDB(
- url=samdb_url, session_info=system_session(),
- credentials=self.creds, lp=self.lp)
-
self.smb_conn = smb.SMB(
self.server, self.service, lp=self.lp, creds=self.creds)