From ca74c6e6c426e6b69ba31676e2b06dda29b5409e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 17 Dec 2007 20:03:06 +0100 Subject: r26513: Update substitution dictionary for ldifs. (This used to be commit 60fb2de2119cb2f42f858868e39c3b0d303ac20f) --- source4/scripting/python/misc.i | 3 +++ source4/scripting/python/misc.py | 1 + source4/scripting/python/misc_wrap.c | 14 ++++++++++++++ source4/scripting/python/samba/__init__.py | 3 +++ source4/scripting/python/samba/provision.py | 6 ++++++ 5 files changed, 27 insertions(+) diff --git a/source4/scripting/python/misc.i b/source4/scripting/python/misc.i index 518011ea43..eda0db2c3d 100644 --- a/source4/scripting/python/misc.i +++ b/source4/scripting/python/misc.i @@ -59,3 +59,6 @@ bool samdb_set_domain_sid(struct ldb_context *ldb, const struct dom_sid *dom_sid_in); WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf, const char *df); + +%rename(version) samba_version_string; +const char *samba_version_string(void); diff --git a/source4/scripting/python/misc.py b/source4/scripting/python/misc.py index 525869ff58..228ab24dbf 100644 --- a/source4/scripting/python/misc.py +++ b/source4/scripting/python/misc.py @@ -67,5 +67,6 @@ ldb_set_session_info = _misc.ldb_set_session_info ldb_set_loadparm = _misc.ldb_set_loadparm samdb_set_domain_sid = _misc.samdb_set_domain_sid dsdb_attach_schema_from_ldif_file = _misc.dsdb_attach_schema_from_ldif_file +version = _misc.version diff --git a/source4/scripting/python/misc_wrap.c b/source4/scripting/python/misc_wrap.c index 7db909d392..effabdecef 100644 --- a/source4/scripting/python/misc_wrap.c +++ b/source4/scripting/python/misc_wrap.c @@ -3038,6 +3038,19 @@ fail: } +SWIGINTERN PyObject *_wrap_version(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *result = 0 ; + + if (!SWIG_Python_UnpackTuple(args,"version",0,0,0)) SWIG_fail; + result = (char *)samba_version_string(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + static PyMethodDef SwigMethods[] = { { (char *)"random_password", (PyCFunction) _wrap_random_password, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ldb_set_credentials", (PyCFunction) _wrap_ldb_set_credentials, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -3045,6 +3058,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"ldb_set_loadparm", (PyCFunction) _wrap_ldb_set_loadparm, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"samdb_set_domain_sid", (PyCFunction) _wrap_samdb_set_domain_sid, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"dsdb_attach_schema_from_ldif_file", (PyCFunction) _wrap_dsdb_attach_schema_from_ldif_file, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"version", (PyCFunction)_wrap_version, METH_NOARGS, NULL}, { NULL, NULL, 0, NULL } }; diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 511dcd905a..f89ac39ac7 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -122,6 +122,8 @@ def substitute_var(text, values): for (name, value) in values.items(): text = text.replace("${%s}" % name, value) + assert "${" not in text, text + return text @@ -133,3 +135,4 @@ def valid_netbios_name(name): return False return True +version = misc.version diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 34191b7269..7d7b85c13e 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -14,6 +14,7 @@ import uuid, misc from socket import gethostname, gethostbyname import param import registry +import samba from samba import Ldb, substitute_var, valid_netbios_name from samba.samdb import SamDB import security @@ -56,6 +57,7 @@ class ProvisionSettings(object): self.schemedn_ldb = None self.s4_ldapi_path = None self.policyguid = None + self.extensibleobject = None def subst_vars(self): return {"SCHEMADN": self.schemadn, @@ -77,6 +79,7 @@ class ProvisionSettings(object): "NETBIOSNAME": self.netbiosname, "DNSNAME": self.dnsname, "ROOTDN": self.rootdn, + "DOMAIN": self.domain, "DNSDOMAIN": self.dnsdomain, "REALM": self.realm, "DEFAULTSITE": self.defaultsite, @@ -89,6 +92,9 @@ class ProvisionSettings(object): "POLICYGUID": self.policyguid, "RDN_DC": self.rdn_dc, "DOMAINGUID_MOD": self.domainguid_mod, + "VERSION": samba.version(), + "ACI": "# no aci for local ldb", + "EXTENSIBLEOBJECT": self.extensibleobject, } def fix(self, paths): -- cgit