diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-10-10 09:36:44 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-10-21 22:43:50 +1100 |
commit | 8ea2a8b7858866689c95d6a9d158b392b560e6b5 (patch) | |
tree | a68f1f493b0829cab2bf1c26c5913901ac4c1573 /source4 | |
parent | d4048b2e1771724d4e155172ff96983149f669e6 (diff) | |
download | samba-8ea2a8b7858866689c95d6a9d158b392b560e6b5.tar.gz samba-8ea2a8b7858866689c95d6a9d158b392b560e6b5.tar.bz2 samba-8ea2a8b7858866689c95d6a9d158b392b560e6b5.zip |
s4:dsdb Set 'notification' after the success of a change.
This allows the partition to be created before we try and set a
notification on it. (perhaps extra work required here for partition
heads).
Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 74dd7e5bbb..a0dd111bdf 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -76,6 +76,8 @@ struct replmd_replicated_request { uint32_t index_current; struct ldb_message *search_msg; + + uint64_t seq_num; }; @@ -429,6 +431,7 @@ static int replmd_op_callback(struct ldb_request *req, struct ldb_reply *ares) { struct ldb_context *ldb; struct replmd_replicated_request *ac; + int ret; ac = talloc_get_type(req->context, struct replmd_replicated_request); ldb = ldb_module_get_ctx(ac->module); @@ -450,6 +453,11 @@ static int replmd_op_callback(struct ldb_request *req, struct ldb_reply *ares) LDB_ERR_OPERATIONS_ERROR); } + ret = replmd_notify(ac->module, req->op.add.message->dn, ac->seq_num); + if (ret != LDB_SUCCESS) { + return ret; + } + return ldb_module_done(ac->req, ares->controls, ares->response, LDB_SUCCESS); } @@ -469,7 +477,6 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) struct ldb_val guid_value; struct replPropertyMetaDataBlob nmd; struct ldb_val nmd_value; - uint64_t seq_num; const struct GUID *our_invocation_id; time_t t = time(NULL); NTTIME now; @@ -534,7 +541,7 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) } /* Get a sequence number from the backend */ - ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &seq_num); + ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &ac->seq_num); if (ret != LDB_SUCCESS) { talloc_free(ac); return ret; @@ -637,8 +644,8 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) m->version = 1; m->originating_change_time = now; m->originating_invocation_id = *our_invocation_id; - m->originating_usn = seq_num; - m->local_usn = seq_num; + m->originating_usn = ac->seq_num; + m->local_usn = ac->seq_num; ni++; } @@ -689,13 +696,13 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) talloc_free(ac); return ret; } - ret = samdb_msg_add_uint64(ldb, msg, msg, "uSNCreated", seq_num); + ret = samdb_msg_add_uint64(ldb, msg, msg, "uSNCreated", ac->seq_num); if (ret != LDB_SUCCESS) { ldb_oom(ldb); talloc_free(ac); return ret; } - ret = samdb_msg_add_uint64(ldb, msg, msg, "uSNChanged", seq_num); + ret = samdb_msg_add_uint64(ldb, msg, msg, "uSNChanged", ac->seq_num); if (ret != LDB_SUCCESS) { ldb_oom(ldb); talloc_free(ac); @@ -723,12 +730,6 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) return ret; } - ret = replmd_notify(module, msg->dn, seq_num); - if (ret != LDB_SUCCESS) { - talloc_free(ac); - return ret; - } - /* if a control is there remove if from the modified request */ if (control && !save_controls(control, down_req, &saved_controls)) { talloc_free(ac); @@ -914,11 +915,6 @@ static int replmd_update_rpmd(struct ldb_module *module, return ret; } - ret = replmd_notify(module, msg->dn, *seq_num); - if (ret != LDB_SUCCESS) { - return ret; - } - el->num_values = 1; el->values = md_value; } @@ -986,7 +982,7 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req) return ret; } - ret = replmd_update_rpmd(module, msg, &seq_num); + ret = replmd_update_rpmd(module, msg, &ac->seq_num); if (ret != LDB_SUCCESS) { talloc_free(ac); return ret; |