summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-22 20:56:32 -0700
committerAndrew Tridgell <tridge@samba.org>2009-09-23 14:01:29 -0700
commit523fb6d72b08a77e9c423a4f2d15d699d576d701 (patch)
treef08c218b975737bb2065b34a16fceb9b6605318a
parent87b6f2e863c6e117643ab6704e50167e849b69cc (diff)
downloadsamba-523fb6d72b08a77e9c423a4f2d15d699d576d701.tar.gz
samba-523fb6d72b08a77e9c423a4f2d15d699d576d701.tar.bz2
samba-523fb6d72b08a77e9c423a4f2d15d699d576d701.zip
s4-drs: ignore zero value elements in DRS add operations
w2k8 sometimes sends us a new object via DRS with an attribute with no values
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 39102e5bbe..bb1c5bb1a1 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -1135,6 +1135,19 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
return replmd_replicated_request_error(ar, ret);
}
+ /* remove any message elements that have zero values */
+ for (i=0; i<msg->num_elements; i++) {
+ if (msg->elements[i].num_values == 0) {
+ DEBUG(4,(__location__ ": Removing attribute %s with num_values==0\n",
+ msg->elements[i].name));
+ memmove(&msg->elements[i],
+ &msg->elements[i+1],
+ sizeof(msg->elements[i])*(msg->num_elements - (i+1)));
+ msg->num_elements--;
+ i--;
+ }
+ }
+
/*
* the meta data array is already sorted by the caller
*/