[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Wed Sep 15 15:23:34 MDT 2010


The branch, master has been updated
       via  3b87e3e s4-repl: if we are an RODC don't set WRIT_REP in replication
       via  05ec123 s4-repl: add partial attribute set to getncchanges calls for RODCs
       via  520252c s4-repl: added min_usn to extended replication call
       via  1da147e s4-repl: added repl_secret handling
       via  d5673b5 s4-repl: cleanup the extended op calls in repl server
       via  aabd89d s4-pyjoin: use new pynet finddc interface
       via  2edbf74 s4-pynet: return the full netlogon response from python finddc
       via  e18c003 s4-pyjoin: fill in the dns name in the python replication method
       via  e2b6d17 s4-drs: get lpcfg_dnsdomain() instead of lpcfg_realm()
       via  e5ac820 s4-pyrpc: added py_return_ndr_struct()
       via  f89f3cf s4-repl: split out the extended op handling
       via  54b5370 s4-repl: cleanup getncchanges extended op calls
      from  7f1db0d s4-drs: Wait DsReplicaSync for as long as it takes to complete

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3b87e3e95179c527a7fce7e5ed6cb1d33345a2ff
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 20:54:09 2010 +1000

    s4-repl: if we are an RODC don't set WRIT_REP in replication
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 05ec123b3b159dade51980f3c4bf8662502bb38e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 20:24:50 2010 +1000

    s4-repl: add partial attribute set to getncchanges calls for RODCs
    
    when we are a RODC we must supply a partial attribute set in the
    getncchanges call
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 520252c8d2b7465d592a05ee68bd466e71330a1f
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 20:23:47 2010 +1000

    s4-repl: added min_usn to extended replication call
    
    the repl_secret code needs to set it to avoid too many duplicate
    attributes
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 1da147e6fa485800d2988168889071d97e393fa3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 19:00:01 2010 +1000

    s4-repl: added repl_secret handling
    
    initiate a repl secret extended op when requested
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit d5673b5501225e295bae2a5c0084cf3ce5582dca
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 18:59:17 2010 +1000

    s4-repl: cleanup the extended op calls in repl server
    
    - use generic parameter names
    - trigger a run of pending ops on all extended ops
    - don't prevent parallel fsmo transfers
    - moved extended op code into drepl_extended

commit aabd89d8f7d80d614c941111d7a049f9f35b943b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 18:52:11 2010 +1000

    s4-pyjoin: use new pynet finddc interface
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 2edbf74f35a49e5793ee2621061856e1167b41a0
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 18:51:09 2010 +1000

    s4-pynet: return the full netlogon response from python finddc
    
    this gives the caller the other server parameters
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit e18c0030e065a70f7291eb269112e9f04d5788dc
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 18:50:09 2010 +1000

    s4-pyjoin: fill in the dns name in the python replication method
    
    this is needed to get the repsFrom DNS entry right
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit e2b6d171d427f9899be8a1bb6781fd09c0094385
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 18:49:34 2010 +1000

    s4-drs: get lpcfg_dnsdomain() instead of lpcfg_realm()
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit e5ac820b9ea8416537b65faaf43fdc45924a66b1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 18:49:06 2010 +1000

    s4-pyrpc: added py_return_ndr_struct()
    
    This can be used to return structures from other python interfaces as
    python objects
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit f89f3cf30fad625d03de600b85e542791125c8f5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 16:19:26 2010 +1000

    s4-repl: split out the extended op handling
    
    this is not part of the rid allocation logic
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 54b53704747f45757642c9d4a17645ac777dc9ea
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Sep 15 16:15:12 2010 +1000

    s4-repl: cleanup getncchanges extended op calls
    
    Multiple calls are allowed to run in parallel as long as they don't
    conflict.
    
    This also cleans up the variable names in the extended op calls.
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/repl/drepl_extended.c        |  174 +++++++++++++++++++++++++++++
 source4/dsdb/repl/drepl_fsmo.c            |   16 +--
 source4/dsdb/repl/drepl_out_helpers.c     |   68 ++++++++++-
 source4/dsdb/repl/drepl_out_pull.c        |    2 +-
 source4/dsdb/repl/drepl_ridalloc.c        |  121 ++------------------
 source4/dsdb/repl/drepl_secret.c          |  137 +++++++++++++++++++++++
 source4/dsdb/repl/drepl_service.c         |   21 +++-
 source4/dsdb/repl/drepl_service.h         |   17 ++--
 source4/dsdb/wscript_build                |    2 +-
 source4/libnet/libnet_vampire.c           |    3 +
 source4/libnet/py_net.c                   |   17 ++-
 source4/librpc/rpc/pyrpc_util.c           |   31 +++++
 source4/librpc/rpc/pyrpc_util.h           |    3 +
 source4/rpc_server/drsuapi/getncchanges.c |    2 +-
 source4/scripting/python/samba/join.py    |    5 +-
 15 files changed, 466 insertions(+), 153 deletions(-)
 create mode 100644 source4/dsdb/repl/drepl_extended.c
 create mode 100644 source4/dsdb/repl/drepl_secret.c


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/repl/drepl_extended.c b/source4/dsdb/repl/drepl_extended.c
new file mode 100644
index 0000000..de56cb5
--- /dev/null
+++ b/source4/dsdb/repl/drepl_extended.c
@@ -0,0 +1,174 @@
+/*
+   Unix SMB/CIFS mplementation.
+
+   DSDB replication service - extended operation code
+
+   Copyright (C) Andrew Tridgell 2010
+   Copyright (C) Andrew Bartlett 2010
+   Copyright (C) Nadezhda Ivanova 2010
+
+   based on drepl_notify.c
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "includes.h"
+#include "ldb_module.h"
+#include "dsdb/samdb/samdb.h"
+#include "smbd/service.h"
+#include "dsdb/repl/drepl_service.h"
+#include "param/param.h"
+
+
+/*
+  create the role owner source dsa structure
+
+  nc_dn: the DN of the subtree being replicated
+  source_dsa_dn: the DN of the server that we are replicating from
+ */
+static WERROR drepl_create_extended_source_dsa(struct dreplsrv_service *service,
+					       struct ldb_dn *nc_dn,
+					       struct ldb_dn *source_dsa_dn,
+					       uint64_t min_usn,
+					       struct dreplsrv_partition_source_dsa **_sdsa)
+{
+	struct dreplsrv_partition_source_dsa *sdsa;
+	struct ldb_context *ldb = service->samdb;
+	int ret;
+	WERROR werr;
+
+	sdsa = talloc_zero(service, struct dreplsrv_partition_source_dsa);
+	W_ERROR_HAVE_NO_MEMORY(sdsa);
+
+	sdsa->partition = talloc_zero(sdsa, struct dreplsrv_partition);
+	if (!sdsa->partition) {
+		talloc_free(sdsa);
+		return WERR_NOMEM;
+	}
+
+	sdsa->partition->dn = ldb_dn_copy(sdsa->partition, nc_dn);
+	if (!sdsa->partition->dn) {
+		talloc_free(sdsa);
+		return WERR_NOMEM;
+	}
+	sdsa->partition->nc.dn = ldb_dn_alloc_linearized(sdsa->partition, nc_dn);
+	if (!sdsa->partition->nc.dn) {
+		talloc_free(sdsa);
+		return WERR_NOMEM;
+	}
+	ret = dsdb_find_guid_by_dn(ldb, nc_dn, &sdsa->partition->nc.guid);
+	if (ret != LDB_SUCCESS) {
+		DEBUG(0,(__location__ ": Failed to find GUID for %s\n",
+			 ldb_dn_get_linearized(nc_dn)));
+		talloc_free(sdsa);
+		return WERR_DS_DRA_INTERNAL_ERROR;
+	}
+
+	sdsa->repsFrom1 = &sdsa->_repsFromBlob.ctr.ctr1;
+	ret = dsdb_find_guid_by_dn(ldb, source_dsa_dn, &sdsa->repsFrom1->source_dsa_obj_guid);
+	if (ret != LDB_SUCCESS) {
+		DEBUG(0,(__location__ ": Failed to find objectGUID for %s\n",
+			 ldb_dn_get_linearized(source_dsa_dn)));
+		talloc_free(sdsa);
+		return WERR_DS_DRA_INTERNAL_ERROR;
+	}
+
+	sdsa->repsFrom1->other_info = talloc_zero(sdsa, struct repsFromTo1OtherInfo);
+	if (!sdsa->repsFrom1->other_info) {
+		talloc_free(sdsa);
+		return WERR_NOMEM;
+	}
+
+	sdsa->repsFrom1->other_info->dns_name =
+		talloc_asprintf(sdsa->repsFrom1->other_info, "%s._msdcs.%s",
+				GUID_string(sdsa->repsFrom1->other_info, &sdsa->repsFrom1->source_dsa_obj_guid),
+				lpcfg_dnsdomain(service->task->lp_ctx));
+	if (!sdsa->repsFrom1->other_info->dns_name) {
+		talloc_free(sdsa);
+		return WERR_NOMEM;
+	}
+
+	sdsa->repsFrom1->highwatermark.highest_usn = min_usn;
+
+	werr = dreplsrv_out_connection_attach(service, sdsa->repsFrom1, &sdsa->conn);
+	if (!W_ERROR_IS_OK(werr)) {
+		DEBUG(0,(__location__ ": Failed to attach connection to %s\n",
+			 ldb_dn_get_linearized(nc_dn)));
+		talloc_free(sdsa);
+		return werr;
+	}
+
+	*_sdsa = sdsa;
+	return WERR_OK;
+}
+
+struct extended_op_data {
+	dreplsrv_extended_callback_t callback;
+	void *callback_data;
+	struct dreplsrv_partition_source_dsa *sdsa;
+};
+
+/*
+  called when an extended op finishes
+ */
+static void extended_op_callback(struct dreplsrv_service *service,
+				 WERROR err,
+				 enum drsuapi_DsExtendedError exop_error,
+				 void *cb_data)
+{
+	struct extended_op_data *data = talloc_get_type_abort(cb_data, struct extended_op_data);
+	talloc_free(data->sdsa);
+	data->callback(service, err, exop_error, data->callback_data);
+	talloc_free(data);
+}
+
+/*
+  schedule a getncchanges request to the role owner for an extended operation
+ */
+WERROR drepl_request_extended_op(struct dreplsrv_service *service,
+				 struct ldb_dn *nc_dn,
+				 struct ldb_dn *source_dsa_dn,
+				 enum drsuapi_DsExtendedOperation extended_op,
+				 uint64_t fsmo_info,
+				 uint64_t min_usn,
+				 dreplsrv_extended_callback_t callback,
+				 void *callback_data)
+{
+	WERROR werr;
+	struct extended_op_data *data;
+	struct dreplsrv_partition_source_dsa *sdsa;
+
+	werr = drepl_create_extended_source_dsa(service, nc_dn, source_dsa_dn, min_usn, &sdsa);
+	W_ERROR_NOT_OK_RETURN(werr);
+
+	data = talloc(service, struct extended_op_data);
+	W_ERROR_HAVE_NO_MEMORY(data);
+
+	data->callback = callback;
+	data->callback_data = callback_data;
+	data->sdsa = sdsa;
+
+	werr = dreplsrv_schedule_partition_pull_source(service, sdsa,
+						       extended_op, fsmo_info,
+						       extended_op_callback, data);
+	if (!W_ERROR_IS_OK(werr)) {
+		talloc_free(sdsa);
+		talloc_free(data);
+	}
+
+	dreplsrv_run_pending_ops(service);
+
+	return werr;
+}
diff --git a/source4/dsdb/repl/drepl_fsmo.c b/source4/dsdb/repl/drepl_fsmo.c
index a389c39..375e37b 100644
--- a/source4/dsdb/repl/drepl_fsmo.c
+++ b/source4/dsdb/repl/drepl_fsmo.c
@@ -43,9 +43,6 @@ static void drepl_role_callback(struct dreplsrv_service *service,
 	} else {
 		DEBUG(0,(__location__ ": Successful role transfer\n"));
 	}
-	talloc_free(service->ncchanges_extended.role_owner_source_dsa);
-	service->ncchanges_extended.role_owner_source_dsa = NULL;
-	service->ncchanges_extended.in_progress = false;
 }
 
 static bool fsmo_master_cmp(struct ldb_dn *ntds_dn, struct ldb_dn *role_owner_dn)
