svn commit: samba r26518 - in branches/SAMBA_4_0: . source/lib/registry source/scripting/python/samba

jelmer at samba.org jelmer at samba.org
Mon Dec 17 23:16:18 GMT 2007


Author: jelmer
Date: 2007-12-17 23:16:16 +0000 (Mon, 17 Dec 2007)
New Revision: 26518

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26518

Log:
Fix provision of registry using Python.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/registry/ldb.c
   branches/SAMBA_4_0/source/lib/registry/local.c
   branches/SAMBA_4_0/source/lib/registry/registry.i
   branches/SAMBA_4_0/source/lib/registry/registry.py
   branches/SAMBA_4_0/source/lib/registry/registry_wrap.c
   branches/SAMBA_4_0/source/scripting/python/samba/provision.py


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/registry/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/ldb.c	2007-12-17 23:16:12 UTC (rev 26517)
+++ branches/SAMBA_4_0/source/lib/registry/ldb.c	2007-12-17 23:16:16 UTC (rev 26518)
@@ -346,7 +346,7 @@
 	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) {

Modified: branches/SAMBA_4_0/source/lib/registry/local.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/local.c	2007-12-17 23:16:12 UTC (rev 26517)
+++ branches/SAMBA_4_0/source/lib/registry/local.c	2007-12-17 23:16:16 UTC (rev 26518)
@@ -321,7 +321,7 @@
 	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++) {

Modified: branches/SAMBA_4_0/source/lib/registry/registry.i
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/registry.i	2007-12-17 23:16:12 UTC (rev 26517)
+++ branches/SAMBA_4_0/source/lib/registry/registry.i	2007-12-17 23:16:16 UTC (rev 26518)
@@ -105,11 +105,6 @@
     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 */

Modified: branches/SAMBA_4_0/source/lib/registry/registry.py
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/registry.py	2007-12-17 23:16:12 UTC (rev 26517)
+++ branches/SAMBA_4_0/source/lib/registry/registry.py	2007-12-17 23:16:16 UTC (rev 26518)
@@ -65,9 +65,6 @@
 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

Modified: branches/SAMBA_4_0/source/lib/registry/registry_wrap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/registry_wrap.c	2007-12-17 23:16:12 UTC (rev 26517)
+++ branches/SAMBA_4_0/source/lib/registry/registry_wrap.c	2007-12-17 23:16:16 UTC (rev 26518)
@@ -2470,16 +2470,17 @@
 #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_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 @@
   &_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_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 @@
   _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,

Modified: branches/SAMBA_4_0/source/scripting/python/samba/provision.py
===================================================================
--- branches/SAMBA_4_0/source/scripting/python/samba/provision.py	2007-12-17 23:16:12 UTC (rev 26517)
+++ branches/SAMBA_4_0/source/scripting/python/samba/provision.py	2007-12-17 23:16:16 UTC (rev 26518)
@@ -287,11 +287,15 @@
     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 @@
     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 @@
     # 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, 



More information about the samba-cvs mailing list