summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2012-05-30 10:42:56 -0700
committerMatthieu Patou <mat@matws.net>2012-06-22 23:22:04 -0700
commit9f1213d954c72a46ac1f30e936e4004b1ed9ff76 (patch)
tree6e892809a63609157f1d7e7c2a2cd3d497bf4858
parentf2deb05f77e21c5c9106dac32202d0b92eca3f96 (diff)
downloadsamba-9f1213d954c72a46ac1f30e936e4004b1ed9ff76.tar.gz
samba-9f1213d954c72a46ac1f30e936e4004b1ed9ff76.tar.bz2
samba-9f1213d954c72a46ac1f30e936e4004b1ed9ff76.zip
s4-drs: if schema has changed during replication notify other process that they have to reload the schema
-rw-r--r--source4/dsdb/repl/replicated_objects.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 5ccf052554..481ff60217 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -624,12 +624,67 @@ WERROR dsdb_replicated_objects_commit(struct ldb_context *ldb,
* a schema cache being refreshed from database.
*/
if (working_schema) {
+ struct ldb_message *msg;
+ struct ldb_request *req;
+
+ /* Force a reload */
+ working_schema->last_refresh = 0;
cur_schema = dsdb_get_schema(ldb, NULL);
/* TODO: What we do in case dsdb_get_schema() fail?
* We can't fallback at this point anymore */
if (cur_schema) {
dsdb_make_schema_global(ldb, cur_schema);
}
+ msg = ldb_msg_new(ldb);
+ if (msg == 0) {
+ return WERR_NOMEM;
+ }
+ msg->dn = NULL;
+
+ ret = ldb_msg_add_string(msg, "schemaUpdateNow", "1");
+ if (ret != LDB_SUCCESS) {
+ talloc_free(msg);
+ return WERR_INTERNAL_ERROR;
+ }
+
+ ret = ldb_build_mod_req(&req, ldb, ldb,
+ msg,
+ LDB_SCOPE_BASE,
+ NULL,
+ ldb_op_default_callback,
+ NULL);
+
+ if (ret != LDB_SUCCESS) {
+ talloc_free(msg);
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
+
+ ret = ldb_transaction_start(ldb);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(msg);
+ talloc_free(req);
+ DEBUG(0, ("Autotransaction start failed\n"));
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
+
+ ret = ldb_request(ldb, req);
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_transaction_commit(ldb);
+ } else {
+ DEBUG(0, ("Schema update now failed: %s\n", ldb_strerror(ret)));
+ ldb_transaction_cancel(ldb);
+ }
+
+ talloc_free(msg);
+ talloc_free(req);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0, ("Commit failed: %s\n", ldb_strerror(ret)));
+ return WERR_DS_INTERNAL_FAILURE;
+ }
}
DEBUG(2,("Replicated %u objects (%u linked attributes) for %s\n",