diff options
author | Anatoliy Atanasov <anatoliy.atanasov@postpath.com> | 2009-09-03 18:37:31 +0300 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-08 11:52:44 +1000 |
commit | e6816715b7563250ce1ce1b0f65d470edcc4130c (patch) | |
tree | 8dfeb0f9d115ba250c8ccfc7c59b653245d143dc | |
parent | 374e5937cde797ff36447c38f38ab77c379c19d8 (diff) | |
download | samba-e6816715b7563250ce1ce1b0f65d470edcc4130c.tar.gz samba-e6816715b7563250ce1ce1b0f65d470edcc4130c.tar.bz2 samba-e6816715b7563250ce1ce1b0f65d470edcc4130c.zip |
Fill the meta data vector in the responce struct.
-rw-r--r-- | source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index 3fef3eba70..1473da0ee1 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -28,6 +28,7 @@ #include "dsdb/samdb/samdb.h" #include "lib/ldb/include/ldb_errors.h" #include "param/param.h" +#include "librpc/gen_ndr/ndr_drsblobs.h" /* drsuapi_DsBind @@ -318,7 +319,11 @@ static WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, struct drsuapi_DsReplicaObjectListItemEx *currentObject; struct dom_sid *zero_sid; struct ldb_dn *obj_dn; - + enum ndr_err_code ndr_err; + const struct ldb_val *md_value; + struct replPropertyMetaDataBlob md; + ZERO_STRUCT(md); + md.version = 1; b_state = talloc_zero(mem_ctx, struct drsuapi_bind_state); W_ERROR_HAVE_NO_MEMORY(b_state); zero_sid = talloc_zero(mem_ctx, struct dom_sid); @@ -399,10 +404,33 @@ static WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, *currentObject->parent_object_guid = samdb_result_guid(site_res->msgs[i], "parentGUID"); } currentObject->next_object = NULL; - /* TODO: MetaData vector*/ + currentObject->meta_data_ctr = talloc(mem_ctx, struct drsuapi_DsReplicaMetaDataCtr); - currentObject->meta_data_ctr->meta_data = talloc(mem_ctx, struct drsuapi_DsReplicaMetaData); - currentObject->meta_data_ctr->count = 0; + md_value = ldb_msg_find_ldb_val(site_res->msgs[i], "replPropertyMetaData"); + if (md_value) { + ndr_err = ndr_pull_struct_blob(md_value, mem_ctx, + lp_iconv_convenience(ldb_get_opaque(b_state->sam_ctx, "loadparm")), &md, + (ndr_pull_flags_fn_t)ndr_pull_replPropertyMetaDataBlob); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return WERR_DS_DRA_INTERNAL_ERROR; + } + + if (md.version != 1) { + return WERR_DS_DRA_INTERNAL_ERROR; + } + + currentObject->meta_data_ctr->count = md.ctr.ctr1.count; + currentObject->meta_data_ctr->meta_data = talloc_array(mem_ctx, struct drsuapi_DsReplicaMetaData, md.ctr.ctr1.count); + for (j=0; j<md.ctr.ctr1.count; j++) { + currentObject->meta_data_ctr->meta_data[j].originating_change_time = md.ctr.ctr1.array[j].originating_change_time; + currentObject->meta_data_ctr->meta_data[j].version = md.ctr.ctr1.array[j].version; + currentObject->meta_data_ctr->meta_data[j].originating_invocation_id = md.ctr.ctr1.array[j].originating_invocation_id; + currentObject->meta_data_ctr->meta_data[j].originating_usn = md.ctr.ctr1.array[j].originating_usn; + } + } else { + currentObject->meta_data_ctr->meta_data = talloc(mem_ctx, struct drsuapi_DsReplicaMetaData); + currentObject->meta_data_ctr->count = 0; + } currentObject->object.identifier = talloc(mem_ctx, struct drsuapi_DsReplicaObjectIdentifier); obj_dn = ldb_msg_find_attr_as_dn(b_state->sam_ctx, mem_ctx, site_res->msgs[i], "distinguishedName"); currentObject->object.identifier->dn = ldb_dn_get_linearized(obj_dn); |