[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Mon Nov 23 18:16:50 MST 2009


The branch, master has been updated
       via  4f64bc7... heimdal Fix invalid format string
       via  4062d2b... s4:dsdb Handle LDAP backends correctly with new samba_dsdb system
       via  fdb5914... s4:provision Move exceptions into a new file
       via  5ea6f79... s4:provision Don't bother with a template for the LDAP backend startup script.
       via  625856f... s4:provision Move secrets.ldb over to .c file module lists, like sam.ldb
       via  9aeaf31... s4:ldap.py - activate test for operational attributes
       via  dcee196... s4:operational LDB module - Prevent the modification of operational attributes
       via  cec473e... s4:ldap.py Add tests for subSchemaSubEntry
       via  cfad782... s4:dsdb Use new helper function to obtain CN=Aggregate schema DN in schema_data
       via  e0b1edf... s4:dsdb Return the subSchemaSubEntry operational attribute on every object
       via  7b2bd93... s4:dsdb Add function to return the CN=Aggregate schema DN
       via  90d7399... s4:provision Remove 'operational' from secrets.ldb module list
      from  f8bd055... Proper fix for #6898 - Samba duplicates file content on appending. Pointed out by Volker.Restores the pathname handling for FILE_FLAG_POSIX_SEMANTICS but still prevents the O_APPEND problems. Jeremy.

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


- Log -----------------------------------------------------------------
commit 4f64bc7125014af4871c753c9321e219ee7b4ae9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 11:38:41 2009 +1100

    heimdal Fix invalid format string

commit 4062d2b3763c65c81bccf74cd2899d8c156ae99d
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 11:36:34 2009 +1100

    s4:dsdb Handle LDAP backends correctly with new samba_dsdb system
    
    The original code had the wrong module names, and use strcasecmp()
    incorrectly.
    
    Andrew Bartlett

commit fdb5914b278f19dea20ca9a7ae5e8b9557f5c70b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 11:09:30 2009 +1100

    s4:provision Move exceptions into a new file
    
    This allows provisionbackend and provision to both raise ProvisionException

commit 5ea6f7977506b2d8da02b4bcd083cc04f267ee4f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 11:00:12 2009 +1100

    s4:provision Don't bother with a template for the LDAP backend startup script.

commit 625856f2cf784f5ba39929567796d3225e1c6c3f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:36:28 2009 +1100

    s4:provision Move secrets.ldb over to .c file module lists, like sam.ldb

commit 9aeaf31cfe338b0e7f5b7fe243190f38ce09d9ac
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Nov 22 14:59:21 2009 +0100

    s4:ldap.py - activate test for operational attributes
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit dcee196f3e5d5673282aaa19fbbb7696d2c1aa0a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:22:10 2009 +1100

    s4:operational LDB module - Prevent the modification of operational attributes
    
    (merged by Andrew Bartlett)
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit cec473e72826af09fdf84eee2731ad0c2b193dfc
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:18:33 2009 +1100

    s4:ldap.py Add tests for subSchemaSubEntry

commit cfad782c9e422f11d6faa5a7e2b1b94400fe04bc
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:18:02 2009 +1100

    s4:dsdb Use new helper function to obtain CN=Aggregate schema DN in schema_data

commit e0b1edf013fec7682903d7190bc221b6f24626c3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:17:18 2009 +1100

    s4:dsdb Return the subSchemaSubEntry operational attribute on every object

commit 7b2bd93635637015eb0bd853c767ac0785e02854
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:16:56 2009 +1100

    s4:dsdb Add function to return the CN=Aggregate schema DN

commit 90d739990a5e17d1f2a7246287b6220534d9aae0
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Nov 24 10:15:28 2009 +1100

    s4:provision Remove 'operational' from secrets.ldb module list

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

Summary of changes:
 source4/dsdb/common/util.c                         |   18 ++++
 source4/dsdb/samdb/ldb_modules/config.mk           |   11 ++
 source4/dsdb/samdb/ldb_modules/operational.c       |   60 +++++++++++-
 source4/dsdb/samdb/ldb_modules/samba_dsdb.c        |   10 +-
 source4/dsdb/samdb/ldb_modules/samba_secrets.c     |  100 ++++++++++++++++++++
 source4/dsdb/samdb/ldb_modules/schema_data.c       |   12 +-
 source4/heimdal/kdc/krb5tgs.c                      |    2 +-
 source4/lib/ldb/tests/python/ldap.py               |   28 ++++--
 source4/scripting/python/samba/provision.py        |   10 +--
 source4/scripting/python/samba/provisionbackend.py |    4 +-
 .../scripting/python/samba/provisionexceptions.py  |   34 +++++++
 source4/setup/ldap_backend_startup.sh              |    2 -
 source4/setup/secrets_init.ldif                    |    2 +-
 13 files changed, 255 insertions(+), 38 deletions(-)
 create mode 100644 source4/dsdb/samdb/ldb_modules/samba_secrets.c
 create mode 100644 source4/scripting/python/samba/provisionexceptions.py
 delete mode 100644 source4/setup/ldap_backend_startup.sh


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index e587545..feebab8 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1027,6 +1027,24 @@ struct ldb_dn *samdb_schema_dn(struct ldb_context *sam_ctx)
 	return ldb_get_schema_basedn(sam_ctx);
 }
 
