[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Tue Apr 20 22:11:54 MDT 2010


The branch, master has been updated
       via  5e695de... s4-upgradeprovision: fixed --realm option duplicate in upgrade_from_s3
       via  2edff9f... s4-drs: accept zero revision in drs selftest
       via  8fdfcde... s4-provision: cope with --realm being in getopt.py
       via  b0a73fb... s4-waf: create the smbd.tmp/messaging directory
       via  1a68311... s4-python: added --realm option to python scripts
       via  0c0bbf2... s4-provision: set "setup_dir" to the right path
       via  2dcc844... s4-schema: allow revision numbers of zero
       via  024b537... s4-python: accept --option arguments in python cmdline parsing
       via  899fa60... s4-devel: allow extra net command line options and gdb
       via  7ccebb4... s4-pynet: accept None for target_dir in vampire
      from  61bdffb... Fix i18n of net conf import error message.

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


- Log -----------------------------------------------------------------
commit 5e695dec2af347dd9211a1dec45f10f751bbafb5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 13:35:52 2010 +1000

    s4-upgradeprovision: fixed --realm option duplicate in upgrade_from_s3

commit 2edff9f5ff2e61f2d6c2705f05ebcab4d61b4307
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 12:39:32 2010 +1000

    s4-drs: accept zero revision in drs selftest
    
    Kamen, please have a look at this. We need to accept revision zero as
    w2k8r2 sends it during initial schema replication
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 8fdfcde56cc78e8ea5c0bc2aa6c1dfa5515ff2c0
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 12:32:26 2010 +1000

    s4-provision: cope with --realm being in getopt.py
    
    we still need to allow for interactive querying of the realm
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit b0a73fbf30ca73934be670c812acebc88255ba2b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 12:02:33 2010 +1000

    s4-waf: create the smbd.tmp/messaging directory
    
    this prevents a warning when we run net vampire from the install dir
    when samba has never been run previously
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 1a68311d41665b7f3ca1209ca1edf1bb92673bc4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 12:01:47 2010 +1000

    s4-python: added --realm option to python scripts
    
    this is needed for net vampire
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 0c0bbf2932edc55a897029f34faee105e5b694aa
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 12:01:16 2010 +1000

    s4-provision: set "setup_dir" to the right path
    
    This needs to cope with both running from the build tree or running
    from the install tree. We use the provision.smb.conf.dc as a sentinal
    to detect if we are in the build tree.
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 2dcc84432ec264d6b322c281d0db1d731ce16b1b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 11:34:24 2010 +1000

    s4-schema: allow revision numbers of zero
    
    w2k8r2 sends a revision of zero in the initial schema replication
    during a net vampire
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 024b53755c88855d7e88f256af03bd24280999f0
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 11:33:43 2010 +1000

    s4-python: accept --option arguments in python cmdline parsing
    
    also fixed the -d option to use lp.set() which calls lp_set_cmdline()
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 899fa60dd2cf24fc32c83f17080fa5f221861541
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 11:32:58 2010 +1000

    s4-devel: allow extra net command line options and gdb
    
    This allows you to run:
    
      GDB="gdb --args" vampire_ad.sh
    
    and also to add higher debug levels like this:
    
      vampire_ad.sh -d100
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 7ccebb49af8d7d77ce2f3e9124148e1f4100165c
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Apr 21 11:31:59 2010 +1000

    s4-pynet: accept None for target_dir in vampire

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

Summary of changes:
 source4/dsdb/schema/schema_info_attr.c      |    9 ++----
 source4/libnet/py_net.c                     |    2 +-
 source4/param/provision.c                   |   10 ++++++-
 source4/scripting/bin/upgradeprovision      |    2 +-
 source4/scripting/devel/drs/vampire_ad.sh   |    2 +-
 source4/scripting/python/samba/getopt.py    |   35 ++++++++++++++++++--------
 source4/setup/provision                     |    3 +-
 source4/setup/upgrade_from_s3               |    1 -
 source4/torture/drs/unit/schemainfo_tests.c |    5 ++++
 source4/wscript_build                       |    2 +-
 10 files changed, 46 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/schema/schema_info_attr.c b/source4/dsdb/schema/schema_info_attr.c
index 1651847..132c72a 100644
--- a/source4/dsdb/schema/schema_info_attr.c
+++ b/source4/dsdb/schema/schema_info_attr.c
@@ -68,17 +68,14 @@ WERROR dsdb_schema_info_from_blob(const DATA_BLOB *blob,
 		return ntstatus_to_werror(nt_status);
 	}
 
-	/* revision must be not less than 1 */
-	if (schema_info_blob.revision < 1) {
-		talloc_free(temp_ctx);
-		return WERR_INVALID_PARAMETER;
-	}
-
 	schema_info = talloc(mem_ctx, struct dsdb_schema_info);
 	if (!schema_info) {
 		talloc_free(temp_ctx);
 		return WERR_NOMEM;
 	}
+
+	/* note that we accept revision numbers of zero now - w2k8r2
+	   sends a revision of zero on initial vampire */
 	schema_info->revision      = schema_info_blob.revision;
 	schema_info->invocation_id = schema_info_blob.invocation_id;
 	*_schema_info = schema_info;
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index cdf8aeb..0592b3f 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -277,7 +277,7 @@ static PyObject *py_net_vampire(py_net_Object *self, PyObject *args, PyObject *k
 	PyObject *ret;
 	struct libnet_Vampire r;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|s", discard_const_p(char *, kwnames),
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|z", discard_const_p(char *, kwnames),
 	                                 &r.in.domain_name, &r.in.targetdir)) {
 		return NULL;
 	}
