summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-09-24 15:06:11 -0700
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-10-02 12:45:07 +0200
commit984ea88156767776dc2ab0b7da84c9701c34f345 (patch)
tree5e5e4074058a9c3ff3d28bed27daf46f81b3319f /source4
parent1c71c096459da85b1e5276d8c315b05e7bc870fa (diff)
downloadsamba-984ea88156767776dc2ab0b7da84c9701c34f345.tar.gz
samba-984ea88156767776dc2ab0b7da84c9701c34f345.tar.bz2
samba-984ea88156767776dc2ab0b7da84c9701c34f345.zip
s4:dsdb rework instanceType module - put instanceType in provision
The instanceType needs to be specified in future because that's how the partitions are actually created.
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/instancetype.c38
-rw-r--r--source4/scripting/python/samba/provision.py9
-rw-r--r--source4/setup/provision_basedn.ldif1
-rw-r--r--source4/setup/provision_configuration_basedn.ldif1
-rw-r--r--source4/setup/provision_schema_basedn.ldif1
5 files changed, 17 insertions, 33 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
index de46c0a42a..201ed04412 100644
--- a/source4/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -77,8 +77,6 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
struct it_context *ac;
uint32_t instance_type;
int ret;
- const struct ldb_control *partition_ctrl;
- const struct dsdb_control_current_partition *partition;
ldb = ldb_module_get_ctx(module);
@@ -90,31 +88,19 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
}
if (ldb_msg_find_element(req->op.add.message, "instanceType")) {
+ unsigned int instanceType = ldb_msg_find_attr_as_uint(req->op.add.message, "instanceType", 0);
+
+ if (instanceType & INSTANCE_TYPE_IS_NC_HEAD) {
+ /* Do something in future */
+ }
+
/* TODO: we need to validate and possibly create a new
partition */
return ldb_next_request(module, req);
}
- partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
- if (!partition_ctrl) {
- ldb_debug_set(ldb, LDB_DEBUG_FATAL,
- "instancetype_add: no current partition control found");
- return LDB_ERR_CONSTRAINT_VIOLATION;
- }
-
- partition = talloc_get_type(partition_ctrl->data,
- struct dsdb_control_current_partition);
- SMB_ASSERT(partition && partition->version == DSDB_CONTROL_CURRENT_PARTITION_VERSION);
-
- ac = talloc(req, struct it_context);
- if (ac == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
- }
- ac->module = module;
- ac->req = req;
-
/* we have to copy the message as the caller might have it as a const */
- msg = ldb_msg_copy_shallow(ac, req->op.add.message);
+ msg = ldb_msg_copy_shallow(req, req->op.add.message);
if (msg == NULL) {
ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
@@ -124,12 +110,6 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
* TODO: calculate correct instance type
*/
instance_type = INSTANCE_TYPE_WRITE;
- if (ldb_dn_compare(partition->dn, msg->dn) == 0) {
- instance_type |= INSTANCE_TYPE_IS_NC_HEAD;
- if (ldb_dn_compare(msg->dn, samdb_base_dn(ldb)) != 0) {
- instance_type |= INSTANCE_TYPE_NC_ABOVE;
- }
- }
ret = ldb_msg_add_fmt(msg, "instanceType", "%u", instance_type);
if (ret != LDB_SUCCESS) {
@@ -137,10 +117,10 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_build_add_req(&down_req, ldb, ac,
+ ret = ldb_build_add_req(&down_req, ldb, req,
msg,
req->controls,
- ac, it_callback,
+ req->context, req->callback,
req);
if (ret != LDB_SUCCESS) {
return ret;
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index e830870bb0..986a40a03b 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -631,7 +631,8 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
"samldb",
"password_hash",
"operational",
- "kludge_acl"]
+ "kludge_acl",
+ "instancetype"]
tdb_modules_list = [
"subtree_rename",
"subtree_delete",
@@ -679,9 +680,9 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
"CONFIGDN_LDB": configdn_ldb,
"DOMAINDN": names.domaindn,
"DOMAINDN_LDB": domaindn_ldb,
- "SCHEMADN_MOD": "schema_fsmo,instancetype",
- "CONFIGDN_MOD": "naming_fsmo,instancetype",
- "DOMAINDN_MOD": "pdc_fsmo,instancetype",
+ "SCHEMADN_MOD": "schema_fsmo",
+ "CONFIGDN_MOD": "naming_fsmo",
+ "DOMAINDN_MOD": "pdc_fsmo",
"MODULES_LIST": ",".join(modules_list),
"TDB_MODULES_LIST": tdb_modules_list_as_string,
"MODULES_LIST2": ",".join(modules_list2),
diff --git a/source4/setup/provision_basedn.ldif b/source4/setup/provision_basedn.ldif
index 0d81df3453..0a5f618e84 100644
--- a/source4/setup/provision_basedn.ldif
+++ b/source4/setup/provision_basedn.ldif
@@ -4,4 +4,5 @@
dn: ${DOMAINDN}
objectClass: top
objectClass: ${DOMAIN_OC}
+instanceType: 5
${DOMAINGUID}
diff --git a/source4/setup/provision_configuration_basedn.ldif b/source4/setup/provision_configuration_basedn.ldif
index b385359a61..14a2c33258 100644
--- a/source4/setup/provision_configuration_basedn.ldif
+++ b/source4/setup/provision_configuration_basedn.ldif
@@ -6,3 +6,4 @@ objectClass: top
objectClass: configuration
cn: Configuration
nTSecurityDescriptor:: ${DESCRIPTOR}
+instanceType: 13
diff --git a/source4/setup/provision_schema_basedn.ldif b/source4/setup/provision_schema_basedn.ldif
index 5301a11965..6fe0b0ea93 100644
--- a/source4/setup/provision_schema_basedn.ldif
+++ b/source4/setup/provision_schema_basedn.ldif
@@ -6,3 +6,4 @@ objectClass: top
objectClass: dMD
cn: Schema
nTSecurityDescriptor:: ${DESCRIPTOR}
+instanceType: 13