+struct ldb_dn *samdb_aggregate_schema_dn(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx) 
+{
+	struct ldb_dn *schema_dn = ldb_get_schema_basedn(sam_ctx);
+	struct ldb_dn *aggregate_dn;
+	if (!schema_dn) {
+		return NULL;
+	}
+
+	aggregate_dn = ldb_dn_copy(mem_ctx, schema_dn);
+	if (!aggregate_dn) {
+		return NULL;
+	}
+	if (!ldb_dn_add_child_fmt(aggregate_dn, "CN=Aggregate")) {
+		return NULL;
+	}
+	return aggregate_dn;
+}
+
 struct ldb_dn *samdb_root_dn(struct ldb_context *sam_ctx) 
 {
 	return ldb_get_root_basedn(sam_ctx);
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index 1849c69..3bd3860 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -20,6 +20,17 @@ INIT_FUNCTION = LDB_MODULE(samba_dsdb)
 ldb_samba_dsdb_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/samba_dsdb.o
 
 ################################################
+# Start MODULE ldb_samba_secrets
+[MODULE::ldb_samba_secrets]
+SUBSYSTEM = LIBLDB
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS LIBNDR
+INIT_FUNCTION = LDB_MODULE(samba_secrets)
+# End MODULE ldb_samba_secrets
+################################################
+
+ldb_samba_secrets_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/samba_secrets.o
+
+################################################
 # Start MODULE ldb_objectguid
 [MODULE::ldb_objectguid]
 SUBSYSTEM = LIBLDB
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c
index 9ec6d8b..46d4745 100644
--- a/source4/dsdb/samdb/ldb_modules/operational.c
+++ b/source4/dsdb/samdb/ldb_modules/operational.c
@@ -75,6 +75,10 @@
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
 #endif
 
+struct operational_data {
+	struct ldb_dn *aggregate_dn;
+};
+
 /*
   construct a canonical name from a message
 */
@@ -139,6 +143,21 @@ static int construct_parent_guid(struct ldb_module *module,
 
 }
 
+/*
+  construct a subSchemaSubEntry
+*/
+static int construct_subschema_subentry(struct ldb_module *module,
+					struct ldb_message *msg)
+{
+	struct operational_data *data = talloc_get_type(ldb_module_get_private(module), struct operational_data);
+	char *subSchemaSubEntry;
+	if (data && data->aggregate_dn) {
+		subSchemaSubEntry = ldb_dn_alloc_linearized(msg, data->aggregate_dn);
+		return ldb_msg_add_steal_string(msg, "subSchemaSubEntry", subSchemaSubEntry);
+	}
+	return LDB_SUCCESS;
+}
+
 
 /*
   a list of attribute names that should be substituted in the parse
@@ -167,7 +186,8 @@ static const struct {
 	{ "structuralObjectClass", "objectClass", NULL },
 	{ "canonicalName", "distinguishedName", construct_canonical_name },
 	{ "primaryGroupToken", "objectSid", construct_primary_group_token },
-	{ "parentGUID", NULL, construct_parent_guid }
+	{ "parentGUID", NULL, construct_parent_guid },
+	{ "subSchemaSubEntry", NULL, construct_subschema_subentry }
 };
 
 
@@ -389,17 +409,49 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req
 
 static int operational_init(struct ldb_module *ctx)
 {
-	int ret = 0;
+	struct operational_data *data;
+	struct ldb_context *ldb = ldb_module_get_ctx(ctx);
+	int ret = ldb_next_init(ctx);
 
-	if (ret != 0) {
+	if (ret != LDB_SUCCESS) {
 		return ret;
 	}
 
-	return ldb_next_init(ctx);
+	data = talloc(ctx, struct operational_data);
+	if (!data) {
+		ldb_module_oom(ctx);
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+
+	data->aggregate_dn = samdb_aggregate_schema_dn(ldb, data);
+	if (!data->aggregate_dn) {
+		ldb_set_errstring(ldb, "Could not build aggregate schema DN");
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+
+	ldb_module_set_private(ctx, data);
+
+	return LDB_SUCCESS;
+}
+
+static int operational_modify(struct ldb_module *module, struct ldb_request *req)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(search_sub); i++) {
+		if (ldb_msg_find_element(req->op.mod.message, search_sub[i].attr) != NULL) {
+			/* operational attributes cannot be changed! */
+			return LDB_ERR_CONSTRAINT_VIOLATION;
+		}
+	}
+
+	/* No operational attribute will be changed -> go on */
+	return ldb_next_request(module, req);
 }
 
 const struct ldb_module_ops ldb_operational_module_ops = {
 	.name              = "operational",
 	.search            = operational_search,
+	.modify            = operational_modify,
 	.init_context	   = operational_init
 };
