summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-17 23:16:16 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:51:25 +0100
commit12a513b47b1a1f2adeb2cb2a10ac36d02dd44065 (patch)
treeffd350db11a507777686060b8288b038670f0768
parent57b8a8fd42f5d89f439fd9d0781bd8f561a84131 (diff)
downloadsamba-12a513b47b1a1f2adeb2cb2a10ac36d02dd44065.tar.gz
samba-12a513b47b1a1f2adeb2cb2a10ac36d02dd44065.tar.bz2
samba-12a513b47b1a1f2adeb2cb2a10ac36d02dd44065.zip
r26518: Fix provision of registry using Python.
(This used to be commit 12eb38e553993b2726a803af4ae9c05229d6ebe4)
-rw-r--r--source4/lib/registry/ldb.c2
-rw-r--r--source4/lib/registry/local.c2
-rw-r--r--source4/lib/registry/registry.i5
-rw-r--r--source4/lib/registry/registry.py3
-rw-r--r--source4/lib/registry/registry_wrap.c25
-rw-r--r--source4/scripting/python/samba/provision.py40
6 files changed, 43 insertions, 34 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 78acc3150b..c9697ddb4c 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -346,7 +346,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
if (location == NULL)
return WERR_INVALID_PARAM;
- wrap = ldb_wrap_connect(parent_ctx, global_loadparm,
+ wrap = ldb_wrap_connect(parent_ctx, lp_ctx,
location, session_info, credentials, 0, NULL);
if (wrap == NULL) {
diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c
index 5789a94a6d..1ed4f0262e 100644
--- a/source4/lib/registry/local.c
+++ b/source4/lib/registry/local.c
@@ -321,7 +321,7 @@ WERROR reg_mount_hive(struct registry_context *rctx,
mp->path.predefined_key = key_id;
mp->prev = mp->next = NULL;
mp->key = hive_key;
- if (elements != NULL) {
+ if (elements != NULL && str_list_length(elements) != 0) {
mp->path.elements = talloc_array(mp, const char *,
str_list_length(elements));
for (i = 0; elements[i] != NULL; i++) {
diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i
index c5b4eed968..784462c368 100644
--- a/source4/lib/registry/registry.i
+++ b/source4/lib/registry/registry.i
@@ -105,11 +105,6 @@ typedef struct registry_context {
WERROR mount_hive(struct hive_key *hive_key, uint32_t hkey_id,
const char **elements=NULL);
}
-
- %pythoncode {
- def mount(self, path, hkey_id, elements=[]):
- self.mount_hive(Hive(path), hkey_id, elements)
- }
} reg;
/* Hives */
diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py
index 0097949896..67607cd7ac 100644
--- a/source4/lib/registry/registry.py
+++ b/source4/lib/registry/registry.py
@@ -65,9 +65,6 @@ Registry = _registry.Registry
class reg(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
- def mount(self, path, hkey_id, elements=[]):
- self.mount_hive(Hive(path), hkey_id, elements)
-
def __init__(self, *args, **kwargs):
_registry.reg_swiginit(self,_registry.new_reg(*args, **kwargs))
__swig_destroy__ = _registry.delete_reg
diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c
index 21cc4896f6..e4e1502404 100644
--- a/source4/lib/registry/registry_wrap.c
+++ b/source4/lib/registry/registry_wrap.c
@@ -2470,16 +2470,17 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_p_registry_context swig_types[11]
#define SWIGTYPE_p_p_registry_key swig_types[12]
#define SWIGTYPE_p_param_context swig_types[13]
-#define SWIGTYPE_p_param_section swig_types[14]
-#define SWIGTYPE_p_registry_context swig_types[15]
-#define SWIGTYPE_p_short swig_types[16]
-#define SWIGTYPE_p_signed_char swig_types[17]
-#define SWIGTYPE_p_unsigned_char swig_types[18]
-#define SWIGTYPE_p_unsigned_int swig_types[19]
-#define SWIGTYPE_p_unsigned_long_long swig_types[20]
-#define SWIGTYPE_p_unsigned_short swig_types[21]
-static swig_type_info *swig_types[23];
-static swig_module_info swig_module = {swig_types, 22, 0, 0, 0, 0};
+#define SWIGTYPE_p_param_opt swig_types[14]
+#define SWIGTYPE_p_param_section swig_types[15]
+#define SWIGTYPE_p_registry_context swig_types[16]
+#define SWIGTYPE_p_short swig_types[17]
+#define SWIGTYPE_p_signed_char swig_types[18]
+#define SWIGTYPE_p_unsigned_char swig_types[19]
+#define SWIGTYPE_p_unsigned_int swig_types[20]
+#define SWIGTYPE_p_unsigned_long_long swig_types[21]
+#define SWIGTYPE_p_unsigned_short swig_types[22]
+static swig_type_info *swig_types[24];
+static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -3492,6 +3493,7 @@ static swig_type_info _swigt__p_p_hive_key = {"_p_p_hive_key", "struct hive_key
static swig_type_info _swigt__p_p_registry_context = {"_p_p_registry_context", "struct registry_context **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_registry_key = {"_p_p_registry_key", "struct registry_key **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_registry_context = {"_p_registry_context", "struct registry_context *|reg *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
@@ -3516,6 +3518,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_p_registry_context,
&_swigt__p_p_registry_key,
&_swigt__p_param_context,
+ &_swigt__p_param_opt,
&_swigt__p_param_section,
&_swigt__p_registry_context,
&_swigt__p_short,
@@ -3540,6 +3543,7 @@ static swig_cast_info _swigc__p_p_hive_key[] = { {&_swigt__p_p_hive_key, 0, 0,
static swig_cast_info _swigc__p_p_registry_context[] = { {&_swigt__p_p_registry_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_registry_key[] = { {&_swigt__p_p_registry_key, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_registry_context[] = { {&_swigt__p_registry_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
@@ -3564,6 +3568,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_p_registry_context,
_swigc__p_p_registry_key,
_swigc__p_param_context,
+ _swigc__p_param_opt,
_swigc__p_param_section,
_swigc__p_registry_context,
_swigc__p_short,
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index d88b8501ba..d9863420b6 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -287,11 +287,15 @@ def provision_default_paths(lp, subobj):
paths.keytab = os.path.join(private_dir, "secrets.keytab")
paths.dns = os.path.join(private_dir, subobj.dnsdomain + ".zone")
paths.winsdb = os.path.join(private_dir, "wins.ldb")
- paths.ldap_basedn_ldif = os.path.join(private_dir, subobj.dnsdomain + ".ldif")
- paths.ldap_config_basedn_ldif = os.path.join(private_dir, subobj.dnsdomain + "-config.ldif")
- paths.ldap_schema_basedn_ldif = os.path.join(private_dir, subobj.dnsdomain + "-schema.ldif")
+ paths.ldap_basedn_ldif = os.path.join(private_dir,
+ subobj.dnsdomain + ".ldif")
+ paths.ldap_config_basedn_ldif = os.path.join(private_dir,
+ subobj.dnsdomain + "-config.ldif")
+ paths.ldap_schema_basedn_ldif = os.path.join(private_dir,
+ subobj.dnsdomain + "-schema.ldif")
paths.s4_ldapi_path = os.path.join(private_dir, "ldapi")
- paths.phpldapadminconfig = os.path.join(private_dir, "phpldapadmin-config.php")
+ paths.phpldapadminconfig = os.path.join(private_dir,
+ "phpldapadmin-config.php")
paths.hklm = os.path.join(private_dir, "hklm.ldb")
return paths
@@ -370,8 +374,8 @@ def provision_become_dc(setup_dir, subobj, message, paths, lp, session_info,
setup_ldb(setup_dir, "secrets_init.ldif", session_info, credentials,
subobj, lp, paths.secrets)
- setup_ldb(setup_dir, "secrets.ldif", session_info, credentials, subobj, lp,
- paths.secrets, False)
+ setup_ldb(setup_dir, "secrets.ldif", session_info, credentials, subobj,
+ lp, paths.secrets, False)
def provision(lp, setup_dir, subobj, message, blank, paths, session_info,
@@ -397,26 +401,34 @@ def provision(lp, setup_dir, subobj, message, blank, paths, session_info,
# only install a new smb.conf if there isn't one there already
if not os.path.exists(paths.smbconf):
message("Setting up smb.conf")
- setup_file(setup_dir, "provision.smb.conf", message, paths.smbconf, subobj)
+ setup_file(setup_dir, "provision.smb.conf", message, paths.smbconf,
+ subobj)
lp.reload()
# only install a new shares config db if there is none
if not os.path.exists(paths.shareconf):
message("Setting up share.ldb")
- setup_ldb(setup_dir, "share.ldif", session_info, credentials, subobj, lp, paths.shareconf)
+ setup_ldb(setup_dir, "share.ldif", session_info, credentials, subobj,
+ lp, paths.shareconf)
message("Setting up %s" % paths.secrets)
- setup_ldb(setup_dir, "secrets_init.ldif", session_info, credentials, subobj, lp, paths.secrets)
- setup_ldb(setup_dir, "secrets.ldif", session_info, credentials, subobj, lp, paths.secrets, False)
+ setup_ldb(setup_dir, "secrets_init.ldif", session_info, credentials,
+ subobj, lp, paths.secrets)
+ setup_ldb(setup_dir, "secrets.ldif", session_info, credentials, subobj,
+ lp, paths.secrets, False)
message("Setting up registry")
reg = registry.Registry()
- # FIXME: Still fails for some reason:
- #reg.mount(paths.hklm, registry.HKEY_LOCAL_MACHINE, [])
- #reg.apply_patchfile(os.path.join(setup_dir, "provision.reg"))
+ hive = registry.Hive(paths.hklm, session_info=session_info,
+ credentials=credentials, lp_ctx=lp)
+ reg.mount_hive(hive, registry.HKEY_LOCAL_MACHINE, [])
+ provision_reg = os.path.join(setup_dir, "provision.reg")
+ assert os.path.exists(provision_reg)
+ reg.apply_patchfile(provision_reg)
message("Setting up templates into %s" % paths.templates)
- setup_ldb(setup_dir, "provision_templates.ldif", session_info, credentials, subobj, lp, paths.templates)
+ setup_ldb(setup_dir, "provision_templates.ldif", session_info,
+ credentials, subobj, lp, paths.templates)
message("Setting up sam.ldb partitions")
setup_ldb(setup_dir, "provision_partitions.ldif", session_info,