diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-07-12 04:59:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:04 -0500 |
commit | 32ab51876728577375b954a04103f71ddd4d93dc (patch) | |
tree | 99ece19cb36fc02d90ec07f2498e9b1a34c5c237 /source4/lib/ldb/modules | |
parent | b1a92083d8bbfcf917d2a567833bf6925067718e (diff) | |
download | samba-32ab51876728577375b954a04103f71ddd4d93dc.tar.gz samba-32ab51876728577375b954a04103f71ddd4d93dc.tar.bz2 samba-32ab51876728577375b954a04103f71ddd4d93dc.zip |
r16972: Replace the sequence_number function pointer in ldb with the ldb flags.
The function pointer was meant to be unused, this patch fixes
partition.c to use ldb_sequence_number(). (No backend provided the
pointer any more).
Set the flags onto the ldb structure, so that all backends opened by
the partitions module inherit the flags.
Set the read-ony flag when accessed as the global catalog
Modify the LDAP server to track that this query is for the global
catalog (by incoming port), and set a opqaue pointer.
Next step is to read that opaque pointer in the partitions module.
Andrew Bartlett
(This used to be commit a1161cb30e4ffa09657a89e03ca85dd6efd4feba)
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r-- | source4/lib/ldb/modules/operational.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index b404e94580..a15a553286 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -349,6 +349,7 @@ static int operational_add(struct ldb_module *module, struct ldb_request *req) struct ldb_request *down_req; struct ldb_message *msg; time_t t = time(NULL); + uint64_t seq_num; int ret; if (ldb_dn_is_special(req->op.add.message->dn)) { @@ -373,9 +374,9 @@ static int operational_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } - /* see if the backend can give us the USN */ - if (module->ldb->sequence_number != NULL) { - uint64_t seq_num = module->ldb->sequence_number(module->ldb); + /* Get a sequence number from the backend */ + ret = ldb_sequence_number(module->ldb, &seq_num); + if (ret == LDB_SUCCESS) { if (add_uint64_element(msg, "uSNCreated", seq_num) != 0 || add_uint64_element(msg, "uSNChanged", seq_num) != 0) { talloc_free(down_req); @@ -405,6 +406,7 @@ static int operational_modify(struct ldb_module *module, struct ldb_request *req struct ldb_request *down_req; struct ldb_message *msg; time_t t = time(NULL); + uint64_t seq_num; int ret; if (ldb_dn_is_special(req->op.mod.message->dn)) { @@ -428,12 +430,15 @@ static int operational_modify(struct ldb_module *module, struct ldb_request *req return LDB_ERR_OPERATIONS_ERROR; } - /* update the records USN if possible */ - if (module->ldb->sequence_number != NULL && - add_uint64_element(msg, "uSNChanged", - module->ldb->sequence_number(module->ldb)) != 0) { - talloc_free(down_req); - return -1; + /* Get a sequence number from the backend */ + ret = ldb_sequence_number(module->ldb, &seq_num); + if (ret == LDB_SUCCESS) { + /* update the records USN if possible */ + if (add_uint64_element(msg, "uSNChanged", + seq_num) != 0) { + talloc_free(down_req); + return -1; + } } ldb_set_timeout_from_prev_req(module->ldb, req, down_req); |