[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Fri Feb 26 00:20:23 MST 2010


The branch, master has been updated
       via  c2edea5... devel: get the ownership of the directories right in tmpfs.sh
       via  1e2ac9b... s4-provision: fixed use of rndc command from python
       via  97d6577... s4-provision: also create the dns_update_list when running net vampire
       via  8cb721b... s4-dns: fixed CNAME automatic DNS updates
       via  b0b857d... s4-dns: use a loadparm list for samba_runcmd() commands
      from  336ebea... s4-provision: added dns_update_list

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c2edea5ccfb1eadabc3fd4a6d1eb9c5c0a8251e2
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 26 18:19:23 2010 +1100

    devel: get the ownership of the directories right in tmpfs.sh

commit 1e2ac9b8967f820cdabcc32578685cea9f644c03
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 26 17:49:01 2010 +1100

    s4-provision: fixed use of rndc command from python
    
    rndc command is now a list

commit 97d65774d4c91ab046bf67c7c99a47a37b340d08
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 26 17:22:44 2010 +1100

    s4-provision: also create the dns_update_list when running net vampire
    
    We need the list when joining a windows domain, so we can
    automatically maintain the right DNS entries on the Windows DNS server

commit 8cb721b2936e09f1db2a0b565e144041d4294173
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 26 17:09:51 2010 +1100

    s4-dns: fixed CNAME automatic DNS updates

commit b0b857d6ca842fb516b3330a11e0d6d78f35aded
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 26 17:09:35 2010 +1100

    s4-dns: use a loadparm list for samba_runcmd() commands
    
    This allows commands with multiple arguments and quoting to be used,
    while still avoiding running a shell (and this having shell expansion
    problems)

-----------------------------------------------------------------------

Summary of changes:
 lib/util/util.h                             |    2 +-
 lib/util/util_runcmd.c                      |   10 +++++-----
 source4/dsdb/dns/dns_update.c               |    8 ++++----
 source4/param/loadparm.c                    |   12 ++++++------
 source4/param/param.h                       |    4 ++--
 source4/scripting/bin/samba_dnsupdate       |    2 +-
 source4/scripting/devel/tmpfs.sh            |    4 ++--
 source4/scripting/python/samba/provision.py |   12 +++++++++++-
 8 files changed, 32 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/util.h b/lib/util/util.h
index 01831fc..e1608a8 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -890,7 +890,7 @@ struct composite_context *samba_runcmd(struct tevent_context *ev,
 				       struct timeval timeout,
 				       int stdout_log_level,
 				       int stderr_log_level,
-				       const char *arg0, ...);
+				       const char **argv0, ...);
 
 
 #endif /* _SAMBA_UTIL_H_ */
diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c
index 80574c4..dea3ff9 100644
--- a/lib/util/util_runcmd.c
+++ b/lib/util/util_runcmd.c
@@ -154,7 +154,7 @@ struct composite_context *samba_runcmd(struct tevent_context *ev,
 				       struct timeval timeout,
 				       int stdout_log_level,
 				       int stderr_log_level,
-				       const char *arg0, ...)
+				       const char **argv0, ...)
 {
 	struct samba_runcmd *r;
 	int p1[2], p2[2];
@@ -174,7 +174,7 @@ struct composite_context *samba_runcmd(struct tevent_context *ev,
 	r->stdout_log_level = stdout_log_level;
 	r->stderr_log_level = stderr_log_level;
 
-	r->arg0 = talloc_strdup(r, arg0);
+	r->arg0 = talloc_strdup(r, argv0[0]);
 	if (composite_nomem(r->arg0, c)) return c;
 
 	if (pipe(p1) != 0) {
@@ -228,13 +228,13 @@ struct composite_context *samba_runcmd(struct tevent_context *ev,
 	dup2(p1[1], 1);
 	dup2(p2[1], 2);
 
-	argv = str_list_make_single(r, r->arg0);
+	argv = str_list_copy(r, argv0);
 	if (!argv) {
 		fprintf(stderr, "Out of memory in child\n");
 		_exit(255);
 	}
 
-	va_start(ap, arg0);
+	va_start(ap, argv0);
 	while (1) {
 		char *arg = va_arg(ap, char *);
 		if (arg == NULL) break;
@@ -246,7 +246,7 @@ struct composite_context *samba_runcmd(struct tevent_context *ev,
 	}
 	va_end(ap);
 
-	ret = execv(arg0, argv);
+	ret = execv(r->arg0, argv);
 	fprintf(stderr, "Failed to exec child - %s\n", strerror(errno));
 	_exit(255);
 	return NULL;
diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c
index 82cb715..4fefd65 100644
--- a/source4/dsdb/dns/dns_update.c
+++ b/source4/dsdb/dns/dns_update.c
@@ -157,10 +157,10 @@ static void dnsupdate_rebuild(struct dnsupdate_service *service)
 
 	DEBUG(2,("Loading new DNS update grant rules\n"));
 	service->confupdate.c = samba_runcmd(service->task->event_ctx, service,
-					   timeval_current_ofs(10, 0),
-					   2, 0,
-					   lp_rndc_command(service->task->lp_ctx),
-					   "reload", NULL);
+					     timeval_current_ofs(10, 0),
+					     2, 0,
+					     lp_rndc_command(service->task->lp_ctx),
+					     "reload", NULL);
 	service->confupdate.c->async.fn = dnsupdate_rndc_done;
 	service->confupdate.c->async.private_data = service;
 
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 5eaf67f..46bbceb 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -186,8 +186,8 @@ struct loadparm_global
 	int bDisableNetbios;
 	int bRpcBigEndian;
 	char *szNTPSignDSocketDirectory;
-	char *szRNDCCommand;
-	char *szDNSUpdateCommand;
+	const char **szRNDCCommand;
+	const char **szDNSUpdateCommand;
 	char *szNSUpdateCommand;
 	struct parmlist_entry *param_opt;
 };
@@ -506,8 +506,8 @@ static struct parm_struct parm_table[] = {
 	{"idmap trusted only", P_BOOL, P_GLOBAL, GLOBAL_VAR(bIdmapTrustedOnly), NULL, NULL},
 
 	{"ntp signd socket directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szNTPSignDSocketDirectory), NULL, NULL },
-	{"rndc command", P_STRING, P_GLOBAL, GLOBAL_VAR(szRNDCCommand), NULL, NULL },
-	{"dns update command", P_STRING, P_GLOBAL, GLOBAL_VAR(szDNSUpdateCommand), NULL, NULL },
+	{"rndc command", P_LIST, P_GLOBAL, GLOBAL_VAR(szRNDCCommand), NULL, NULL },
+	{"dns update command", P_LIST, P_GLOBAL, GLOBAL_VAR(szDNSUpdateCommand), NULL, NULL },
 	{"nsupdate command", P_STRING, P_GLOBAL, GLOBAL_VAR(szNSUpdateCommand), NULL, NULL },
 
 	{NULL, P_BOOL, P_NONE, 0, NULL, NULL}
@@ -660,8 +660,8 @@ _PUBLIC_ FN_GLOBAL_STRING(lp_dos_charset, dos_charset)
 _PUBLIC_ FN_GLOBAL_STRING(lp_unix_charset, unix_charset)
 _PUBLIC_ FN_GLOBAL_STRING(lp_display_charset, display_charset)
 _PUBLIC_ FN_GLOBAL_STRING(lp_piddir, szPidDir)
-_PUBLIC_ FN_GLOBAL_STRING(lp_rndc_command, szRNDCCommand)
-_PUBLIC_ FN_GLOBAL_STRING(lp_dns_update_command, szDNSUpdateCommand)
+_PUBLIC_ FN_GLOBAL_LIST(lp_rndc_command, szRNDCCommand)
+_PUBLIC_ FN_GLOBAL_LIST(lp_dns_update_command, szDNSUpdateCommand)
 _PUBLIC_ FN_GLOBAL_STRING(lp_nsupdate_command, szNSUpdateCommand)
 _PUBLIC_ FN_GLOBAL_LIST(lp_dcerpc_endpoint_servers, dcerpc_ep_servers)
 _PUBLIC_ FN_GLOBAL_LIST(lp_server_services, server_services)
diff --git a/source4/param/param.h b/source4/param/param.h
index 4ac7eef..f72fa76 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -130,8 +130,8 @@ const char **lp_wins_server_list(struct loadparm_context *);
 const char **lp_interfaces(struct loadparm_context *);
 const char *lp_socket_address(struct loadparm_context *);
 const char **lp_netbios_aliases(struct loadparm_context *);
-const char *lp_rndc_command(struct loadparm_context *);
-const char *lp_dns_update_command(struct loadparm_context *);
+const char **lp_rndc_command(struct loadparm_context *);
+const char **lp_dns_update_command(struct loadparm_context *);
 bool lp_disable_netbios(struct loadparm_context *);
 bool lp_wins_support(struct loadparm_context *);
 bool lp_wins_dns_proxy(struct loadparm_context *);
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index 9a90eac..9eaf3df 100755
--- a/source4/scripting/bin/samba_dnsupdate
+++ b/source4/scripting/bin/samba_dnsupdate
@@ -199,7 +199,7 @@ def call_nsupdate(d):
                                                            d.existing_port, d.dest))
         f.write("update add %s %u SRV 0 100 %s %s\n" % (d.name, default_ttl, d.port, d.dest))
     if d.type == "CNAME":
-        f.write("update add %s %u SRV %s\n" % (d.name, default_ttl, d.dest))
+        f.write("update add %s %u CNAME %s\n" % (d.name, default_ttl, d.dest))
     if opts.verbose:
         f.write("show\n")
     f.write("send\n")
diff --git a/source4/scripting/devel/tmpfs.sh b/source4/scripting/devel/tmpfs.sh
index 14e9b27..44ee04b 100755
--- a/source4/scripting/devel/tmpfs.sh
+++ b/source4/scripting/devel/tmpfs.sh
@@ -9,8 +9,8 @@ sudo umount bin > /dev/null 2>&1
 sudo umount st  > /dev/null 2>&1 
 mkdir -p bin st || exit 1
 sudo mount -t tmpfs /dev/null bin || exit 1
-sudo chown $USER bin || exit 1
+sudo chown $USER bin/. || exit 1
 echo "tmpfs setup for bin/"
 sudo mount -t tmpfs /dev/null st || exit 1
-sudo chown $USER st || exit 1
+sudo chown $USER st/. || exit 1
 echo "tmpfs setup for st/"
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 6adc79f..def91f3 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -1404,6 +1404,9 @@ def provision(setup_dir, message, session_info,
                              realm=names.realm)
             message("A Kerberos configuration suitable for Samba 4 has been generated at %s" % paths.krb5conf)
 
+    if serverrole == "domain controller":
+        create_dns_update_list(lp, message, paths, setup_path)
+
     provision_backend.post_setup()
     provision_backend.shutdown()
     
@@ -1538,7 +1541,7 @@ def create_zone_file(lp, message, paths, targetdir, setup_path, dnsdomain,
 
     # we need to freeze the zone while we update the contents
     if targetdir is None:
-        rndc = lp.get("rndc command")
+        rndc = ' '.join(lp.get("rndc command"))
         os.system(rndc + " freeze " + lp.get("realm"))
 
     setup_file(setup_path("provision.zone"), paths.dns, {
@@ -1573,6 +1576,13 @@ def create_zone_file(lp, message, paths, targetdir, setup_path, dnsdomain,
         os.system(rndc + " unfreeze " + lp.get("realm"))
 
 
+def create_dns_update_list(lp, message, paths, setup_path):
+    """Write out a dns_update_list file"""
+    # note that we use no variable substitution on this file
+    # the substitution is done at runtime by samba_dnsupdate
+    setup_file(setup_path("dns_update_list"), paths.dns_update_list, None)
+
+
 def create_named_conf(paths, setup_path, realm, dnsdomain,
                       private_dir):
     """Write out a file containing zone statements suitable for inclusion in a


-- 
Samba Shared Repository


More information about the samba-cvs mailing list