diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-09-23 17:34:32 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-10-04 15:08:56 +1100 |
commit | 761fd4af2e6cc3017bc95cc0edd0080d03ddc7f3 (patch) | |
tree | d856f4eb3eefc2b42902c4dc036145cc6d4a5961 /source4 | |
parent | f37e81bbc589bf10bb2399a9e4e7822a82e81b0e (diff) | |
download | samba-761fd4af2e6cc3017bc95cc0edd0080d03ddc7f3.tar.gz samba-761fd4af2e6cc3017bc95cc0edd0080d03ddc7f3.tar.bz2 samba-761fd4af2e6cc3017bc95cc0edd0080d03ddc7f3.zip |
s4-repl: update instanceType in partial_replica replication
when we receive objects to a partial replica, we need to change the
incoming instanceType to not include the INSTANCE_TYPE_WRITE
flag. Partial replicas unset this flag.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/repl/replicated_objects.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index f8c151787d..eb0d919e23 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -120,6 +120,7 @@ WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb, werr = dsdb_convert_object_ex(ldb, working_schema, pfm_remote, cur, gensec_skey, ignore_attids, + 0, tmp_ctx, &object); if (!W_ERROR_IS_OK(werr)) { DEBUG(4,("debug: Failed to convert schema object %s into ldb msg, will try during next loop\n", @@ -192,6 +193,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb, const struct drsuapi_DsReplicaObjectListItemEx *in, const DATA_BLOB *gensec_skey, const uint32_t *ignore_attids, + uint32_t dsdb_repl_flags, TALLOC_CTX *mem_ctx, struct dsdb_extended_replicated_object *out) { @@ -349,6 +351,21 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb, } + if (dsdb_repl_flags & DSDB_REPL_FLAG_PARTIAL_REPLICA) { + /* the instanceType type for partial_replica + replication is sent via DRS with TYPE_WRITE set, but + must be used on the client with TYPE_WRITE removed + */ + int instanceType = ldb_msg_find_attr_as_int(msg, "instanceType", 0); + if (instanceType & INSTANCE_TYPE_WRITE) { + instanceType &= ~INSTANCE_TYPE_WRITE; + ldb_msg_remove_attr(msg, "instanceType"); + if (ldb_msg_add_fmt(msg, "instanceType", "%d", instanceType) != LDB_SUCCESS) { + return WERR_INTERNAL_ERROR; + } + } + } + whenChanged_t = nt_time_to_unix(whenChanged); whenChanged_s = ldb_timestring(msg, whenChanged_t); W_ERROR_HAVE_NO_MEMORY(whenChanged_s); @@ -376,6 +393,7 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, const struct repsFromTo1 *source_dsa, const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector, const DATA_BLOB *gensec_skey, + uint32_t dsdb_repl_flags, TALLOC_CTX *mem_ctx, struct dsdb_extended_replicated_objects **objects) { @@ -389,6 +407,7 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, out = talloc_zero(mem_ctx, struct dsdb_extended_replicated_objects); W_ERROR_HAVE_NO_MEMORY(out); out->version = DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION; + out->dsdb_repl_flags = dsdb_repl_flags; /* * Ensure schema is kept valid for as long as 'out' @@ -448,6 +467,7 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb, status = dsdb_convert_object_ex(ldb, schema, pfm_remote, cur, gensec_skey, NULL, + dsdb_repl_flags, out->objects, &out->objects[i]); if (!W_ERROR_IS_OK(status)) { talloc_free(out); |