summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-11-14 14:14:58 +1100
committerAmitay Isaacs <amitay@gmail.com>2011-11-29 16:00:35 +1100
commit349c54528b82946683290f436eb7220ca59505fe (patch)
tree3cc94259054fe4cbfaa4e64556f360ee2f3f5db0 /source4
parent422fcbbe7244a0c14aeca5cda7f2a28e2ee821b5 (diff)
downloadsamba-349c54528b82946683290f436eb7220ca59505fe.tar.gz
samba-349c54528b82946683290f436eb7220ca59505fe.tar.bz2
samba-349c54528b82946683290f436eb7220ca59505fe.zip
s4-dsdb: use dsdb_module_extended instead of duplicate code
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c42
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_init.c2
2 files changed, 13 insertions, 31 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index f6453aac7f..a691d3fbda 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -960,45 +960,27 @@ static int partition_del_trans(struct ldb_module *module)
}
int partition_primary_sequence_number(struct ldb_module *module, TALLOC_CTX *mem_ctx,
- enum ldb_sequence_type type, uint64_t *seq_number)
+ enum ldb_sequence_type type, uint64_t *seq_number,
+ struct ldb_request *parent)
{
int ret;
struct ldb_result *res;
struct ldb_seqnum_request *tseq;
- struct ldb_request *treq;
struct ldb_seqnum_result *seqr;
- res = talloc_zero(mem_ctx, struct ldb_result);
- if (res == NULL) {
- return ldb_oom(ldb_module_get_ctx(module));
- }
- tseq = talloc_zero(res, struct ldb_seqnum_request);
+
+ tseq = talloc_zero(mem_ctx, struct ldb_seqnum_request);
if (tseq == NULL) {
- talloc_free(res);
return ldb_oom(ldb_module_get_ctx(module));
}
tseq->type = type;
- ret = ldb_build_extended_req(&treq, ldb_module_get_ctx(module), res,
- LDB_EXTENDED_SEQUENCE_NUMBER,
- tseq,
- NULL,
- res,
- ldb_extended_default_callback,
- NULL);
- LDB_REQ_SET_LOCATION(treq);
+ ret = dsdb_module_extended(module, tseq, &res,
+ LDB_EXTENDED_SEQUENCE_NUMBER,
+ tseq,
+ DSDB_FLAG_NEXT_MODULE,
+ parent);
if (ret != LDB_SUCCESS) {
- talloc_free(res);
- return ret;
- }
-
- ret = ldb_next_request(module, treq);
- if (ret != LDB_SUCCESS) {
- talloc_free(res);
- return ret;
- }
- ret = ldb_wait(treq->handle, LDB_WAIT_ALL);
- if (ret != LDB_SUCCESS) {
- talloc_free(res);
+ talloc_free(tseq);
return ret;
}
@@ -1011,7 +993,7 @@ int partition_primary_sequence_number(struct ldb_module *module, TALLOC_CTX *mem
}
*seq_number = seqr->seq_num;
- talloc_free(res);
+ talloc_free(tseq);
return LDB_SUCCESS;
}
@@ -1046,7 +1028,7 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
case LDB_SEQ_NEXT:
case LDB_SEQ_HIGHEST_SEQ:
- ret = partition_primary_sequence_number(module, req, seq->type, &seq_number);
+ ret = partition_primary_sequence_number(module, req, seq->type, &seq_number, 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 030f592d3a..b3dc6443f4 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -397,7 +397,7 @@ int partition_reload_if_required(struct ldb_module *module,
return ldb_oom(ldb);
}
- ret = partition_primary_sequence_number(module, mem_ctx, LDB_SEQ_HIGHEST_SEQ, &seq);
+ ret = partition_primary_sequence_number(module, mem_ctx, LDB_SEQ_HIGHEST_SEQ, &seq, parent);
if (ret != LDB_SUCCESS) {
talloc_free(mem_ctx);
return ret;