+ 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;
+ }
+ }
+ }
+