summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/partition_metadata.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-09 12:20:37 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-09 04:32:18 +0200
commit6ec963eef7c00315b2d941951602825a89fabb6e (patch)
tree044f46fd5c682efdc8f68cdbbc6269f21bd90ab7 /source4/dsdb/samdb/ldb_modules/partition_metadata.c
parent6a648b727f50e33a4c66a77e3980d7c0c2adcb49 (diff)
downloadsamba-6ec963eef7c00315b2d941951602825a89fabb6e.tar.gz
samba-6ec963eef7c00315b2d941951602825a89fabb6e.tar.bz2
samba-6ec963eef7c00315b2d941951602825a89fabb6e.zip
s4-dsdb: simplify migration of old-style seqence numbers to metadata.tdb
This simple operation does not need to be encased in generic ldb extended operations. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/partition_metadata.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_metadata.c57
1 files changed, 1 insertions, 56 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition_metadata.c b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
index 0bf7a40640..5826ac2ee1 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_metadata.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
@@ -260,69 +260,14 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
*/
static int partition_metadata_set_sequence_number(struct ldb_module *module)
{
- struct partition_private_data *data;
- struct ldb_result *res;
- struct ldb_request *req;
- struct ldb_seqnum_request *seq;
- struct ldb_seqnum_result *seqr;
- struct ldb_extended *ext;
- TALLOC_CTX *tmp_ctx;
int ret;
uint64_t seq_number;
- data = talloc_get_type_abort(ldb_module_get_private(module),
- struct partition_private_data);
- if (!data || !data->metadata) {
- return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
- "partition_metadata: metadata not initialized");
- }
-
- tmp_ctx = talloc_new(data->metadata);
- if (tmp_ctx == NULL) {
- return ldb_module_oom(module);
- }
-
- res = talloc_zero(tmp_ctx, struct ldb_result);
- if (res == NULL) {
- talloc_free(tmp_ctx);
- return ldb_module_oom(module);
- }
-
- seq = talloc_zero(tmp_ctx, struct ldb_seqnum_request);
- if (seq == NULL) {
- talloc_free(tmp_ctx);
- return ldb_module_oom(module);
- }
- seq->type = LDB_SEQ_HIGHEST_SEQ;
-
- /* Build an extended request, so it can be passed to each partition in
- partition_sequence_number_from_partitions() */
- ret = ldb_build_extended_req(&req,
- ldb_module_get_ctx(module),
- tmp_ctx,
- LDB_EXTENDED_SEQUENCE_NUMBER,
- seq,
- NULL,
- res,
- ldb_extended_default_callback,
- NULL);
- LDB_REQ_SET_LOCATION(req);
- if (ret != LDB_SUCCESS) {
- talloc_free(tmp_ctx);
- return ret;
- }
-
- ret = partition_sequence_number_from_partitions(module, req, &ext);
+ ret = partition_sequence_number_from_partitions(module, &seq_number);
if (ret != LDB_SUCCESS) {
- talloc_free(tmp_ctx);
return ret;
}
- seqr = talloc_get_type_abort(ext->data, struct ldb_seqnum_result);
- seq_number = seqr->seq_num;
-
- talloc_free(tmp_ctx);
-
return partition_metadata_set_uint64(module, LDB_METADATA_SEQ_NUM, seq_number, true);
}