[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Sun Nov 7 23:58:02 MST 2010


The branch, master has been updated
       via  11b4202 s4-repl: fixed replication notifications to RODCs
       via  2763ede fix
       via  ac0a92b s4-debug: lowered the debug level of some unimportant messages
      from  7bd5d40 s4-ldb: don't give an error if a module is already registered

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


- Log -----------------------------------------------------------------
commit 11b42022c7f1fe60ce0be0911f17a7ff70881986
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Nov 8 17:14:09 2010 +1100

    s4-repl: fixed replication notifications to RODCs
    
    We need a separate source dsa list for RODCs, as they are not in the
    repsFrom for our partitions, but are in the repsTo. This adds a new
    'notifies' list, which contains all the source dsas for the DCs that
    we should send notifies to, but which we don't replicate from
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Mon Nov  8 06:57:43 UTC 2010 on sn-devel-104

commit 2763ede39937f9a0df2c6d0edf8532ce5e6f3e39
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Nov 8 17:13:12 2010 +1100

    fix

commit ac0a92b5b325a3be968d2f7384c6a4a119d0ec84
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Nov 8 16:02:21 2010 +1100

    s4-debug: lowered the debug level of some unimportant messages

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

Summary of changes:
 source4/dsdb/kcc/kcc_periodic.c      |    4 +-
 source4/dsdb/repl/drepl_notify.c     |   14 ++++++++--
 source4/dsdb/repl/drepl_partitions.c |   47 ++++++++++++++++++++++++++++++---
 source4/dsdb/repl/drepl_periodic.c   |    6 ++--
 source4/dsdb/repl/drepl_service.h    |    6 ++++
 source4/libcli/dgram/dgramsocket.c   |    2 +-
 source4/nbt_server/dgram/browse.c    |    2 +-
 7 files changed, 66 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c
index b1e976b..fa2b067 100644
--- a/source4/dsdb/kcc/kcc_periodic.c
+++ b/source4/dsdb/kcc/kcc_periodic.c
@@ -428,7 +428,7 @@ WERROR kccsrv_periodic_schedule(struct kccsrv_service *service, uint32_t next_in
 	W_ERROR_HAVE_NO_MEMORY(new_te);
 
 	tmp_mem = talloc_new(service);
-	DEBUG(2,("kccsrv_periodic_schedule(%u) %sscheduled for: %s\n",
+	DEBUG(4,("kccsrv_periodic_schedule(%u) %sscheduled for: %s\n",
 		next_interval,
 		(service->periodic.te?"re":""),
 		nt_time_string(tmp_mem, timeval_to_nttime(&next_time))));
@@ -445,7 +445,7 @@ static void kccsrv_periodic_run(struct kccsrv_service *service)
 	TALLOC_CTX *mem_ctx;
 	NTSTATUS status;
 
-	DEBUG(2,("kccsrv_periodic_run(): simple update\n"));
+	DEBUG(4,("kccsrv_periodic_run(): simple update\n"));
 
 	mem_ctx = talloc_new(service);
 	status = kccsrv_simple_update(service, mem_ctx);
diff --git a/source4/dsdb/repl/drepl_notify.c b/source4/dsdb/repl/drepl_notify.c
index 836509b..0178e97 100644
--- a/source4/dsdb/repl/drepl_notify.c
+++ b/source4/dsdb/repl/drepl_notify.c
@@ -270,16 +270,24 @@ void dreplsrv_notify_run_ops(struct dreplsrv_service *s)
 /*
   find a source_dsa for a given guid
  */
-static struct dreplsrv_partition_source_dsa *dreplsrv_find_source_dsa(struct dreplsrv_partition *p,
+static struct dreplsrv_partition_source_dsa *dreplsrv_find_notify_dsa(struct dreplsrv_partition *p,
 								      struct GUID *guid)
 {
 	struct dreplsrv_partition_source_dsa *s;
 
+	/* first check the sources list */
 	for (s=p->sources; s; s=s->next) {
 		if (GUID_compare(&s->repsFrom1->source_dsa_obj_guid, guid) == 0) {
 			return s;
 		}
 	}
+
+	/* then the notifies list */
+	for (s=p->notifies; s; s=s->next) {
+		if (GUID_compare(&s->repsFrom1->source_dsa_obj_guid, guid) == 0) {
+			return s;
+		}
+	}
 	return NULL;
 }
 
@@ -298,7 +306,7 @@ static WERROR dreplsrv_schedule_notify_sync(struct dreplsrv_service *service,
 	struct dreplsrv_notify_operation *op;
 	struct dreplsrv_partition_source_dsa *s;
 
-	s = dreplsrv_find_source_dsa(p, &reps->ctr.ctr1.source_dsa_obj_guid);
+	s = dreplsrv_find_notify_dsa(p, &reps->ctr.ctr1.source_dsa_obj_guid);
 	if (s == NULL) {
 		DEBUG(0,(__location__ ": Unable to find source_dsa for %s\n",
 			 GUID_string(mem_ctx, &reps->ctr.ctr1.source_dsa_obj_guid)));
@@ -375,7 +383,7 @@ static WERROR dreplsrv_notify_check(struct dreplsrv_service *s,
 	for (i=0; i<count; i++) {
 		struct dreplsrv_partition_source_dsa *sdsa;
 		uint32_t replica_flags;
-		sdsa = dreplsrv_find_source_dsa(p, &reps[i].ctr.ctr1.source_dsa_obj_guid);
+		sdsa = dreplsrv_find_notify_dsa(p, &reps[i].ctr.ctr1.source_dsa_obj_guid);
 		replica_flags = reps[i].ctr.ctr1.replica_flags;
 		if (sdsa == NULL) continue;
 		if (sdsa->notify_uSN < uSNHighest) {
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c
index e272747..70173fe 100644
--- a/source4/dsdb/repl/drepl_partitions.c
+++ b/source4/dsdb/repl/drepl_partitions.c
@@ -209,8 +209,27 @@ WERROR dreplsrv_out_connection_attach(struct dreplsrv_service *s,
 	return WERR_OK;
 }
 
+/*
+  find an existing source dsa in a list
+ */
+static struct dreplsrv_partition_source_dsa *dreplsrv_find_source_dsa(struct dreplsrv_partition_source_dsa *list,
+								      struct GUID *guid)
+{
+	struct dreplsrv_partition_source_dsa *s;
+	for (s=list; s; s=s->next) {
+		if (GUID_compare(&s->repsFrom1->source_dsa_obj_guid, guid) == 0) {
+			return s;
+		}
+	}
+	return NULL;	
+}
+
+
+
 static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
 						struct dreplsrv_partition *p,
+						struct dreplsrv_partition_source_dsa **listp,
+						struct dreplsrv_partition_source_dsa *check_list,
 						const struct ldb_val *val)
 {
 	WERROR status;
@@ -240,8 +259,15 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
 	status = dreplsrv_out_connection_attach(s, source->repsFrom1, &source->conn);
 	W_ERROR_NOT_OK_RETURN(status);
 
-	/* remove any existing source with the same GUID */
-	for (s2=p->sources; s2; s2=s2->next) {
+	if (check_list && 
+	    dreplsrv_find_source_dsa(check_list, &source->repsFrom1->source_dsa_obj_guid)) {
+		/* its in the check list, don't add it again */
+		talloc_free(source);
+		return WERR_OK;
+	}
+
+	/* re-use an existing source if found */
+	for (s2=*listp; s2; s2=s2->next) {
 		if (GUID_compare(&s2->repsFrom1->source_dsa_obj_guid, 
 				 &source->repsFrom1->source_dsa_obj_guid) == 0) {
 			talloc_free(s2->repsFrom1->other_info);
@@ -252,7 +278,7 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
 		}
 	}
 
-	DLIST_ADD_END(p->sources, source, struct dreplsrv_partition_source_dsa *);
+	DLIST_ADD_END(*listp, source, struct dreplsrv_partition_source_dsa *);
 	return WERR_OK;
 }
 
@@ -343,10 +369,11 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s,
 		"objectSid",
 		"objectGUID",
 		"repsFrom",
+		"repsTo",
 		NULL
 	};
 
-	DEBUG(2, ("dreplsrv_refresh_partition(%s)\n",
+	DEBUG(4, ("dreplsrv_refresh_partition(%s)\n",
 		ldb_dn_get_linearized(p->dn)));
 
 	ret = ldb_search(s->samdb, mem_ctx, &r, p->dn, LDB_SCOPE_BASE, attrs,
@@ -380,7 +407,17 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s,
 	orf_el = ldb_msg_find_element(r->msgs[0], "repsFrom");
 	if (orf_el) {
 		for (i=0; i < orf_el->num_values; i++) {
-			status = dreplsrv_partition_add_source_dsa(s, p, &orf_el->values[i]);
+			status = dreplsrv_partition_add_source_dsa(s, p, &p->sources, 
+								   NULL, &orf_el->values[i]);
+			W_ERROR_NOT_OK_RETURN(status);	
+		}
+	}
+
+	orf_el = ldb_msg_find_element(r->msgs[0], "repsTo");
+	if (orf_el) {
+		for (i=0; i < orf_el->num_values; i++) {
+			status = dreplsrv_partition_add_source_dsa(s, p, &p->notifies, 
+								   p->sources, &orf_el->values[i]);
 			W_ERROR_NOT_OK_RETURN(status);	
 		}
 	}
diff --git a/source4/dsdb/repl/drepl_periodic.c b/source4/dsdb/repl/drepl_periodic.c
index 9200606..60f3581 100644
--- a/source4/dsdb/repl/drepl_periodic.c
+++ b/source4/dsdb/repl/drepl_periodic.c
@@ -81,7 +81,7 @@ WERROR dreplsrv_periodic_schedule(struct dreplsrv_service *service, uint32_t nex
 	W_ERROR_HAVE_NO_MEMORY(new_te);
 
 	tmp_mem = talloc_new(service);
-	DEBUG(2,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n",
+	DEBUG(4,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n",
 		next_interval,
 		(service->periodic.te?"re":""),
 		nt_time_string(tmp_mem, timeval_to_nttime(&next_time))));
@@ -97,7 +97,7 @@ static void dreplsrv_periodic_run(struct dreplsrv_service *service)
 {
 	TALLOC_CTX *mem_ctx;
 
-	DEBUG(2,("dreplsrv_periodic_run(): schedule pull replication\n"));
+	DEBUG(4,("dreplsrv_periodic_run(): schedule pull replication\n"));
 
 	/*
 	 * KCC or some administrative tool
@@ -110,7 +110,7 @@ static void dreplsrv_periodic_run(struct dreplsrv_service *service)
 	dreplsrv_schedule_pull_replication(service, mem_ctx);
 	talloc_free(mem_ctx);
 
-	DEBUG(2,("dreplsrv_periodic_run(): run pending_ops memory=%u\n", 
+	DEBUG(4,("dreplsrv_periodic_run(): run pending_ops memory=%u\n", 
 		 (unsigned)talloc_total_blocks(service)));
 
 	dreplsrv_ridalloc_check_rid_pool(service);
diff --git a/source4/dsdb/repl/drepl_service.h b/source4/dsdb/repl/drepl_service.h
index ba1f195..9ad62fd 100644
--- a/source4/dsdb/repl/drepl_service.h
+++ b/source4/dsdb/repl/drepl_service.h
@@ -103,6 +103,12 @@ struct dreplsrv_partition {
 	 */
 	struct dreplsrv_partition_source_dsa *sources;
 
+	/*
+	 * a linked list of all source dsa's we will notify,
+	 * that are not also in sources
+	 */
+	struct dreplsrv_partition_source_dsa *notifies;
+
 	bool incoming_only;
 };
 
diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c
index 4dd1741..090e67a 100644
--- a/source4/libcli/dgram/dgramsocket.c
+++ b/source4/libcli/dgram/dgramsocket.c
@@ -61,7 +61,7 @@ static void dgm_socket_recv(struct nbt_dgram_socket *dgmsock)
 	}
 	blob.length = nread;
 
-	DEBUG(2,("Received dgram packet of length %d from %s:%d\n", 
+	DEBUG(5,("Received dgram packet of length %d from %s:%d\n", 
 		 (int)blob.length, src->addr, src->port));
 
 	packet = talloc(tmp_ctx, struct nbt_dgram_packet);
diff --git a/source4/nbt_server/dgram/browse.c b/source4/nbt_server/dgram/browse.c
index 1ebc88f..1e4f28b 100644
--- a/source4/nbt_server/dgram/browse.c
+++ b/source4/nbt_server/dgram/browse.c
@@ -64,7 +64,7 @@ void nbtd_mailslot_browse_handler(struct dgram_mailslot_handler *dgmslot,
 	status = dgram_mailslot_browse_parse(dgmslot, browse, packet, browse);
 	if (!NT_STATUS_IS_OK(status)) goto failed;
 
-	DEBUG(2,("Browse %s (Op %d) on '%s' '%s' from %s:%d\n", 
+	DEBUG(4,("Browse %s (Op %d) on '%s' '%s' from %s:%d\n", 
 		nbt_browse_opcode_string(browse->opcode), browse->opcode,
 		nbt_name_string(browse, name), dgmslot->mailslot_name,
 		src->addr, src->port));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list