summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/param/provision.c11
-rw-r--r--source4/param/provision.h8
-rw-r--r--source4/scripting/python/samba/provision.py2
-rw-r--r--source4/torture/local/torture.c6
4 files changed, 20 insertions, 7 deletions
diff --git a/source4/param/provision.c b/source4/param/provision.c
index 5d1f01c59a..41b062883c 100644
--- a/source4/param/provision.c
+++ b/source4/param/provision.c
@@ -29,9 +29,10 @@
#include "scripting/python/modules.h"
NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
- struct provision_settings *settings)
+ struct provision_settings *settings,
+ struct provision_result *result)
{
- PyObject *provision_mod, *provision_dict, *provision_fn, *result, *parameters;
+ PyObject *provision_mod, *provision_dict, *provision_fn, *py_result, *parameters;
DEBUG(0,("Provision for Become-DC test using python\n"));
@@ -115,15 +116,17 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
PyDict_SetItemString(parameters, "machinepass",
PyString_FromString(settings->machine_password));
- result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters);
+ py_result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters);
Py_DECREF(parameters);
- if (result == NULL) {
+ if (py_result == NULL) {
PyErr_Print();
PyErr_Clear();
return NT_STATUS_UNSUCCESSFUL;
}
+ result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn")));
+
return NT_STATUS_OK;
}
diff --git a/source4/param/provision.h b/source4/param/provision.h
index 323159d417..e739053d50 100644
--- a/source4/param/provision.h
+++ b/source4/param/provision.h
@@ -39,7 +39,13 @@ struct provision_settings {
const char *targetdir;
};
+/* FIXME: Rename this to hostconfig ? */
+struct provision_result {
+ const char *domaindn;
+};
+
NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
- struct provision_settings *settings);
+ struct provision_settings *settings,
+ struct provision_result *result);
#endif /* _PROVISION_H_ */
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index c9cdcdb768..ccf67a0b4a 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -1082,7 +1082,7 @@ def provision_become_dc(setup_dir=None,
"""print a message if quiet is not set."""
print text
- provision(setup_dir, message, system_session(), None,
+ return provision(setup_dir, message, system_session(), None,
smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS, realm=realm,
rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, serverdn=serverdn,
domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename);
diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c
index 718bd38aad..17d83456d5 100644
--- a/source4/torture/local/torture.c
+++ b/source4/torture/local/torture.c
@@ -44,6 +44,7 @@ static bool test_provision(struct torture_context *tctx)
{
NTSTATUS status;
struct provision_settings *settings = talloc(tctx, struct provision_settings);
+ struct provision_result result;
char *targetdir = NULL;
torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir),
@@ -64,10 +65,13 @@ static bool test_provision(struct torture_context *tctx)
settings->ntds_dn_str = NULL;
settings->machine_password = "geheim";
- status = provision_bare(settings, tctx->lp_ctx, settings);
+ status = provision_bare(settings, tctx->lp_ctx, settings, &result);
torture_assert_ntstatus_ok(tctx, status, "provision");
+ torture_assert_str_equal(tctx, result.domaindn, "DC=EXAMPLE,DC=COM",
+ "domaindn incorrect");
+
return true;
}