From d0b54476fc9f855d1e482597538a7ec60e04f331 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 22 Mar 2010 16:00:39 +1100 Subject: s4:dsdb Move dsdb_save_partition_usn() to be a module helper function This function should not traverse the module stack again, but instead run from this point. Also add a matching dsdb_module_load_partition_usn() and change repl_meta_data to match. Andrew Bartlett --- source4/dsdb/common/util.c | 88 ---------------------------------------------- 1 file changed, 88 deletions(-) (limited to 'source4/dsdb/common') diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 9c2950994c..b469b06232 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -2585,94 +2585,6 @@ int dsdb_load_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, return LDB_SUCCESS; } -/* - save uSNHighest and uSNUrgent attributes in the @REPLCHANGED object for a - partition - */ -int dsdb_save_partition_usn(struct ldb_context *ldb, struct ldb_dn *dn, - uint64_t uSN, uint64_t urgent_uSN) -{ - struct ldb_request *req; - struct ldb_message *msg; - struct dsdb_control_current_partition *p_ctrl; - int ret; - - msg = ldb_msg_new(ldb); - if (msg == NULL) { - return LDB_ERR_OPERATIONS_ERROR; - } - - msg->dn = ldb_dn_new(msg, ldb, "@REPLCHANGED"); - if (msg->dn == NULL) { - talloc_free(msg); - return LDB_ERR_OPERATIONS_ERROR; - } - - ret = ldb_msg_add_fmt(msg, "uSNHighest", "%llu", (unsigned long long)uSN); - if (ret != LDB_SUCCESS) { - talloc_free(msg); - return ret; - } - msg->elements[0].flags = LDB_FLAG_MOD_REPLACE; - - /* urgent_uSN is optional so may not be stored */ - if (urgent_uSN) { - ret = ldb_msg_add_fmt(msg, "uSNUrgent", "%llu", (unsigned long long)urgent_uSN); - if (ret != LDB_SUCCESS) { - talloc_free(msg); - return ret; - } - msg->elements[1].flags = LDB_FLAG_MOD_REPLACE; - } - - - p_ctrl = talloc(msg, struct dsdb_control_current_partition); - if (p_ctrl == NULL) { - talloc_free(msg); - return LDB_ERR_OPERATIONS_ERROR; - } - p_ctrl->version = DSDB_CONTROL_CURRENT_PARTITION_VERSION; - p_ctrl->dn = dn; - - ret = ldb_build_mod_req(&req, ldb, msg, - msg, - NULL, - NULL, ldb_op_default_callback, - NULL); -again: - if (ret != LDB_SUCCESS) { - talloc_free(msg); - return ret; - } - - ret = ldb_request_add_control(req, - DSDB_CONTROL_CURRENT_PARTITION_OID, - false, p_ctrl); - if (ret != LDB_SUCCESS) { - talloc_free(msg); - return ret; - } - - /* Run the new request */ - ret = ldb_request(ldb, req); - - if (ret == LDB_SUCCESS) { - ret = ldb_wait(req->handle, LDB_WAIT_ALL); - } - if (ret == LDB_ERR_NO_SUCH_OBJECT) { - ret = ldb_build_add_req(&req, ldb, msg, - msg, - NULL, - NULL, ldb_op_default_callback, - NULL); - goto again; - } - - talloc_free(msg); - - return ret; -} - int drsuapi_DsReplicaCursor2_compare(const struct drsuapi_DsReplicaCursor2 *c1, const struct drsuapi_DsReplicaCursor2 *c2) { -- cgit