diff --git a/source4/param/provision.c b/source4/param/provision.c
index 91260c6..68c8723 100644
--- a/source4/param/provision.c
+++ b/source4/param/provision.c
@@ -35,6 +35,7 @@
 #include "scripting/python/modules.h"
 #include "lib/ldb/pyldb.h"
 #include "param/pyparam.h"
+#include "dynconfig/dynconfig.h"
 
 static PyObject *provision_module(void)
 {
@@ -138,8 +139,13 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
 	if (settings->targetdir != NULL)
 		PyDict_SetItemString(parameters, "targetdir", 
 							 PyString_FromString(settings->targetdir));
-	PyDict_SetItemString(parameters, "setup_dir", 
-			     PyString_FromString("setup"));
+	if (file_exist("setup/provision.smb.conf.dc")) {
+		PyDict_SetItemString(parameters, "setup_dir",
+				     PyString_FromString("setup"));
+	} else {
+		PyDict_SetItemString(parameters, "setup_dir",
+				     PyString_FromString(dyn_SETUPDIR));
+	}
 	PyDict_SetItemString(parameters, "hostname", 
 						 PyString_FromString(settings->netbios_name));
 	PyDict_SetItemString(parameters, "domain", 
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index c33ef6f..066fbe4 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -862,7 +862,7 @@ def update_machine_account_password(paths, creds, session, names):
         kvno = int(str(res[0]["msDs-keyVersionNumber"]))
 
         secretsdb_self_join(secrets_ldb, domain=names.domain,
-                    realm=names.realm,
+                    realm=names.realm or sambaopts._lp.get('realm'),
                     domainsid=names.domainsid,
                     dnsdomain=names.dnsdomain,
                     netbiosname=names.netbiosname,
diff --git a/source4/scripting/devel/drs/vampire_ad.sh b/source4/scripting/devel/drs/vampire_ad.sh
index c40ca64..7a6be50 100755
--- a/source4/scripting/devel/drs/vampire_ad.sh
+++ b/source4/scripting/devel/drs/vampire_ad.sh
@@ -15,6 +15,6 @@ sudo rndc reconfig
 
 REALM="$(echo $DNSDOMAIN | tr '[a-z]' '[A-Z]')"
 
-sudo bin/net vampire $DNSDOMAIN -Uadministrator%$pass -s $PREFIX/etc/smb.conf --option=realm=$REALM --option="ads:dc function level=4" --option="ads:min function level=0" -d2 || exit 1
+sudo $GDB bin/net vampire $DNSDOMAIN -Uadministrator%$pass -s $PREFIX/etc/smb.conf --option=realm=$REALM --option="ads:dc function level=4" --option="ads:min function level=0" -d2 "$@" || exit 1
 PRIVATEDIR=$PREFIX/private sudo -E scripting/bin/setup_dns.sh $machine $DNSDOMAIN $machine_ip || exit 1
 sudo rndc flush
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index 6ec7def..a9196b4 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -19,7 +19,7 @@
 
 """Support for parsing Samba-related command-line options."""
 
-import optparse
+import optparse, os
 from credentials import Credentials, DONT_USE_KERBEROS, MUST_USE_KERBEROS
 from hostconfig import Hostconfig
 import samba
@@ -29,6 +29,7 @@ __docformat__ = "restructuredText"
 class SambaOptions(optparse.OptionGroup):
     """General Samba-related command line options."""
     def __init__(self, parser):
+        import os, param
         optparse.OptionGroup.__init__(self, parser, "Samba Common Options")
         self.add_option("-s", "--configfile", action="callback",
                         type=str, metavar="FILE", help="Configuration file",
@@ -36,8 +37,14 @@ class SambaOptions(optparse.OptionGroup):
         self.add_option("-d", "--debuglevel", action="callback",
                         type=int, metavar="DEBUGLEVEL", help="debug level",
                         callback=self._set_debuglevel)
+        self.add_option("--option", action="callback",
+                        type=str, metavar="OPTION", help="set smb.conf option from command line",
+                        callback=self._set_option)
+        self.add_option("--realm", action="callback",
+                        type=str, metavar="REALM", help="set the realm name",
+                        callback=self._set_realm)
         self._configfile = None
-        self._debuglevel = None
+        self._lp = param.LoadParm()
 
     def get_loadparm_path(self):
         """Return the path to the smb.conf file specified on the command line.  """
@@ -47,21 +54,27 @@ class SambaOptions(optparse.OptionGroup):
         self._configfile = arg
 
     def _set_debuglevel(self, option, opt_str, arg, parser):
-        self._debuglevel = arg
+        self._lp.set('debug level', str(arg))
+
+    def _set_realm(self, option, opt_str, arg, parser):
+        self._lp.set('realm', arg)
+
+    def _set_option(self, option, opt_str, arg, parser):
+        if arg.find('=') == -1:
+            print("--option takes a 'a=b' argument")
+            sys.exit(1)
+        a = arg.split('=')
+        self._lp.set(a[0], a[1])
 
     def get_loadparm(self):
         """Return a loadparm object with data specified on the command line.  """
-        import os, param
-        lp = param.LoadParm()
         if self._configfile is not None:
-            lp.load(self._configfile)
+            self._lp.load(self._configfile)
         elif os.getenv("SMB_CONF_PATH") is not None:
-            lp.load(os.getenv("SMB_CONF_PATH"))
+            self._lp.load(os.getenv("SMB_CONF_PATH"))
         else:
-            lp.load_default()
-        if self._debuglevel:
-            samba.set_debug_level(self._debuglevel)
-        return lp
+            self._lp.load_default()
+        return self._lp
 
     def get_hostconfig(self):
         return Hostconfig(self.get_loadparm())
diff --git a/source4/setup/provision b/source4/setup/provision
index 117433d..78965c6 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -52,7 +52,6 @@ parser.add_option_group(credopts)
 parser.add_option("--interactive", help="Ask for names", action="store_true")
 parser.add_option("--setupdir", type="string", metavar="DIR", 
 		help="directory with setup files")
-parser.add_option("--realm", type="string", metavar="REALM", help="set realm")
 parser.add_option("--domain", type="string", metavar="DOMAIN",
 				  help="set domain")
 parser.add_option("--domain-guid", type="string", metavar="GUID", 
@@ -165,6 +164,8 @@ if opts.interactive:
 		else:
 			break
 else:
+	if opts.realm in (None, ""):
+		opts.realm = sambaopts._lp.get('realm')
 	if opts.realm is None or opts.domain is None:
 		if opts.realm is None:
 			print >>sys.stderr, "No realm set!"
diff --git a/source4/setup/upgrade_from_s3 b/source4/setup/upgrade_from_s3
index 7f31a0f..adae016 100755
--- a/source4/setup/upgrade_from_s3
+++ b/source4/setup/upgrade_from_s3
@@ -37,7 +37,6 @@ credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
 parser.add_option("--setupdir", type="string", metavar="DIR",
                   help="directory with setup files")
-parser.add_option("--realm", type="string", metavar="REALM", help="set realm")
 parser.add_option("--quiet", help="Be quiet")
 parser.add_option("--blank",
                   help="do not add users or groups, just the structure")
diff --git a/source4/torture/drs/unit/schemainfo_tests.c b/source4/torture/drs/unit/schemainfo_tests.c
index c3bb56f..26e92d5 100644
--- a/source4/torture/drs/unit/schemainfo_tests.c
+++ b/source4/torture/drs/unit/schemainfo_tests.c
@@ -79,6 +79,10 @@ static const struct {
 		.werr_expected = WERR_OK,
 		.test_both_ways = true
 	},
+#if 0
+	/* removed until kamen can take a look - revision 0 is sent by
+	 * w2k8r2, and we need to accept it, possibly only when the
+	 * other fields are zero */
 	{ /* revision > 0 */
 		.schema_info_str = "FF00000000FD821C07C7455143A3DB51F75A630A7F",
 		.revision = 0,
@@ -86,6 +90,7 @@ static const struct {
 		.werr_expected = WERR_INVALID_PARAMETER,
 		.test_both_ways = true
 	},
+#endif
 	{ /* len == 21 */
 		.schema_info_str = "FF00000001FD821C07C7455143A3DB51F75A630A7F00",
 		.revision = 1,
diff --git a/source4/wscript_build b/source4/wscript_build
index ff83f93..00c3e73 100644
--- a/source4/wscript_build
+++ b/source4/wscript_build
@@ -118,4 +118,4 @@ bld.RECURSE('../pidl')
 bld.RECURSE('../lib')
 
 # install some extra empty directories
-bld.INSTALL_DIRS("", "${LOCKDIR} ${SYSCONFDIR} ${LOCKDIR} ${PIDDIR} ${LOCALSTATEDIR}/lib")
+bld.INSTALL_DIRS("", "${LOCKDIR} ${SYSCONFDIR} ${LOCKDIR} ${PIDDIR} ${LOCALSTATEDIR}/lib ${PRIVATEDIR}/smbd.tmp/messaging")


-- 
Samba Shared Repository


More information about the samba-cvs mailing list