diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-10 03:45:22 +0200 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-11 18:54:20 +0000 |
commit | 0868a1598220e2ed73aefcd9ec3517a38704ac9e (patch) | |
tree | 804d2ba5dff399ae0dd726c2a982589e73b5545b | |
parent | 2d0cb54ceb8f568f233533ada007822ffb40ee3d (diff) | |
download | samba-0868a1598220e2ed73aefcd9ec3517a38704ac9e.tar.gz samba-0868a1598220e2ed73aefcd9ec3517a38704ac9e.tar.bz2 samba-0868a1598220e2ed73aefcd9ec3517a38704ac9e.zip |
s4-repl: Propagate remote prefixMap in DRSUAPI data conversion functions
-rw-r--r-- | source4/dsdb/repl/replicated_objects.c | 22 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 2 | ||||
-rw-r--r-- | source4/libnet/libnet_vampire.c | 11 |
3 files changed, 31 insertions, 4 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index 5e18277629..58243349b9 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -33,6 +33,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb, const struct dsdb_schema *schema, + const struct dsdb_schema_prefixmap *pfm_remote, const struct drsuapi_DsReplicaObjectListItemEx *in, const DATA_BLOB *gensec_skey, TALLOC_CTX *mem_ctx, @@ -127,7 +128,8 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb, W_ERROR_NOT_OK_RETURN(status); } - status = dsdb_attribute_drsuapi_to_ldb(ldb, schema, a, msg->elements, e); + status = dsdb_attribute_drsuapi_to_ldb(ldb, schema, pfm_remote, + a, msg->elements, e); W_ERROR_NOT_OK_RETURN(status); m->attid = a->attid; @@ -212,6 +214,7 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, WERROR status; struct ldb_dn *partition_dn; const struct dsdb_schema *schema; + struct dsdb_schema_prefixmap *pfm_remote; struct dsdb_extended_replicated_objects *out; const struct drsuapi_DsReplicaObjectListItemEx *cur; uint32_t i; @@ -230,6 +233,15 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, partition_dn = ldb_dn_new(out, ldb, partition_dn_str); W_ERROR_HAVE_NO_MEMORY_AND_FREE(partition_dn, out); + status = dsdb_schema_pfm_from_drsuapi_pfm(mapping_ctr, true, + out, &pfm_remote, NULL); + if (!W_ERROR_IS_OK(status)) { + DEBUG(0,(__location__ ": Failed to decode remote prefixMap: %s", + win_errstr(status))); + talloc_free(out); + return status; + } + if (ldb_dn_compare(partition_dn, ldb_get_schema_basedn(ldb)) != 0) { /* * check for schema changes in case @@ -266,7 +278,7 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, return WERR_FOOBAR; } - status = dsdb_convert_object_ex(ldb, schema, + status = dsdb_convert_object_ex(ldb, schema, pfm_remote, cur, gensec_skey, out->objects, &out->objects[i]); if (!W_ERROR_IS_OK(status)) { @@ -282,6 +294,9 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, return WERR_FOOBAR; } + /* free pfm_remote, we won't need it anymore */ + talloc_free(pfm_remote); + *objects = out; return WERR_OK; } @@ -392,7 +407,8 @@ static WERROR dsdb_origin_object_convert(struct ldb_context *ldb, a = &in->object.attribute_ctr.attributes[i]; e = &msg->elements[i]; - status = dsdb_attribute_drsuapi_to_ldb(ldb, schema, a, msg->elements, e); + status = dsdb_attribute_drsuapi_to_ldb(ldb, schema, schema->prefixmap, + a, msg->elements, e); W_ERROR_NOT_OK_RETURN(status); } diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index bdc78d20b0..0d1d274519 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -2586,6 +2586,7 @@ const struct dsdb_syntax *dsdb_syntax_for_attribute(const struct dsdb_attribute WERROR dsdb_attribute_drsuapi_to_ldb(struct ldb_context *ldb, const struct dsdb_schema *schema, + const struct dsdb_schema_prefixmap *pfm_remote, const struct drsuapi_DsReplicaAttribute *in, TALLOC_CTX *mem_ctx, struct ldb_message_element *out) @@ -2601,6 +2602,7 @@ WERROR dsdb_attribute_drsuapi_to_ldb(struct ldb_context *ldb, /* use default syntax conversion context */ dsdb_syntax_ctx_init(&syntax_ctx, ldb, schema); + syntax_ctx.pfm_remote = pfm_remote; return sa->syntax->drsuapi_to_ldb(&syntax_ctx, sa, in, mem_ctx, out); } diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index cb89213fcf..164dcdec76 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -225,6 +225,7 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s }; WERROR status; + struct dsdb_schema_prefixmap *pfm_remote; const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr; struct schema_list *schema_list = NULL, *schema_list_item, *schema_list_next_item; struct dsdb_schema *working_schema; @@ -280,6 +281,14 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s return NT_STATUS_INVALID_PARAMETER; } + status = dsdb_schema_pfm_from_drsuapi_pfm(mapping_ctr, true, + s, &pfm_remote, NULL); + if (!W_ERROR_IS_OK(status)) { + DEBUG(0,(__location__ ": Failed to decode remote prefixMap: %s", + win_errstr(status))); + return werror_to_ntstatus(status); + } + s_dsa->replica_flags = DRSUAPI_DRS_WRIT_REP | DRSUAPI_DRS_INIT_SYNC | DRSUAPI_DRS_PER_SYNC; @@ -338,7 +347,7 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s * schema we have so far. It's ok if we fail to convert * an object. We should convert more objects on next pass. */ - status = dsdb_convert_object_ex(s->ldb, working_schema, + status = dsdb_convert_object_ex(s->ldb, working_schema, pfm_remote, cur, c->gensec_skey, tmp_ctx, &object); if (!W_ERROR_IS_OK(status)) { |