summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-04-05 14:49:05 +0400
committerAndrew Tridgell <tridge@samba.org>2011-04-06 05:57:06 +0200
commit0846b3c8a28fa1baa4215694d098a32c83d59d6f (patch)
treebdd60ee4b38b91ea8a6e0e970d526d0281af62ed /source4/dsdb/samdb
parentd84a8d534374072fc96fd5da34e0021c81005f1a (diff)
downloadsamba-0846b3c8a28fa1baa4215694d098a32c83d59d6f.tar.gz
samba-0846b3c8a28fa1baa4215694d098a32c83d59d6f.tar.bz2
samba-0846b3c8a28fa1baa4215694d098a32c83d59d6f.zip
s4: Update/Set local USN only on attribute that have been modified/created
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 6180dfc09a..06c63a8835 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -3455,6 +3455,7 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
ni++;
}
+ ar->seq_num = 0;
/* now merge in the new meta data */
for (i=0; i < rmd->ctr.ctr1.count; i++) {
bool found = false;
@@ -3471,6 +3472,13 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
if (cmp) {
/* replace the entry */
nmd.ctr.ctr1.array[j] = rmd->ctr.ctr1.array[i];
+ if (ar->seq_num == 0) {
+ ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &ar->seq_num);
+ if (ret != LDB_SUCCESS) {
+ return replmd_replicated_request_error(ar, ret);
+ }
+ }
+ nmd.ctr.ctr1.array[j].local_usn = ar->seq_num;
found = true;
break;
}
@@ -3493,6 +3501,13 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
if (found) continue;
nmd.ctr.ctr1.array[ni] = rmd->ctr.ctr1.array[i];
+ if (ar->seq_num == 0) {
+ ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &ar->seq_num);
+ if (ret != LDB_SUCCESS) {
+ return replmd_replicated_request_error(ar, ret);
+ }
+ }
+ nmd.ctr.ctr1.array[ni].local_usn = ar->seq_num;
ni++;
}
@@ -3527,15 +3542,6 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
ldb_debug(ldb, LDB_DEBUG_TRACE, "replmd_replicated_apply_merge[%u]: replace %u attributes\n",
ar->index_current, msg->num_elements);
- ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &ar->seq_num);
- if (ret != LDB_SUCCESS) {
- return replmd_replicated_request_error(ar, ret);
- }
-
- for (i=0; i<ni; i++) {
- nmd.ctr.ctr1.array[i].local_usn = ar->seq_num;
- }
-
/* create the meta data value */
ndr_err = ndr_push_struct_blob(&nmd_value, msg, &nmd,
(ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);