diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-09-28 11:04:29 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-10-04 15:08:57 +1100 |
commit | 60cbc98051b430fc09358a09866c69a54cc726bc (patch) | |
tree | 7b8568e7fbc1b1b32396ba537d952192f55631ff /source4/dsdb/repl | |
parent | fb937afbecb61896e8e8e56c19bbc193fc573e15 (diff) | |
download | samba-60cbc98051b430fc09358a09866c69a54cc726bc.tar.gz samba-60cbc98051b430fc09358a09866c69a54cc726bc.tar.bz2 samba-60cbc98051b430fc09358a09866c69a54cc726bc.zip |
s4-dsdb: added new control DSDB_MODIFY_PARTIAL_REPLICA
this control tells the partition module that the DN being created is a
partial replica, so it should modify the @PARTITION object to add the
partialReplica attribute
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/repl')
-rw-r--r-- | source4/dsdb/repl/replicated_objects.c | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index e1e6b0c926..5ccf052554 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -686,64 +686,6 @@ static WERROR dsdb_origin_object_convert(struct ldb_context *ldb, return WERR_OK; } -/* - create a new naming context via a DsAddEntry() with a nCName in a - crossRef object - */ -static WERROR dsdb_origin_create_NC(struct ldb_context *ldb, - struct ldb_dn *dn) -{ - TALLOC_CTX *tmp_ctx = talloc_new(ldb); - struct ldb_message *msg; - int ret; - - msg = ldb_msg_new(tmp_ctx); - W_ERROR_HAVE_NO_MEMORY_AND_FREE(msg, tmp_ctx); - - msg->dn = dn; - ret = ldb_msg_add_string(msg, "objectClass", "top"); - if (ret != LDB_SUCCESS) { - talloc_free(tmp_ctx); - return WERR_NOMEM; - } - - /* [MS-DRSR] implies that we should only add the 'top' - * objectclass, but that would cause lots of problems with our - * objectclass code as top is not structural, so we add - * 'domainDNS' as well to keep things sane. We're expecting - * this new NC to be of objectclass domainDNS after - * replication anyway - */ - ret = ldb_msg_add_string(msg, "objectClass", "domainDNS"); - if (ret != LDB_SUCCESS) { - talloc_free(tmp_ctx); - return WERR_NOMEM; - } - - ret = ldb_msg_add_fmt(msg, "instanceType", "%u", - INSTANCE_TYPE_IS_NC_HEAD| - INSTANCE_TYPE_NC_ABOVE| - INSTANCE_TYPE_UNINSTANT); - if (ret != LDB_SUCCESS) { - talloc_free(tmp_ctx); - return WERR_NOMEM; - } - - ret = dsdb_add(ldb, msg, 0); - if (ret != LDB_SUCCESS) { - DEBUG(0,("Failed to create new NC for %s - %s\n", - ldb_dn_get_linearized(dn), ldb_errstring(ldb))); - talloc_free(tmp_ctx); - return WERR_NOMEM; - } - - DEBUG(1,("Created new NC for %s\n", ldb_dn_get_linearized(dn))); - - talloc_free(tmp_ctx); - return WERR_OK; -} - - WERROR dsdb_origin_objects_commit(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const struct drsuapi_DsReplicaObjectListItem *first_object, @@ -825,8 +767,9 @@ WERROR dsdb_origin_objects_commit(struct ldb_context *ldb, if (!ldb_dn_validate(nc_dn)) { continue; } - status = dsdb_origin_create_NC(ldb, nc_dn); - if (!W_ERROR_IS_OK(status)) { + ret = dsdb_create_partial_replica_NC(ldb, nc_dn); + if (ret != LDB_SUCCESS) { + status = WERR_DS_INTERNAL_FAILURE; goto cancel; } } |