summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/gen_ndr/drsblobs.h31
-rw-r--r--librpc/gen_ndr/ndr_drsblobs.c232
-rw-r--r--librpc/gen_ndr/ndr_drsblobs.h7
-rw-r--r--librpc/idl/drsblobs.idl31
-rw-r--r--source4/rpc_server/drsuapi/updaterefs.c122
5 files changed, 70 insertions, 353 deletions
diff --git a/librpc/gen_ndr/drsblobs.h b/librpc/gen_ndr/drsblobs.h
index e2781d4a8e..190e012cb5 100644
--- a/librpc/gen_ndr/drsblobs.h
+++ b/librpc/gen_ndr/drsblobs.h
@@ -128,37 +128,6 @@ struct prefixMapBlob {
union prefixMapCtr ctr;/* [switch_is(version)] */
}/* [public] */;
-enum repsToVersion
-#ifndef USE_UINT_ENUMS
- {
- REPSTO_VERSION1=1
-}
-#else
- { __donnot_use_enum_repsToVersion=0x7FFFFFFF}
-#define REPSTO_VERSION1 ( 1 )
-#endif
-;
-
-struct repsToDest {
- const char * dest_dsa_dns_name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
- struct GUID dest_guid;
- uint32_t options;
-};
-
-struct repsTov1 {
- uint32_t count;
- struct repsToDest *reps;/* [size_is(count)] */
-};
-
-union repsToCtr {
- struct repsTov1 r;/* [case(REPSTO_VERSION1)] */
-}/* [nodiscriminant] */;
-
-struct repsTo {
- enum repsToVersion version;
- union repsToCtr ctr;/* [switch_is(version)] */
-}/* [public] */;
-
union ldapControlDirSyncExtra {
struct replUpToDateVectorBlob uptodateness_vector;/* [default] */
}/* [gensize,nodiscriminant] */;
diff --git a/librpc/gen_ndr/ndr_drsblobs.c b/librpc/gen_ndr/ndr_drsblobs.c
index 497140fe42..020d5b3376 100644
--- a/librpc/gen_ndr/ndr_drsblobs.c
+++ b/librpc/gen_ndr/ndr_drsblobs.c
@@ -1012,238 +1012,6 @@ _PUBLIC_ void ndr_print_prefixMapBlob(struct ndr_print *ndr, const char *name, c
ndr->depth--;
}
-static enum ndr_err_code ndr_push_repsToVersion(struct ndr_push *ndr, int ndr_flags, enum repsToVersion r)
-{
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_repsToVersion(struct ndr_pull *ndr, int ndr_flags, enum repsToVersion *r)
-{
- uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_repsToVersion(struct ndr_print *ndr, const char *name, enum repsToVersion r)
-{
- const char *val = NULL;
-
- switch (r) {
- case REPSTO_VERSION1: val = "REPSTO_VERSION1"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-static enum ndr_err_code ndr_push_repsToDest(struct ndr_push *ndr, int ndr_flags, const struct repsToDest *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->dest_dsa_dns_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->dest_guid));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->options));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_repsToDest(struct ndr_pull *ndr, int ndr_flags, struct repsToDest *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->dest_dsa_dns_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->dest_guid));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->options));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_repsToDest(struct ndr_print *ndr, const char *name, const struct repsToDest *r)
-{
- ndr_print_struct(ndr, name, "repsToDest");
- ndr->depth++;
- ndr_print_string(ndr, "dest_dsa_dns_name", r->dest_dsa_dns_name);
- ndr_print_GUID(ndr, "dest_guid", &r->dest_guid);
- ndr_print_uint32(ndr, "options", r->options);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_repsTov1(struct ndr_push *ndr, int ndr_flags, const struct repsTov1 *r)
-{
- uint32_t cntr_reps_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
- for (cntr_reps_0 = 0; cntr_reps_0 < r->count; cntr_reps_0++) {
- NDR_CHECK(ndr_push_repsToDest(ndr, NDR_SCALARS, &r->reps[cntr_reps_0]));
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_repsTov1(struct ndr_pull *ndr, int ndr_flags, struct repsTov1 *r)
-{
- uint32_t cntr_reps_0;
- TALLOC_CTX *_mem_save_reps_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_array_size(ndr, &r->reps));
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
- NDR_PULL_ALLOC_N(ndr, r->reps, ndr_get_array_size(ndr, &r->reps));
- _mem_save_reps_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->reps, 0);
- for (cntr_reps_0 = 0; cntr_reps_0 < r->count; cntr_reps_0++) {
- NDR_CHECK(ndr_pull_repsToDest(ndr, NDR_SCALARS, &r->reps[cntr_reps_0]));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reps_0, 0);
- if (r->reps) {
- NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->reps, r->count));
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_repsTov1(struct ndr_print *ndr, const char *name, const struct repsTov1 *r)
-{
- uint32_t cntr_reps_0;
- ndr_print_struct(ndr, name, "repsTov1");
- ndr->depth++;
- ndr_print_uint32(ndr, "count", r->count);
- ndr->print(ndr, "%s: ARRAY(%d)", "reps", (int)r->count);
- ndr->depth++;
- for (cntr_reps_0=0;cntr_reps_0<r->count;cntr_reps_0++) {
- char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_reps_0) != -1) {
- ndr_print_repsToDest(ndr, "reps", &r->reps[cntr_reps_0]);
- free(idx_0);
- }
- }
- ndr->depth--;
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_repsToCtr(struct ndr_push *ndr, int ndr_flags, const union repsToCtr *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- int level = ndr_push_get_switch_value(ndr, r);
- switch (level) {
- case REPSTO_VERSION1: {
- NDR_CHECK(ndr_push_repsTov1(ndr, NDR_SCALARS, &r->r));
- break; }
-
- default:
- return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- int level = ndr_push_get_switch_value(ndr, r);
- switch (level) {
- case REPSTO_VERSION1:
- break;
-
- default:
- return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_repsToCtr(struct ndr_pull *ndr, int ndr_flags, union repsToCtr *r)
-{
- int level;
- level = ndr_pull_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case REPSTO_VERSION1: {
- NDR_CHECK(ndr_pull_repsTov1(ndr, NDR_SCALARS, &r->r));
- break; }
-
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case REPSTO_VERSION1:
- break;
-
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__);
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_repsToCtr(struct ndr_print *ndr, const char *name, const union repsToCtr *r)
-{
- int level;
- level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "repsToCtr");
- switch (level) {
- case REPSTO_VERSION1:
- ndr_print_repsTov1(ndr, "r", &r->r);
- break;
-
- default:
- ndr_print_bad_level(ndr, name, level);
- }
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_repsTo(struct ndr_push *ndr, int ndr_flags, const struct repsTo *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_repsToVersion(ndr, NDR_SCALARS, r->version));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
- NDR_CHECK(ndr_push_repsToCtr(ndr, NDR_SCALARS, &r->ctr));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_repsTo(struct ndr_pull *ndr, int ndr_flags, struct repsTo *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_repsToVersion(ndr, NDR_SCALARS, &r->version));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->version));
- NDR_CHECK(ndr_pull_repsToCtr(ndr, NDR_SCALARS, &r->ctr));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_repsTo(struct ndr_print *ndr, const char *name, const struct repsTo *r)
-{
- ndr_print_struct(ndr, name, "repsTo");
- ndr->depth++;
- ndr_print_repsToVersion(ndr, "version", r->version);
- ndr_print_set_switch_value(ndr, &r->ctr, r->version);
- ndr_print_repsToCtr(ndr, "ctr", &r->ctr);
- ndr->depth--;
-}
-
static enum ndr_err_code ndr_push_ldapControlDirSyncExtra(struct ndr_push *ndr, int ndr_flags, const union ldapControlDirSyncExtra *r)
{
if (ndr_flags & NDR_SCALARS) {
diff --git a/librpc/gen_ndr/ndr_drsblobs.h b/librpc/gen_ndr/ndr_drsblobs.h
index e890e2cfb2..27c13c8397 100644
--- a/librpc/gen_ndr/ndr_drsblobs.h
+++ b/librpc/gen_ndr/ndr_drsblobs.h
@@ -75,13 +75,6 @@ void ndr_print_prefixMapCtr(struct ndr_print *ndr, const char *name, const union
enum ndr_err_code ndr_push_prefixMapBlob(struct ndr_push *ndr, int ndr_flags, const struct prefixMapBlob *r);
enum ndr_err_code ndr_pull_prefixMapBlob(struct ndr_pull *ndr, int ndr_flags, struct prefixMapBlob *r);
void ndr_print_prefixMapBlob(struct ndr_print *ndr, const char *name, const struct prefixMapBlob *r);
-void ndr_print_repsToVersion(struct ndr_print *ndr, const char *name, enum repsToVersion r);
-void ndr_print_repsToDest(struct ndr_print *ndr, const char *name, const struct repsToDest *r);
-void ndr_print_repsTov1(struct ndr_print *ndr, const char *name, const struct repsTov1 *r);
-void ndr_print_repsToCtr(struct ndr_print *ndr, const char *name, const union repsToCtr *r);
-enum ndr_err_code ndr_push_repsTo(struct ndr_push *ndr, int ndr_flags, const struct repsTo *r);
-enum ndr_err_code ndr_pull_repsTo(struct ndr_pull *ndr, int ndr_flags, struct repsTo *r);
-void ndr_print_repsTo(struct ndr_print *ndr, const char *name, const struct repsTo *r);
void ndr_print_ldapControlDirSyncExtra(struct ndr_print *ndr, const char *name, const union ldapControlDirSyncExtra *r);
void ndr_print_ldapControlDirSyncBlob(struct ndr_print *ndr, const char *name, const struct ldapControlDirSyncBlob *r);
enum ndr_err_code ndr_push_ldapControlDirSyncCookie(struct ndr_push *ndr, int ndr_flags, const struct ldapControlDirSyncCookie *r);
diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl
index 8ec8458f6b..f20d648133 100644
--- a/librpc/idl/drsblobs.idl
+++ b/librpc/idl/drsblobs.idl
@@ -176,37 +176,6 @@ interface drsblobs {
/*
- * repsTo structure. This is not sent over the wire so we are
- * free to choose our own format. It is updated by the
- * DRSUpdateRefs DRSUAPI call. This is stored in NDR format
- * in the root of each partition in the repsTo attribute
- */
- typedef [v1_enum] enum {
- REPSTO_VERSION1 = 1
- } repsToVersion;
-
- typedef struct {
- utf8string dest_dsa_dns_name;
- GUID dest_guid;
- uint32 options;
- } repsToDest;
-
- typedef struct {
- uint32 count;
- [size_is(count)] repsToDest reps[];
- } repsTov1;
-
- typedef [nodiscriminant] union {
- [case(REPSTO_VERSION1)] repsTov1 r;
- } repsToCtr;
-
- typedef [public] struct {
- repsToVersion version;
- [switch_is(version)] repsToCtr ctr;
- } repsTo;
-
-
- /*
* the cookie for the LDAP dirsync control
*/
typedef [nodiscriminant,gensize] union {
diff --git a/source4/rpc_server/drsuapi/updaterefs.c b/source4/rpc_server/drsuapi/updaterefs.c
index 5bf2f2251f..4a888099c0 100644
--- a/source4/rpc_server/drsuapi/updaterefs.c
+++ b/source4/rpc_server/drsuapi/updaterefs.c
@@ -30,6 +30,11 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "auth/auth.h"
+struct repsTo {
+ uint32_t count;
+ struct repsFromToBlob *r;
+};
+
/*
load the repsTo structure for a given partition GUID
*/
@@ -39,8 +44,9 @@ static WERROR uref_loadreps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, st
struct ldb_dn *dn;
const char *attrs[] = { "repsTo", NULL };
struct ldb_result *res;
- const struct ldb_val *v;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+ int i;
+ struct ldb_message_element *el;
if (dsdb_find_dn_by_guid(sam_ctx, tmp_ctx, GUID_string(tmp_ctx, guid), &dn) != LDB_SUCCESS) {
DEBUG(0,("drsuapi_addref: failed to find partition with GUID %s\n",
@@ -58,16 +64,27 @@ static WERROR uref_loadreps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, st
return WERR_DS_DRA_INTERNAL_ERROR;
}
- v = ldb_msg_find_ldb_val(res->msgs[0], "repsTo");
- if (v == NULL) {
- /* treat as empty empty */
- ZERO_STRUCTP(reps);
- reps->version = REPSTO_VERSION1;
- } else {
+ ZERO_STRUCTP(reps);
+
+ el = ldb_msg_find_element(res->msgs[0], "repsTo");
+ if (el == NULL) {
+ talloc_free(tmp_ctx);
+ return WERR_OK;
+ }
+
+ reps->count = el->num_values;
+ reps->r = talloc_array(mem_ctx, struct repsFromToBlob, reps->count);
+ if (reps->r == NULL) {
+ talloc_free(tmp_ctx);
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
+
+ for (i=0; i<reps->count; i++) {
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_struct_blob(v, mem_ctx, lp_iconv_convenience(ldb_get_opaque(sam_ctx, "loadparm")),
- reps,
- (ndr_pull_flags_fn_t)ndr_pull_repsTo);
+ ndr_err = ndr_pull_struct_blob(&el->values[i],
+ mem_ctx, lp_iconv_convenience(ldb_get_opaque(sam_ctx, "loadparm")),
+ &reps->r[i],
+ (ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
return WERR_DS_DRA_INTERNAL_ERROR;
@@ -86,11 +103,10 @@ static WERROR uref_savereps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, st
struct repsTo *reps)
{
struct ldb_dn *dn;
- struct ldb_val v;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- enum ndr_err_code ndr_err;
struct ldb_message *msg;
struct ldb_message_element *el;
+ int i;
if (dsdb_find_dn_by_guid(sam_ctx, tmp_ctx, GUID_string(tmp_ctx, guid), &dn) != LDB_SUCCESS) {
DEBUG(0,("drsuapi_addref: failed to find partition with GUID %s\n",
@@ -99,20 +115,31 @@ static WERROR uref_savereps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, st
return WERR_DS_DRA_BAD_NC;
}
- ndr_err = ndr_push_struct_blob(&v, tmp_ctx, lp_iconv_convenience(ldb_get_opaque(sam_ctx, "loadparm")),
- reps,
- (ndr_push_flags_fn_t)ndr_push_repsTo);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto failed;
- }
-
msg = ldb_msg_new(tmp_ctx);
msg->dn = dn;
if (ldb_msg_add_empty(msg, "repsTo", LDB_FLAG_MOD_REPLACE, &el) != LDB_SUCCESS) {
goto failed;
}
- el->num_values = 1;
- el->values = &v;
+
+ el->values = talloc_array(msg, struct ldb_val, reps->count);
+ if (!el->values) {
+ goto failed;
+ }
+
+ for (i=0; i<reps->count; i++) {
+ struct ldb_val v;
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_push_struct_blob(&v, tmp_ctx, lp_iconv_convenience(ldb_get_opaque(sam_ctx, "loadparm")),
+ &reps->r[i],
+ (ndr_push_flags_fn_t)ndr_push_repsFromToBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ goto failed;
+ }
+
+ el->num_values++;
+ el->values[i] = v;
+ }
if (ldb_modify(sam_ctx, msg) != LDB_SUCCESS) {
DEBUG(0,("Failed to store repsTo - %s\n", ldb_errstring(sam_ctx)));
@@ -132,30 +159,24 @@ failed:
add a replication destination for a given partition GUID
*/
static WERROR uref_add_dest(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
- struct GUID *guid, struct repsToDest *dest)
+ struct GUID *guid, struct repsFromTo1 *dest)
{
struct repsTo reps;
WERROR werr;
- struct repsTov1 *rv1;
werr = uref_loadreps(sam_ctx, mem_ctx, guid, &reps);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
- if (reps.version != REPSTO_VERSION1) {
- DEBUG(0,("Wrong version number %u on disk\n",
- reps.version));
- return WERR_DS_DRA_INTERNAL_ERROR;
- }
-
- rv1 = &reps.ctr.r;
- rv1->reps = talloc_realloc(mem_ctx, rv1->reps, struct repsToDest, rv1->count+1);
- if (rv1->reps == NULL) {
+ reps.r = talloc_realloc(mem_ctx, reps.r, struct repsFromToBlob, reps.count+1);
+ if (reps.r == NULL) {
return WERR_DS_DRA_INTERNAL_ERROR;
}
- rv1->reps[rv1->count] = *dest;
- rv1->count++;
+ ZERO_STRUCT(reps.r[reps.count]);
+ reps.r[reps.count].version = 1;
+ reps.r[reps.count].ctr.ctr1 = *dest;
+ reps.count++;
werr = uref_savereps(sam_ctx, mem_ctx, guid, &reps);
if (!W_ERROR_IS_OK(werr)) {
@@ -173,7 +194,6 @@ static WERROR uref_del_dest(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
{
struct repsTo reps;
WERROR werr;
- struct repsTov1 *rv1;
int i;
werr = uref_loadreps(sam_ctx, mem_ctx, guid, &reps);
@@ -181,19 +201,12 @@ static WERROR uref_del_dest(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
return werr;
}
- if (reps.version != REPSTO_VERSION1) {
- DEBUG(0,("Wrong version number %u on disk\n", reps.version));
- return WERR_DS_DRA_INTERNAL_ERROR;
- }
-
- rv1 = &reps.ctr.r;
-
- for (i=0; i<rv1->count; i++) {
- if (GUID_compare(dest_guid, &rv1->reps[i].dest_guid) == 0) {
- if (i+1 < rv1->count) {
- memmove(&rv1->reps[i], &rv1->reps[i+1], sizeof(rv1->reps[i])*(rv1->count-(i+1)));
+ for (i=0; i<reps.count; i++) {
+ if (GUID_compare(dest_guid, &reps.r[i].ctr.ctr1.source_dsa_obj_guid) == 0) {
+ if (i+1 < reps.count) {
+ memmove(&reps.r[i], &reps.r[i+1], sizeof(reps.r[i])*(reps.count-(i+1)));
}
- rv1->count--;
+ reps.count--;
}
}
@@ -248,16 +261,21 @@ WERROR dcesrv_drsuapi_DsReplicaUpdateRefs(struct dcesrv_call_state *dce_call, TA
}
if (req->options & DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE) {
- struct repsToDest dest;
+ struct repsFromTo1 dest;
+ struct repsFromTo1OtherInfo oi;
+
+ ZERO_STRUCT(dest);
+ ZERO_STRUCT(oi);
- dest.dest_dsa_dns_name = req->dest_dsa_dns_name;
- dest.dest_guid = req->dest_dsa_guid;
- dest.options = req->options;
+ oi.dns_name = req->dest_dsa_dns_name;
+ dest.other_info = &oi;
+ dest.source_dsa_obj_guid = req->dest_dsa_guid;
+ dest.replica_flags = req->options;
werr = uref_add_dest(sam_ctx, mem_ctx, &req->naming_context->guid, &dest);
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("Failed to delete repsTo for %s\n",
- GUID_string(dce_call, &dest.dest_guid)));
+ GUID_string(dce_call, &dest.source_dsa_obj_guid)));
goto failed;
}
}