@@ -67,15 +64,10 @@ WERROR dreplsrv_fsmo_role_check(struct dreplsrv_service *service,
 	TALLOC_CTX *tmp_ctx = talloc_new(service);
 	struct ldb_context *ldb = service->samdb;
 	int ret;
-	uint64_t alloc_pool = 0;
+	uint64_t fsmo_info = 0;
 	enum drsuapi_DsExtendedOperation extended_op = DRSUAPI_EXOP_NONE;
 	WERROR werr;
 
-	if (service->ncchanges_extended.in_progress) {
-		talloc_free(tmp_ctx);
-		return WERR_OK;
-	}
-
 	ntds_dn = samdb_ntds_settings_dn(ldb);
 	if (!ntds_dn) {
 		return WERR_DS_DRA_INTERNAL_ERROR;
@@ -158,8 +150,10 @@ WERROR dreplsrv_fsmo_role_check(struct dreplsrv_service *service,
 					 fsmo_role_dn,
 					 role_owner_dn,
 					 extended_op,
-					 alloc_pool,
-					 drepl_role_callback);
+					 fsmo_info,
+					 0,
+					 drepl_role_callback,
+					 NULL);
 	if (W_ERROR_IS_OK(werr)) {
 		dreplsrv_run_pending_ops(service);
 	} else {
diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c
index 8ffa832..60c4a66 100644
--- a/source4/dsdb/repl/drepl_out_helpers.c
+++ b/source4/dsdb/repl/drepl_out_helpers.c
@@ -260,6 +260,43 @@ static void dreplsrv_op_pull_source_connect_done(struct tevent_req *subreq)
 
 static void dreplsrv_op_pull_source_get_changes_done(struct tevent_req *subreq);
 
+/*
+  get a partial attribute set for a replication call
+ */
+static NTSTATUS dreplsrv_get_rodc_partial_attribute_set(struct dreplsrv_service *service,
+							TALLOC_CTX *mem_ctx,
+							struct drsuapi_DsPartialAttributeSet **_pas,
+							bool for_schema)
+{
+	struct drsuapi_DsPartialAttributeSet *pas;
+	struct dsdb_schema *schema;
+	int i;
+
+	pas = talloc_zero(mem_ctx, struct drsuapi_DsPartialAttributeSet);
+	NT_STATUS_HAVE_NO_MEMORY(pas);
+
+	schema = dsdb_get_schema(service->samdb, NULL);
+
+	pas->version = 1;
+	pas->attids = talloc_array(pas, enum drsuapi_DsAttributeId, schema->num_attributes);
+	NT_STATUS_HAVE_NO_MEMORY_AND_FREE(pas->attids, pas);
+
+	for (i=0; i<schema->num_attributes; i++) {
+		struct dsdb_attribute *a;
+		a = schema->attributes_by_attributeID_id[i];
+                if (a->systemFlags & (DS_FLAG_ATTR_NOT_REPLICATED | DS_FLAG_ATTR_IS_CONSTRUCTED)) {
+			continue;
+		}
+		if (a->searchFlags & SEARCH_FLAG_RODC_ATTRIBUTE) {
+			continue;
+		}
+		pas->attids[pas->num_attids] = dsdb_attribute_get_attid(a, for_schema);
+		pas->num_attids++;
+	}
+	*_pas = pas;
+	return NT_STATUS_OK;
+}
+
 static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
 {
 	struct dreplsrv_op_pull_source_state *state = tevent_req_data(req,
@@ -271,6 +308,9 @@ static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
 	struct drsuapi_DsGetNCChanges *r;
 	struct drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
 	struct tevent_req *subreq;
+	struct drsuapi_DsPartialAttributeSet *pas = NULL;
+	NTSTATUS status;
+	uint32_t replica_flags;
 
 	if ((rf1->replica_flags & DRSUAPI_DRS_WRIT_REP) == 0 &&
 	    state->op->extended_op == DRSUAPI_EXOP_NONE) {
@@ -301,6 +341,23 @@ static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
 		uptodateness_vector = &partition->uptodatevector_ex;
 	}
 
+	replica_flags = rf1->replica_flags;
+
+	if (service->am_rodc) {
+		bool for_schema = false;
+		if (ldb_dn_compare_base(ldb_get_schema_basedn(service->samdb), partition->dn) == 0) {
+			for_schema = true;
+		}
+
+		status = dreplsrv_get_rodc_partial_attribute_set(service, r, &pas, for_schema);
+		if (!NT_STATUS_IS_OK(status)) {
+			DEBUG(0,(__location__ ": Failed to construct partial attribute set : %s\n", nt_errstr(status)));
+			return;
+		}
+
+		replica_flags &= ~DRSUAPI_DRS_WRIT_REP;
+	}
+
 	r->in.bind_handle	= &drsuapi->bind_handle;
 	if (drsuapi->remote_info28.supported_extensions & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) {
 		r->in.level				= 8;
@@ -309,12 +366,12 @@ static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
 		r->in.req->req8.naming_context		= &partition->nc;
 		r->in.req->req8.highwatermark		= rf1->highwatermark;
 		r->in.req->req8.uptodateness_vector	= uptodateness_vector;
-		r->in.req->req8.replica_flags		= rf1->replica_flags;
+		r->in.req->req8.replica_flags		= replica_flags;
 		r->in.req->req8.max_object_count	= 133;
 		r->in.req->req8.max_ndr_size		= 1336811;
 		r->in.req->req8.extended_op		= state->op->extended_op;
 		r->in.req->req8.fsmo_info		= state->op->fsmo_info;
-		r->in.req->req8.partial_attribute_set	= NULL;
+		r->in.req->req8.partial_attribute_set	= pas;
 		r->in.req->req8.partial_attribute_set_ex= NULL;
 		r->in.req->req8.mapping_ctr.num_mappings= 0;
 		r->in.req->req8.mapping_ctr.mappings	= NULL;
@@ -325,7 +382,7 @@ static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
 		r->in.req->req5.naming_context		= &partition->nc;
 		r->in.req->req5.highwatermark		= rf1->highwatermark;
 		r->in.req->req5.uptodateness_vector	= uptodateness_vector;
-		r->in.req->req5.replica_flags		= rf1->replica_flags;
+		r->in.req->req5.replica_flags		= replica_flags;
 		r->in.req->req5.max_object_count	= 133;
 		r->in.req->req5.max_ndr_size		= 1336770;
 		r->in.req->req5.extended_op		= state->op->extended_op;
@@ -566,8 +623,6 @@ static void dreplsrv_update_refs_trigger(struct tevent_req *req)
 	char *ntds_guid_str;
 	char *ntds_dns_name;
 	struct tevent_req *subreq;
-	bool am_rodc;
-	int ret;
 
 	r = talloc(state, struct drsuapi_DsReplicaUpdateRefs);
 	if (tevent_req_nomem(r, req)) {
@@ -592,8 +647,7 @@ static void dreplsrv_update_refs_trigger(struct tevent_req *req)
 	r->in.req.req1.dest_dsa_dns_name  = ntds_dns_name;
 	r->in.req.req1.dest_dsa_guid	  = service->ntds_guid;
 	r->in.req.req1.options	          = DRSUAPI_DRS_ADD_REF | DRSUAPI_DRS_DEL_REF;
-	ret = samdb_rodc(service->samdb, &am_rodc);
-	if (ret == LDB_SUCCESS && !am_rodc) {
+	if (!service->am_rodc) {
 		r->in.req.req1.options |= DRSUAPI_DRS_WRIT_REP;
 	}
 
diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c
index 21f986a..c13dadc 100644
--- a/source4/dsdb/repl/drepl_out_pull.c
+++ b/source4/dsdb/repl/drepl_out_pull.c
@@ -38,7 +38,7 @@ WERROR dreplsrv_schedule_partition_pull_source(struct dreplsrv_service *s,
 					       struct dreplsrv_partition_source_dsa *source,
 					       enum drsuapi_DsExtendedOperation extended_op,
 					       uint64_t fsmo_info,
-					       dreplsrv_fsmo_callback_t callback,
+					       dreplsrv_extended_callback_t callback,
 					       void *cb_data)
 {
 	struct dreplsrv_out_operation *op;
diff --git a/source4/dsdb/repl/drepl_ridalloc.c b/source4/dsdb/repl/drepl_ridalloc.c
index 4484316..48c208c 100644
--- a/source4/dsdb/repl/drepl_ridalloc.c
+++ b/source4/dsdb/repl/drepl_ridalloc.c
@@ -30,108 +30,6 @@
 #include "dsdb/repl/drepl_service.h"
 #include "param/param.h"
 
-
-/*
-  create the role owner source dsa structure
- */
-
-WERROR drepl_create_role_owner_source_dsa(struct dreplsrv_service *service,
-					  struct ldb_dn *fsmo_role_dn,
-					  struct ldb_dn *role_owner_dn)
-{
-	struct dreplsrv_partition_source_dsa *sdsa;
-	struct ldb_context *ldb = service->samdb;
-	int ret;
-	WERROR werr;
-
-	sdsa = talloc_zero(service, struct dreplsrv_partition_source_dsa);
-	W_ERROR_HAVE_NO_MEMORY(sdsa);
-
-	sdsa->partition = talloc_zero(sdsa, struct dreplsrv_partition);
-	if (!sdsa->partition) {
-		talloc_free(sdsa);
-		return WERR_NOMEM;
-	}
-
-	sdsa->partition->dn = ldb_dn_copy(sdsa->partition, fsmo_role_dn);
-	if (!sdsa->partition->dn) {
-		talloc_free(sdsa);
-		return WERR_NOMEM;
-	}
-	sdsa->partition->nc.dn = ldb_dn_alloc_linearized(sdsa->partition, fsmo_role_dn);
-	if (!sdsa->partition->nc.dn) {
-		talloc_free(sdsa);
-		return WERR_NOMEM;
-	}
-	ret = dsdb_find_guid_by_dn(ldb, fsmo_role_dn, &sdsa->partition->nc.guid);
-	if (ret != LDB_SUCCESS) {
-		DEBUG(0,(__location__ ": Failed to find GUID for %s\n",
-			 ldb_dn_get_linearized(fsmo_role_dn)));
-		talloc_free(sdsa);
-		return WERR_DS_DRA_INTERNAL_ERROR;
-	}
-
-	sdsa->repsFrom1 = &sdsa->_repsFromBlob.ctr.ctr1;
-	ret = dsdb_find_guid_by_dn(ldb, role_owner_dn, &sdsa->repsFrom1->source_dsa_obj_guid);
-	if (ret != LDB_SUCCESS) {
-		DEBUG(0,(__location__ ": Failed to find objectGUID for %s\n",
-			 ldb_dn_get_linearized(role_owner_dn)));
-		talloc_free(sdsa);
-		return WERR_DS_DRA_INTERNAL_ERROR;
-	}
-
-	sdsa->repsFrom1->other_info = talloc_zero(sdsa, struct repsFromTo1OtherInfo);
-	if (!sdsa->repsFrom1->other_info) {
-		talloc_free(sdsa);
-		return WERR_NOMEM;
-	}
-
-	sdsa->repsFrom1->other_info->dns_name =
-		talloc_asprintf(sdsa->repsFrom1->other_info, "%s._msdcs.%s",
-				GUID_string(sdsa->repsFrom1->other_info, &sdsa->repsFrom1->source_dsa_obj_guid),
-				lpcfg_dnsdomain(service->task->lp_ctx));
-	if (!sdsa->repsFrom1->other_info->dns_name) {
-		talloc_free(sdsa);
-		return WERR_NOMEM;
-	}
-
-
-	werr = dreplsrv_out_connection_attach(service, sdsa->repsFrom1, &sdsa->conn);
-	if (!W_ERROR_IS_OK(werr)) {
-		DEBUG(0,(__location__ ": Failed to attach connection to %s\n",
-			 ldb_dn_get_linearized(fsmo_role_dn)));
-		talloc_free(sdsa);
-		return werr;
-	}
-
-	service->ncchanges_extended.role_owner_source_dsa = sdsa;
-	return WERR_OK;
-}
-
-/*
-  schedule a getncchanges request to the role owner for an extended operation
- */
-WERROR drepl_request_extended_op(struct dreplsrv_service *service,
-				 struct ldb_dn *fsmo_role_dn,
-				 struct ldb_dn *role_owner_dn,
-				 enum drsuapi_DsExtendedOperation extended_op,
-				 uint64_t alloc_pool,
-				 dreplsrv_fsmo_callback_t callback)
-{
-	WERROR werr;
-	if (service->ncchanges_extended.role_owner_source_dsa == NULL) {
-		/* we need to establish a connection to the role owner */
-		werr = drepl_create_role_owner_source_dsa(service, fsmo_role_dn, role_owner_dn);
-		W_ERROR_NOT_OK_RETURN(werr);
-	}
-
-	service->ncchanges_extended.in_progress = true;
-	werr = dreplsrv_schedule_partition_pull_source(service, service->ncchanges_extended.role_owner_source_dsa,
-						       extended_op, alloc_pool,
-						       callback, NULL);
-	return werr;
-}
-
 /*
   called when a rid allocation request has completed
  */
@@ -147,11 +45,7 @@ static void drepl_new_rid_pool_callback(struct dreplsrv_service *service,
 		DEBUG(3,(__location__ ": RID Manager completed RID allocation OK\n"));
 	}
 
-	/* don't keep the connection open to the RID Manager */
-	talloc_free(service->ncchanges_extended.role_owner_source_dsa);
-	service->ncchanges_extended.role_owner_source_dsa = NULL;
-
-	service->ncchanges_extended.in_progress = false;
+	service->rid_alloc_in_progress = false;
 }
 
 /*
@@ -167,7 +61,11 @@ static WERROR drepl_request_new_rid_pool(struct dreplsrv_service *service,
 						fsmo_role_dn,
 						DRSUAPI_EXOP_FSMO_RID_ALLOC,
 						alloc_pool,
-						drepl_new_rid_pool_callback);
+						0,
+						drepl_new_rid_pool_callback, NULL);
+	if (W_ERROR_IS_OK(werr)) {
+		service->rid_alloc_in_progress = true;
+	}
 	return werr;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list