const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector,
const DATA_BLOB *gensec_skey,
TALLOC_CTX *mem_ctx,
- struct dsdb_extended_replicated_objects **_out)
+ struct dsdb_extended_replicated_objects **_out,
+ uint64_t *notify_uSN)
{
WERROR status;
const struct dsdb_schema *schema;
const struct drsuapi_DsReplicaObjectListItemEx *cur;
uint32_t i;
int ret;
+ uint64_t seq_num1, seq_num2;
schema = dsdb_get_schema(ldb);
if (!schema) {
return WERR_FOOBAR;
}
+ ret = dsdb_load_partition_usn(ldb, out->partition_dn, &seq_num1);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0,(__location__ " Failed to load partition uSN\n"));
+ talloc_free(out);
+ ldb_transaction_cancel(ldb);
+ return WERR_FOOBAR;
+ }
+
ret = ldb_extended(ldb, DSDB_EXTENDED_REPLICATED_OBJECTS_OID, out, &ext_res);
if (ret != LDB_SUCCESS) {
DEBUG(0,("Failed to apply records: %s: %s\n",
}
talloc_free(ext_res);
+ ret = ldb_transaction_prepare_commit(ldb);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0,(__location__ " Failed to prepare commit of transaction\n"));
+ talloc_free(out);
+ return WERR_FOOBAR;
+ }
+
+ ret = dsdb_load_partition_usn(ldb, out->partition_dn, &seq_num2);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0,(__location__ " Failed to load partition uSN\n"));
+ talloc_free(out);
+ ldb_transaction_cancel(ldb);
+ return WERR_FOOBAR;
+ }
+
+ /* if this replication partner didn't need to be notified
+ before this transaction then it still doesn't need to be
+ notified, as the changes came from this server */
+ if (seq_num2 > seq_num1 && seq_num1 <= *notify_uSN) {
+ *notify_uSN = seq_num2;
+ }
+
ret = ldb_transaction_commit(ldb);
if (ret != LDB_SUCCESS) {
DEBUG(0,(__location__ " Failed to commit transaction\n"));
return WERR_FOOBAR;
}
+
DEBUG(2,("Replicated %u objects (%u linked attributes) for %s\n",
out->num_objects, out->linked_attributes_count,
ldb_dn_get_linearized(out->partition_dn)));
uint32_t i;
int ret;
bool ok;
+ uint64_t seq_num;
DEBUG(0,("Analyze and apply schema objects\n"));
s_dsa,
uptodateness_vector,
c->gensec_skey,
- s, &objs);
+ s, &objs, &seq_num);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
return werror_to_ntstatus(status);
struct repsFromTo1 *s_dsa;
char *tmp_dns_name;
uint32_t i;
+ uint64_t seq_num;
s_dsa = talloc_zero(s, struct repsFromTo1);
NT_STATUS_HAVE_NO_MEMORY(s_dsa);
s_dsa,
uptodateness_vector,
c->gensec_skey,
- s, &objs);
+ s, &objs, &seq_num);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
return werror_to_ntstatus(status);
uint32_t i;
int ret;
bool ok;
+ uint64_t seq_num;
DEBUG(0,("Analyze and apply schema objects\n"));
s_dsa,
uptodateness_vector,
c->gensec_skey,
- s, &objs);
+ s, &objs, &seq_num);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
return werror_to_ntstatus(status);
struct repsFromTo1 *s_dsa;
char *tmp_dns_name;
uint32_t i;
+ uint64_t seq_num;
s_dsa = talloc_zero(s, struct repsFromTo1);
NT_STATUS_HAVE_NO_MEMORY(s_dsa);
s_dsa,
uptodateness_vector,
c->gensec_skey,
- s, &objs);
+ s, &objs, &seq_num);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
return werror_to_ntstatus(status);