s4-drs: cope with bogus empty attributes from w2k8-r2 (Re: [SCM] Samba Shared Repository - branch master updated)
Stefan (metze) Metzmacher
metze at samba.org
Sat Nov 28 05:10:25 MST 2009
Hi Tridge,
> The branch, master has been updated
> via 1287c1d... s4-drs: cope with bogus empty attributes from w2k8-r2
> from db41a0a... s4: fix SD update and password change in upgrade script
>
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
>
>
> - Log -----------------------------------------------------------------
> commit 1287c1d115fb7e8f3954bc05ff65007968403a9c
> Author: Andrew Tridgell <tridge at samba.org>
> Date: Sat Nov 28 13:27:06 2009 +1100
>
> s4-drs: cope with bogus empty attributes from w2k8-r2
>
> w2k8-r2 sometimes sends empty attributes with completely bogus attrid
> values in a DRS replication response. This allows us to continue with
> the vampire operation despite these broken elements.
>
> -----------------------------------------------------------------------
>
> Summary of changes:
> source4/dsdb/repl/replicated_objects.c | 17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)
>
>
> Changeset truncated at 500 lines:
>
> diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
> index 020d5f1..a8a93e4 100644
> --- a/source4/dsdb/repl/replicated_objects.c
> +++ b/source4/dsdb/repl/replicated_objects.c
> @@ -129,6 +129,15 @@ static WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
> }
>
> status = dsdb_attribute_drsuapi_to_ldb(ldb, schema, a, msg->elements, e);
> + if (!NT_STATUS_IS_OK(status) && a->value_ctr.num_values == 0) {
> + /* w2k8-r2 occasionally sends bogus empty
> + attributes with rubbish attribute IDs. The
> + only think we can do is discard these */
> + DEBUG(0,(__location__ ": Discarding bogus empty DsReplicaAttribute with attid 0x%x\n",
> + a->attid));
> + ZERO_STRUCTP(e);
> + continue;
> + }
> W_ERROR_NOT_OK_RETURN(status);
>
> m->attid = a->attid;
> @@ -149,6 +158,14 @@ static WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
> }
> }
>
> + /* delete any empty elements */
> + for (i=0; i < msg->num_elements; i++) {
> + if (msg->elements[i].name == NULL) {
> + ldb_msg_remove_element(msg, &msg->elements[i]);
> + i--;
> + }
> + }
> +
We need to be careful about this, an empty element means
we should remove existing values.
If remove the empty ones here, we need to let the repl_meta_data module
remove them based on the received meta_data array.
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091128/61d598d8/attachment.pgp>
More information about the samba-technical
mailing list