[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Thu Mar 10 03:59:02 MST 2011
The branch, master has been updated
via 22fcb8e s4:lib/tls/wscript - exclude known broken GNUTLS releases
via f5ce61e lib/util/fault.c - "call_backtrace" - no need to have "backtrace_size" as size_t
via e00893d s4:extended_dn_store LDB module - use the new request as generic memory contexts
via 0cec610 s4:repl_meta_data LDB module - always ask manually for the current partition control
via 68fbfa2 s4:partition LDB module - the current partition control should only be added if requested
via 78b46c5 s4:partition LDB module - extended operations - make the initialisation check consistent
via e52c900 s4:partition LDB module - move the "data" check a bit higher
via 4e6b8e0 s4:partition LDB module - "partition_replicate" doesn't handle the search requests
via 210cab9 s4:partition LDB module - "partition_sequence_number" - remove meaningless "if"s
via 96600e5 s4:simple_ldap_map LDB module - enhance current partition control checks
via e669295 s4:repl_meta_data LDB module - don't remove the partition control twice
via e754f0c s4:repl_meta_data LDB module - remove the current partition control unless it was requested
via 42da193 s4:new_partition LDB module - splitting up an "if" operation
via 83517d2 s4:instancetype LDB module - perform here only the "instanceType" constraint checks
via 8ce1314 s4:instancetype LDB module - don't impede control requests
via f68d542 s4:instancetype LDB module - use "ldb" pointer for referencing the LDB context
via 8872a62 s4:partition LDB module - fill in parent requests for inheriting the flags
via b7ecc33 ldb:ldb_controls.c - "ldb_save_controls" - allow that "saver" can also be NULL
via 78c9eb1 ldb:ldb_controls.c - always allocate enough space
via 851396a s4:partition LDB module - add some comments
via 79c65cc s4:new_partition LDB module - fix comments
via d2acd72 s4:partition_init LDB module - fix a typo
via 82067b1 s4:partition LDB module - fix typo
via 7aa0219 s4:setup/provision - fix an output message
from cdb9e4b libwbclient: Add some input check
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 22fcb8e4945ac43fda6f6891ea00f36a53e52102
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Wed Mar 9 09:29:30 2011 +0100
s4:lib/tls/wscript - exclude known broken GNUTLS releases
This definitely fixes bug #7218.
Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
Autobuild-Date: Thu Mar 10 11:58:27 CET 2011 on sn-devel-104
commit f5ce61ea57e4851999eb0a2a805a5e2aab5b86e4
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Wed Mar 9 09:09:15 2011 +0100
lib/util/fault.c - "call_backtrace" - no need to have "backtrace_size" as size_t
The function "backtrace" returns an "int".
commit e00893d8395ed813a5bc9dd7bf28f29de369db46
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 21:46:02 2011 +0100
s4:extended_dn_store LDB module - use the new request as generic memory contexts
To prevent memory leaks under valgrind.
commit 0cec6107d870ba2e67859b824306cde0686691cb
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 14:42:40 2011 +0100
s4:repl_meta_data LDB module - always ask manually for the current partition control
Otherwise the "partition" LDB module doesn't give it back anymore.
commit 68fbfa2237a570a48d2ae3a5421cdcacae6e6d34
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 14:25:59 2011 +0100
s4:partition LDB module - the current partition control should only be added if requested
That means if the informations before a request are unknown
("repl_meta_data" LDB module) then an empty control (no data) has to be sent.
commit 78b46c533a36cdfa6c5f8ab305f13c5aa142b819
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 15:56:48 2011 +0100
s4:partition LDB module - extended operations - make the initialisation check consistent
To the other operations.
commit e52c900b63bf61daf64e5495241a257a40998a06
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 15:56:06 2011 +0100
s4:partition LDB module - move the "data" check a bit higher
It can be performed a bit earlier.
commit 4e6b8e0a181b2fa78fd72e7e2724ad5acd81672b
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 15:37:51 2011 +0100
s4:partition LDB module - "partition_replicate" doesn't handle the search requests
That is done by "partition_search".
commit 210cab9bf0a72b670d20ea16f1f483e41b5a503c
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 19:02:43 2011 +0100
s4:partition LDB module - "partition_sequence_number" - remove meaningless "if"s
These current partition controls are always added for the two EXOP operations.
commit 96600e5df185c5d3b774870c5339a8fcbf412ff5
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 14:52:18 2011 +0100
s4:simple_ldap_map LDB module - enhance current partition control checks
Don't stop the server if it hasn't been filled in correctly. An LDB
error should be enough.
Modified by request of tridge: errorcodes changed to ERR_PROTOCOL_ERROR
commit e669295a37b9900c58707bfd5bce55197655ed95
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 13:56:10 2011 +0100
s4:repl_meta_data LDB module - don't remove the partition control twice
"controls" is already the controls list which has the partition control
removed. It is generated by "ldb_controls_except_specified" in line 378.
commit e754f0c5c6add20f8f2217033205432597d133fd
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 20:38:14 2011 +0100
s4:repl_meta_data LDB module - remove the current partition control unless it was requested
commit 42da193c37e1f3076b1299e761bc973f290bb800
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 17:15:55 2011 +0100
s4:new_partition LDB module - splitting up an "if" operation
- let the first "if" in place
- uninstantiated partitions are handled by the second "if" (previously
they have been handled twice)
Has been corrected by request of tridge.
commit 83517d2e597878b86dc51edc6bb0bf25c7d62068
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 17:24:10 2011 +0100
s4:instancetype LDB module - perform here only the "instanceType" constraint checks
The boilerplate entries (when this support has been implemented) should
be provided by the "new_partition" LDB module. These are for example the
deleted object and lost and found container.
commit 8ce131431ca00882ade037430b31cbd3f9c0445e
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 17:28:13 2011 +0100
s4:instancetype LDB module - don't impede control requests
commit f68d54269cd087dc7f9168fe2711beddcb0ce94e
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 16:59:02 2011 +0100
s4:instancetype LDB module - use "ldb" pointer for referencing the LDB context
commit 8872a622667a9f2ff7a7213ae2ba82d93e3e14b2
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 18:45:08 2011 +0100
s4:partition LDB module - fill in parent requests for inheriting the flags
Probably it doesn't matter in this cases but just for consistency.
commit b7ecc33ef9eae1a1ebe503a2d1d8c8ed21fb7ccf
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Thu Mar 10 09:28:30 2011 +0100
ldb:ldb_controls.c - "ldb_save_controls" - allow that "saver" can also be NULL
Suggested by Tridge
commit 78c9eb1a06a696fc6ba85110a4f7d661bbb661d3
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 20:16:43 2011 +0100
ldb:ldb_controls.c - always allocate enough space
The size for an additional "struct ldb_control" shouldn't hurt and so
the excluded control can also be NULL.
Added an ending "talloc_realloc" to resize the chunk to the
effective needed size (requested by tridge).
commit 851396a627ed2c09c5e309fc72cfa2a10c3c3726
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 15:55:45 2011 +0100
s4:partition LDB module - add some comments
commit 79c65cc99b30af092608fa758a748ca0301ddf33
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 17:15:19 2011 +0100
s4:new_partition LDB module - fix comments
commit d2acd729942a2a04b4011072184a59b1a6cebf87
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 15:51:12 2011 +0100
s4:partition_init LDB module - fix a typo
commit 82067b1a61c164523e881c4244a2e96a59fa497e
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sat Mar 5 14:15:38 2011 +0100
s4:partition LDB module - fix typo
commit 7aa0219be8a0d4d5b8adccb4d855952182b145a4
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Sun Mar 6 17:46:08 2011 +0100
s4:setup/provision - fix an output message
Mention that Windows 2000 function level is supported as well.
-----------------------------------------------------------------------
Summary of changes:
lib/util/fault.c | 2 +-
source4/dsdb/samdb/ldb_modules/extended_dn_store.c | 4 +-
source4/dsdb/samdb/ldb_modules/instancetype.c | 101 +++++---------------
source4/dsdb/samdb/ldb_modules/new_partition.c | 12 +-
source4/dsdb/samdb/ldb_modules/partition.c | 82 +++++++++-------
source4/dsdb/samdb/ldb_modules/partition_init.c | 2 +-
source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 61 +++++++++++-
source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 10 ++-
source4/lib/ldb/common/ldb_controls.c | 54 +++++++----
source4/lib/tls/wscript | 4 +-
source4/setup/provision | 2 +-
11 files changed, 184 insertions(+), 150 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/fault.c b/lib/util/fault.c
index 256e55a..29b45ee 100644
--- a/lib/util/fault.c
+++ b/lib/util/fault.c
@@ -51,7 +51,7 @@ _PUBLIC_ void call_backtrace(void)
#define BACKTRACE_STACK_SIZE 64
#endif
void *backtrace_stack[BACKTRACE_STACK_SIZE];
- size_t backtrace_size;
+ int backtrace_size;
char **backtrace_strings;
/* get the backtrace (stack frames) */
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_store.c b/source4/dsdb/samdb/ldb_modules/extended_dn_store.c
index b4f71e9..c423520 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_store.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_store.c
@@ -345,7 +345,7 @@ static int extended_dn_add(struct ldb_module *module, struct ldb_request *req)
/* Re-calculate el */
el = &ac->new_req->op.add.message->elements[i];
for (j = 0; j < el->num_values; j++) {
- ret = extended_store_replace(ac, ac->new_req->op.add.message->elements, &el->values[j],
+ ret = extended_store_replace(ac, ac->new_req, &el->values[j],
false, schema_attr->syntax->ldap_oid);
if (ret != LDB_SUCCESS) {
return ret;
@@ -429,7 +429,7 @@ static int extended_dn_modify(struct ldb_module *module, struct ldb_request *req
* input of an extended DN */
bool is_delete = (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_DELETE);
- ret = extended_store_replace(ac, req->op.mod.message->elements, &el->values[j],
+ ret = extended_store_replace(ac, ac->new_req, &el->values[j],
is_delete, schema_attr->syntax->ldap_oid);
if (ret != LDB_SUCCESS) {
talloc_free(ac);
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
index c557fe1..e008deb 100644
--- a/source4/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -38,66 +38,23 @@
#include "../libds/common/flags.h"
#include "dsdb/samdb/ldb_modules/util.h"
-struct it_context {
- struct ldb_module *module;
- struct ldb_request *req;
- struct ldb_request *add_req;
-};
-
-static int it_add_callback(struct ldb_request *req, struct ldb_reply *ares)
-{
- struct ldb_context *ldb;
- struct it_context *ac;
-
- ac = talloc_get_type(req->context, struct it_context);
- ldb = ldb_module_get_ctx(ac->module);
-
- if (!ares) {
- return ldb_module_done(ac->req, NULL, NULL,
- LDB_ERR_OPERATIONS_ERROR);
- }
-
- if (ares->type == LDB_REPLY_REFERRAL) {
- return ldb_module_send_referral(ac->req, ares->referral);
- }
-
- if (ares->error != LDB_SUCCESS) {
- return ldb_module_done(ac->req, ares->controls,
- ares->response, ares->error);
- }
-
- if (ares->type != LDB_REPLY_DONE) {
- ldb_set_errstring(ldb, "Invalid reply type!");
- return ldb_module_done(ac->req, NULL, NULL,
- LDB_ERR_OPERATIONS_ERROR);
- }
-
- /* Add the boilerplate entries */
-
- return ldb_module_done(ac->req, ares->controls,
- ares->response, ares->error);
-}
-
/* add_record: add instancetype attribute */
static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
{
- struct ldb_context *ldb;
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
struct ldb_request *down_req;
struct ldb_message *msg;
struct ldb_message_element *el;
- struct it_context *ac;
uint32_t instanceType;
int ret;
- ldb = ldb_module_get_ctx(module);
-
- ldb_debug(ldb, LDB_DEBUG_TRACE, "instancetype_add_record\n");
-
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
return ldb_next_request(module, req);
}
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "instancetype_add\n");
+
el = ldb_msg_find_element(req->op.add.message, "instanceType");
if (el != NULL) {
if (el->num_values != 1) {
@@ -108,7 +65,8 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
instanceType = ldb_msg_find_attr_as_uint(req->op.add.message,
"instanceType", 0);
if (!(instanceType & INSTANCE_TYPE_IS_NC_HEAD)) {
- /* if we have no NC add operation (no TYPE_IS_NC_HEAD)
+ /*
+ * If we have no NC add operation (no TYPE_IS_NC_HEAD)
* then "instanceType" can only be "0" or "TYPE_WRITE".
*/
if ((instanceType != 0) &&
@@ -116,39 +74,19 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
ldb_set_errstring(ldb, "instancetype: if TYPE_IS_NC_HEAD wasn't set, then only TYPE_WRITE or 0 are allowed!");
return LDB_ERR_UNWILLING_TO_PERFORM;
}
-
- return ldb_next_request(module, req);
- }
-
- /* if we have a NC add operation then we need also the
- * "TYPE_WRITE" flag in order to succeed. */
- if (!(instanceType & INSTANCE_TYPE_WRITE)) {
- ldb_set_errstring(ldb, "instancetype: if TYPE_IS_NC_HEAD was set, then also TYPE_WRITE is requested!");
- return LDB_ERR_UNWILLING_TO_PERFORM;
+ } else {
+ /*
+ * If we have a NC add operation then we need also the
+ * "TYPE_WRITE" flag in order to succeed.
+ */
+ if (!(instanceType & INSTANCE_TYPE_WRITE)) {
+ ldb_set_errstring(ldb, "instancetype: if TYPE_IS_NC_HEAD was set, then also TYPE_WRITE is requested!");
+ return LDB_ERR_UNWILLING_TO_PERFORM;
+ }
}
- /* Forward the 'add' to the modules below, but if it
- * succeeds, then we might need to add the boilerplate
- * entries (lost+found, deleted objects) */
- ac = talloc(req, struct it_context);
- if (ac == NULL) {
- return ldb_oom(ldb);
- }
- ac->module = module;
- ac->req = req;
-
- ret = ldb_build_add_req(&ac->add_req, ldb_module_get_ctx(ac->module), ac,
- ac->req->op.add.message,
- ac->req->controls,
- ac, it_add_callback,
- ac->req);
- LDB_REQ_SET_LOCATION(ac->add_req);
- if (ret != LDB_SUCCESS) {
- return ret;
- }
-
- /* Do the original add */
- return ldb_next_request(ac->module, ac->add_req);
+ /* we did only tests, so proceed with the original request */
+ return ldb_next_request(module, req);
}
/* we have to copy the message as the caller might have it as a const */
@@ -187,6 +125,13 @@ static int instancetype_mod(struct ldb_module *module, struct ldb_request *req)
struct ldb_context *ldb = ldb_module_get_ctx(module);
struct ldb_message_element *el;
+ /* do not manipulate our control entries */
+ if (ldb_dn_is_special(req->op.mod.message->dn)) {
+ return ldb_next_request(module, req);
+ }
+
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "instancetype_mod\n");
+
el = ldb_msg_find_element(req->op.mod.message, "instanceType");
if (el != NULL) {
ldb_set_errstring(ldb, "instancetype: the 'instanceType' attribute can never be changed!");
diff --git a/source4/dsdb/samdb/ldb_modules/new_partition.c b/source4/dsdb/samdb/ldb_modules/new_partition.c
index 8eb3de8..3d94bbe 100644
--- a/source4/dsdb/samdb/ldb_modules/new_partition.c
+++ b/source4/dsdb/samdb/ldb_modules/new_partition.c
@@ -23,9 +23,9 @@
/*
* Name: ldb
*
- * Component: ldb instancetype module
+ * Component: ldb new partition module
*
- * Description: add an instanceType onto every new record
+ * Description: Handle the add of new partitions
*
* Author: Andrew Bartlett
*/
@@ -140,7 +140,7 @@ static int new_partition_add(struct ldb_module *module, struct ldb_request *req)
ldb = ldb_module_get_ctx(module);
- ldb_debug(ldb, LDB_DEBUG_TRACE, "instancetype_add_record\n");
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "new_partition_add\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
@@ -150,9 +150,9 @@ static int new_partition_add(struct ldb_module *module, struct ldb_request *req)
if (ldb_msg_find_element(req->op.add.message, "instanceType")) {
/* This needs to be 'static' to ensure it does not move, and is not on the stack */
static const char *no_attrs[] = { NULL };
- unsigned int instanceType = ldb_msg_find_attr_as_uint(req->op.add.message, "instanceType", 0);
- if (!(instanceType & INSTANCE_TYPE_IS_NC_HEAD) ||
- (instanceType & INSTANCE_TYPE_UNINSTANT)) {
+ uint32_t instanceType = ldb_msg_find_attr_as_uint(req->op.add.message, "instanceType", 0);
+
+ if (!(instanceType & INSTANCE_TYPE_IS_NC_HEAD)) {
return ldb_next_request(module, req);
}
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 613cfa3..ba77ca0 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -149,7 +149,7 @@ static int partition_req_callback(struct ldb_request *req,
if (partition_ctrl && (ac->num_requests == 1 || ares->type == LDB_REPLY_ENTRY)) {
/* If we didn't fan this request out to mulitple partitions,
* or this is an individual search result, we can
- * deterministily tell the caller what partition this was
+ * deterministically tell the caller what partition this was
* written to (repl_meta_data likes to know) */
ret = ldb_reply_add_control(ares,
DSDB_CONTROL_CURRENT_PARTITION_OID,
@@ -239,6 +239,7 @@ static int partition_prep_request(struct partition_context *ac,
{
int ret;
struct ldb_request *req;
+ struct ldb_control *partition_ctrl = NULL;
ac->part_req = talloc_realloc(ac, ac->part_req,
struct part_request,
@@ -316,20 +317,31 @@ static int partition_prep_request(struct partition_context *ac,
ac->part_req[ac->num_requests].req = req;
if (ac->req->controls) {
- req->controls = talloc_memdup(req, ac->req->controls,
- talloc_get_size(ac->req->controls));
- if (req->controls == NULL) {
- return ldb_oom(ldb_module_get_ctx(ac->module));
+ /* Duplicate everything beside the current partition control */
+ partition_ctrl = ldb_request_get_control(ac->req,
+ DSDB_CONTROL_CURRENT_PARTITION_OID);
+ if (!ldb_save_controls(partition_ctrl, req, NULL)) {
+ return ldb_module_oom(ac->module);
}
}
if (partition) {
+ void *part_data = partition->ctrl;
+
ac->part_req[ac->num_requests].module = partition->module;
- if (!ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID)) {
+ if (partition_ctrl != NULL) {
+ if (partition_ctrl->data != NULL) {
+ part_data = partition_ctrl->data;
+ }
+
+ /*
+ * If the provided current partition control is without
+ * data then use the calculated one.
+ */
ret = ldb_request_add_control(req,
DSDB_CONTROL_CURRENT_PARTITION_OID,
- false, partition->ctrl);
+ false, part_data);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -398,11 +410,13 @@ static int partition_replicate(struct ldb_module *module, struct ldb_request *re
struct dsdb_partition *partition;
struct partition_private_data *data = talloc_get_type(ldb_module_get_private(module),
struct partition_private_data);
+
+ /* if we aren't initialised yet go further */
if (!data || !data->partitions) {
return ldb_next_request(module, req);
}
- if (req->operation != LDB_SEARCH && ldb_dn_is_special(dn)) {
+ if (ldb_dn_is_special(dn)) {
/* Is this a special DN, we need to replicate to every backend? */
for (i=0; data->replicate && data->replicate[i]; i++) {
if (ldb_dn_compare(data->replicate[i],
@@ -468,7 +482,8 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
unsigned int i, j;
int ret;
bool domain_scope = false, phantom_root = false;
-
+
+ /* see if we are still up-to-date */
ret = partition_reload_if_required(module, data, req);
if (ret != LDB_SUCCESS) {
return ret;
@@ -497,6 +512,11 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
return ldb_oom(ldb_module_get_ctx(module));
}
+ /* if we aren't initialised yet go further */
+ if (!data || !data->partitions) {
+ return ldb_next_request(module, req);
+ }
+
/* Locate the options */
domain_scope = (search_options
&& (search_options->search_options & LDB_SEARCH_OPTION_DOMAIN_SCOPE))
@@ -511,10 +531,6 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
& ~LDB_SEARCH_OPTION_PHANTOM_ROOT;
}
- if (!data || !data->partitions) {
- return ldb_next_request(module, req);
- }
-
ac = partition_init_ctx(module, req);
if (!ac) {
return ldb_operr(ldb_module_get_ctx(module));
@@ -973,21 +989,19 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
NULL,
res,
ldb_extended_default_callback,
- NULL);
+ req);
LDB_REQ_SET_LOCATION(treq);
if (ret != LDB_SUCCESS) {
talloc_free(res);
return ret;
}
- if (!ldb_request_get_control(treq, DSDB_CONTROL_CURRENT_PARTITION_OID)) {
- ret = ldb_request_add_control(treq,
- DSDB_CONTROL_CURRENT_PARTITION_OID,
- false, data->partitions[i]->ctrl);
- if (ret != LDB_SUCCESS) {
- talloc_free(res);
- return ret;
- }
+ ret = ldb_request_add_control(treq,
+ DSDB_CONTROL_CURRENT_PARTITION_OID,
+ false, data->partitions[i]->ctrl);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(res);
+ return ret;
}
ret = partition_request(data->partitions[i]->module, treq);
@@ -1031,7 +1045,7 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
NULL,
res,
ldb_extended_default_callback,
- NULL);
+ req);
LDB_REQ_SET_LOCATION(treq);
if (ret != LDB_SUCCESS) {
talloc_free(res);
@@ -1076,21 +1090,19 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
NULL,
res,
ldb_extended_default_callback,
- NULL);
+ req);
LDB_REQ_SET_LOCATION(treq);
if (ret != LDB_SUCCESS) {
talloc_free(res);
return ret;
}
- if (!ldb_request_get_control(treq, DSDB_CONTROL_CURRENT_PARTITION_OID)) {
- ret = ldb_request_add_control(treq,
- DSDB_CONTROL_CURRENT_PARTITION_OID,
- false, data->partitions[i]->ctrl);
- if (ret != LDB_SUCCESS) {
- talloc_free(res);
- return ret;
- }
+ ret = ldb_request_add_control(treq,
+ DSDB_CONTROL_CURRENT_PARTITION_OID,
+ false, data->partitions[i]->ctrl);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(res);
+ return ret;
}
ret = partition_request(data->partitions[i]->module, treq);
@@ -1160,15 +1172,17 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
/* extended */
static int partition_extended(struct ldb_module *module, struct ldb_request *req)
{
- struct partition_private_data *data;
+ struct partition_private_data *data = talloc_get_type(ldb_module_get_private(module),
+ struct partition_private_data);
struct partition_context *ac;
int ret;
- data = talloc_get_type(ldb_module_get_private(module), struct partition_private_data);
+ /* if we aren't initialised yet go further */
if (!data) {
return ldb_next_request(module, req);
}
+ /* see if we are still up-to-date */
ret = partition_reload_if_required(module, data, req);
if (ret != LDB_SUCCESS) {
return ret;
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c
index 97fc670..50aabc9 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -386,7 +386,7 @@ int partition_reload_if_required(struct ldb_module *module,
TALLOC_CTX *mem_ctx;
if (!data) {
- /* Not initilised yet */
+ /* Not initialised yet */
return LDB_SUCCESS;
}
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 6fd6d7f..b38f45f 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -374,8 +374,16 @@ static int replmd_op_callback(struct ldb_request *req, struct ldb_reply *ares)
partition_ctrl = ldb_reply_get_control(ares, DSDB_CONTROL_CURRENT_PARTITION_OID);
- /* Remove the 'partition' control from what we pass up the chain */
- controls = ldb_controls_except_specified(ares->controls, ares, partition_ctrl);
+ controls = ares->controls;
+ if (ldb_request_get_control(ac->req,
+ DSDB_CONTROL_CURRENT_PARTITION_OID) == NULL) {
+ /*
+ * Remove the current partition control from what we pass up
+ * the chain if it hasn't been requested manually.
+ */
+ controls = ldb_controls_except_specified(ares->controls, ares,
+ partition_ctrl);
+ }
if (ares->error != LDB_SUCCESS) {
DEBUG(0,("%s failure. Error is: %s\n", __FUNCTION__, ldb_strerror(ares->error)));
@@ -444,8 +452,7 @@ static int replmd_op_callback(struct ldb_request *req, struct ldb_reply *ares)
* common path. Other cases will have it cleaned up
* eventually with the ares */
talloc_free(partition_ctrl);
- return ldb_module_done(ac->req,
- ldb_controls_except_specified(controls, ares, partition_ctrl),
+ return ldb_module_done(ac->req, controls,
ares->response, LDB_SUCCESS);
}
}
@@ -986,6 +993,17 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req)
return ret;
}
+ /* current partition control is needed by "replmd_op_callback" */
+ if (ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID) == NULL) {
+ ret = ldb_request_add_control(down_req,
+ DSDB_CONTROL_CURRENT_PARTITION_OID,
+ false, NULL);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(ac);
+ return ret;
+ }
+ }
+
if (functional_level == DS_DOMAIN_FUNCTION_2000) {
ret = ldb_request_add_control(down_req, DSDB_CONTROL_APPLY_LINKS, false, NULL);
if (ret != LDB_SUCCESS) {
@@ -2239,6 +2257,17 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req)
return ret;
}
+ /* current partition control is needed by "replmd_op_callback" */
+ if (ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID) == NULL) {
+ ret = ldb_request_add_control(down_req,
+ DSDB_CONTROL_CURRENT_PARTITION_OID,
+ false, NULL);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(ac);
+ return ret;
+ }
+ }
+
/* If we are in functional level 2000, then
* replmd_modify_handle_linked_attribs will have done
* nothing */
@@ -2371,6 +2400,18 @@ static int replmd_rename_callback(struct ldb_request *req, struct ldb_reply *are
talloc_free(ac);
--
Samba Shared Repository
More information about the samba-cvs
mailing list