diff --git a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
index bb3f8af..d561780 100644
--- a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
+++ b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
@@ -199,8 +199,8 @@ static int samba_dsdb_init(struct ldb_module *module)
 
 	const char *extended_dn_module;
 	const char *extended_dn_module_ldb = "extended_dn_out_ldb";
-	const char *extended_dn_module_fds = "extended_dn_out_ldb";
-	const char *extended_dn_module_openldap = "extended_dn_out_ldb";
+	const char *extended_dn_module_fds = "extended_dn_out_fds";
+	const char *extended_dn_module_openldap = "extended_dn_out_openldap";
 
 	static const char *modules_list2[] = {"show_deleted",
 					      "new_partition",
@@ -211,7 +211,7 @@ static int samba_dsdb_init(struct ldb_module *module)
 	static const char *fedora_ds_backend_modules[] = {
 		"nsuniqueid", "paged_searches", NULL };
 	static const char *openldap_backend_modules[] = {
-		"nsuniqueid", "paged_searches", NULL };
+		"entryuuid", "paged_searches", NULL };
 
 	static const char *samba_dsdb_attrs[] = { "backendType", "serverRole", NULL };
 	const char *backendType, *serverRole;
@@ -257,10 +257,10 @@ static int samba_dsdb_init(struct ldb_module *module)
 	} else {
 		objectguid_module = NULL;
 		link_modules = NULL;
-		if (strcasecmp(backendType, "fedora-ds")) {
+		if (strcasecmp(backendType, "fedora-ds") == 0) {
 			backend_modules = fedora_ds_backend_modules;
 			extended_dn_module = extended_dn_module_fds;
-		} else if (strcasecmp(backendType, "openldap")) {
+		} else if (strcasecmp(backendType, "openldap") == 0) {
 			backend_modules = openldap_backend_modules;
 			extended_dn_module = extended_dn_module_openldap;
 		}
diff --git a/source4/dsdb/samdb/ldb_modules/samba_secrets.c b/source4/dsdb/samdb/ldb_modules/samba_secrets.c
new file mode 100644
index 0000000..1045bb9
--- /dev/null
+++ b/source4/dsdb/samdb/ldb_modules/samba_secrets.c
@@ -0,0 +1,100 @@
+/* 
+   Samba4 module loading module (for secrets)
+
+   Copyright (C) Andrew Bartlett <abartlet at samba.org> 2009
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ *  Name: ldb
+ *
+ *  Component: Samba4 module loading module (for secrets.ldb)
+ *
+ *  Description: Implement a single 'module' in the secrets.ldb database
+ *
+ *  This is to avoid forcing a reprovision of the ldb databases when we change the internal structure of the code
+ *
+ *  Author: Andrew Bartlett
+ */
+
+#include "includes.h"
+#include "lib/ldb/include/ldb.h"
+#include "lib/ldb/include/ldb_errors.h"
+#include "lib/ldb/include/ldb_module.h"
+#include "lib/ldb/include/ldb_private.h"
+
+#include "dsdb/samdb/ldb_modules/util.h"
+#include "dsdb/samdb/samdb.h"
+
+
+static int samba_secrets_init(struct ldb_module *module)
+{
+	struct ldb_context *ldb = ldb_module_get_ctx(module);
+	int ret, len, i;
+	TALLOC_CTX *tmp_ctx = talloc_new(module);
+	struct ldb_module *backend_module, *module_chain;
+	const char **reverse_module_list;
+	/*
+	  Add modules to the list to activate them by default
+	  beware often order is important
+	  
+	  The list is presented here as a set of declarations to show the
+	  stack visually
+	*/
+	static const char *modules_list[] = {"update_keytab",
+					     "objectguid",
+					     "rdn_name",
+					     NULL };
+
+	if (!tmp_ctx) {
+		ldb_oom(ldb);
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+
+	/* Now prepare the module chain.  Oddly, we must give it to ldb_load_modules_list in REVERSE */
+	for (len = 0; modules_list[len]; len++) { /* noop */};
+
+	reverse_module_list = talloc_array(tmp_ctx, const char *, len+1);
+	if (!reverse_module_list) {
+		talloc_free(tmp_ctx);
+		ldb_oom(ldb);
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+	for (i=0; i < len; i++) {
+		reverse_module_list[i] = modules_list[(len - 1) - i];
+	}
+	reverse_module_list[i] = NULL;
+
+	/* The backend (at least until the partitions module
+	 * reconfigures things) is the next module in the currently
+	 * loaded chain */
+	backend_module = module->next;
+	ret = ldb_load_modules_list(ldb, reverse_module_list, backend_module, &module_chain);
+	if (ret != LDB_SUCCESS) {
+		talloc_free(tmp_ctx);
+		return ret;
+	}
+
+	talloc_free(tmp_ctx);
+	/* Set this as the 'next' module, so that we effectivly append it to module chain */
+	module->next = module_chain;
+
+	return ldb_next_init(module);
+}
+
+const struct ldb_module_ops ldb_samba_secrets_module_ops = {
+	.name		   = "samba_secrets",
+	.init_context	   = samba_secrets_init,
+};
diff --git a/source4/dsdb/samdb/ldb_modules/schema_data.c b/source4/dsdb/samdb/ldb_modules/schema_data.c
index 9951bd6..ed10ae6 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_data.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_data.c
@@ -119,15 +119,15 @@ static int schema_data_init(struct ldb_module *module)
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
-	/* Check to see if this is a result on the CN=Aggregate schema */
-	data->aggregate_dn = ldb_dn_copy(data, schema_dn);
-	if (!ldb_dn_add_child_fmt(data->aggregate_dn, "CN=Aggregate")) {
-		ldb_oom(ldb);
+	data->schema_dn = schema_dn;
+
+	/* Used to check to see if this is a result on the CN=Aggregate schema */
+	data->aggregate_dn = samdb_aggregate_schema_dn(ldb, data);
+	if (!data->aggregate_dn) {
+		ldb_set_errstring(ldb, "Could not build aggregate schema DN");
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
-	data->schema_dn = schema_dn;
-
 	ldb_module_set_private(module, data);
 	return LDB_SUCCESS;
 }
diff --git a/source4/heimdal/kdc/krb5tgs.c b/source4/heimdal/kdc/krb5tgs.c
index 4f587cf..312be6e 100644
--- a/source4/heimdal/kdc/krb5tgs.c
+++ b/source4/heimdal/kdc/krb5tgs.c
@@ -1138,7 +1138,7 @@ tgs_parse_request(krb5_context context,
 	    p = "<unparse_name failed>";
 	krb5_free_principal(context, princ);
 	kdc_log(context, config, 0,
-		"Ticket-granting ticket not found in database: %s: %s", msg);
+		"Ticket-granting ticket not found in database: %s", msg);
 	krb5_free_error_message(context, msg);
 	if (ret == 0)
 	    free(p);
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 94bdf7e..009cd1b 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -790,14 +790,14 @@ objectClass: container
 	rid = dom_sid_to_rid(ldb.schema_format_value("objectSID", res1[0]["objectSID"][0]))
         self.assertEquals(primary_group_token, rid)
 
-# TODO Has to wait until we support read-only generated attributes correctly
-#        m = Message()
-#        m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
-#        m["primaryGroupToken"] = "100"
-#        try:
-#                ldb.modify(m)
-#                self.fail()
-#        except LdbError, (num, msg):
+        m = Message()
+        m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
+        m["primaryGroupToken"] = "100"
+        try:
+            ldb.modify(m)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
 
         self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
         self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
@@ -819,6 +819,18 @@ objectClass: container
         res2 = self.ldb.search(scope=SCOPE_BASE, attrs=["wellKnownObjects"], expression=("wellKnownObjects=%s") % res[0].dn)
         self.assertEquals(len(res2), 0)
 
+    def test_subschemasubentry(self):
+        """Test subSchemaSubEntry appears when requested, but not when not requested"""
+        print "Test subSchemaSubEntry"""
+
+        res = self.ldb.search(base=self.base_dn, scope=SCOPE_BASE, attrs=["subSchemaSubEntry"])
+        self.assertEquals(len(res), 1)
+        self.assertEquals(res[0]["subSchemaSubEntry"][0], "CN=Aggregate,"+self.schema_dn)
+
+        res = self.ldb.search(base=self.base_dn, scope=SCOPE_BASE, attrs=["*"])
+        self.assertEquals(len(res), 1)
+        self.assertTrue("subScheamSubEntry" not in res[0])
+
     def test_all(self):
         """Basic tests"""
 
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index b5e8867..01ffc16 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -53,6 +53,7 @@ from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError
 from ms_display_specifiers import read_ms_ldif
 from schema import Schema
 from provisionbackend import LDBBackend, ExistingBackend, FDSBackend, OpenLDAPBackend
+from provisionexceptions import ProvisioningError, InvalidNetbiosName
 from signal import SIGTERM
 from dcerpc.misc import SEC_CHAN_BDC, SEC_CHAN_WKSTA
 
@@ -153,15 +154,6 @@ DEFAULTSITE = "Default-First-Site-Name"
 
 # Exception classes
 
-class ProvisioningError(Exception):
-    """A generic provision error."""
-
-class InvalidNetbiosName(Exception):
-    """A specified name was not a valid NetBIOS name."""
-    def __init__(self, name):
-        super(InvalidNetbiosName, self).__init__("The name '%r' is not a valid NetBIOS name" % name)
-
-
 class ProvisionPaths(object):
     def __init__(self):
         self.shareconf = None
diff --git a/source4/scripting/python/samba/provisionbackend.py b/source4/scripting/python/samba/provisionbackend.py
index 595c1be..ae58a16 100644
--- a/source4/scripting/python/samba/provisionbackend.py
+++ b/source4/scripting/python/samba/provisionbackend.py
@@ -41,6 +41,7 @@ from ldb import SCOPE_BASE, SCOPE_ONELEVEL, LdbError, timestring
 from credentials import Credentials, DONT_USE_KERBEROS
 from samba import setup_file
 from schema import Schema
+from provisionexceptions import ProvisioningError
 
 def setup_db_config(setup_path, dbdir):
     """Setup a Berkeley database.
@@ -226,8 +227,7 @@ class LDAPBackend(ProvisionBackend):
 
     def start(self):
         self.slapd_command_escaped = "\'" + "\' \'".join(self.slapd_command) + "\'"
-        setup_file(self.setup_path("ldap_backend_startup.sh"), self.paths.ldapdir + "/ldap_backend_startup.sh", {
-                "SLAPD_COMMAND" : self.slapd_command_escaped})
+        open(self.paths.ldapdir + "/ldap_backend_startup.sh", 'w').write("#!/bin/sh\n" + self.slapd_command_escaped + "\n")
 
         # Now start the slapd, so we can provision onto it.  We keep the
         # subprocess context around, to kill this off at the successful
diff --git a/source4/scripting/python/samba/provisionexceptions.py b/source4/scripting/python/samba/provisionexceptions.py
new file mode 100644
index 0000000..604853f
--- /dev/null
+++ b/source4/scripting/python/samba/provisionexceptions.py
@@ -0,0 +1,34 @@
+#
+# Unix SMB/CIFS implementation.
+# backend code for provisioning a Samba4 server
+
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007-2008
+# Copyright (C) Andrew Bartlett <abartlet at samba.org> 2008-2009
+# Copyright (C) Oliver Liebel <oliver at itc.li> 2008-2009
+#
+# Based on the original in EJS:
+# Copyright (C) Andrew Tridgell <tridge at samba.org> 2005
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#   
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#   
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+class ProvisioningError(Exception):
+    """A generic provision error."""
+
+class InvalidNetbiosName(Exception):
+    """A specified name was not a valid NetBIOS name."""
+    def __init__(self, name):
+        super(InvalidNetbiosName, self).__init__("The name '%r' is not a valid NetBIOS name" % name)
+
+
diff --git a/source4/setup/ldap_backend_startup.sh b/source4/setup/ldap_backend_startup.sh
deleted file mode 100644
index 4a7c765..0000000
--- a/source4/setup/ldap_backend_startup.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-${SLAPD_COMMAND}
diff --git a/source4/setup/secrets_init.ldif b/source4/setup/secrets_init.ldif
index 00a25a3..3044d3e 100644
--- a/source4/setup/secrets_init.ldif
+++ b/source4/setup/secrets_init.ldif
@@ -12,5 +12,5 @@ sAMAccountName: CASE_INSENSITIVE
 #Add modules to the list to activate them by default
 #beware often order is important
 dn: @MODULES
- at LIST: update_keytab,operational,objectguid,rdn_name
+ at LIST: samba_secrets
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list