svn commit: samba r22715 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_26/source/nsswitch

jerry at samba.org jerry at samba.org
Sun May 6 21:10:30 GMT 2007


Author: jerry
Date: 2007-05-06 21:10:30 +0000 (Sun, 06 May 2007)
New Revision: 22715

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22715

Log:
When our primary domain does on or offline, make sure to send a msg
to the idmap child.

Also remove the check for the global offline state in child_msg_offline()
as this means we cannot mark domains offline due to network outages.


Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_0_26/source/nsswitch/winbindd_dual.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c	2007-05-06 21:06:55 UTC (rev 22714)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c	2007-05-06 21:10:30 UTC (rev 22715)
@@ -246,8 +246,9 @@
         struct winbindd_domain *domain =
                 (struct winbindd_domain *)private_data;
 
-	DEBUG(10,("check_domain_online_handler: called for domain %s\n",
-		domain->name ));
+	DEBUG(10,("check_domain_online_handler: called for domain "
+		  "%s (online = %s)\n", domain->name, 
+		  domain->online ? "True" : "False" ));
 
 	if (domain->check_online_event) {
 		TALLOC_FREE(domain->check_online_event);
@@ -349,6 +350,23 @@
 
 	DEBUG(10,("set_domain_offline: added event handler for domain %s\n",
 		domain->name ));
+
+	/* Send an offline message to the idmap child when our
+	   primary domain goes offline */
+
+	if ( domain->primary ) {
+		struct winbindd_child *idmap = idmap_child();
+		
+		if ( idmap->pid != 0 ) {
+			message_send_pid(pid_to_procid(idmap->pid), 
+					 MSG_WINBIND_OFFLINE, 
+					 domain->name, 
+					 strlen(domain->name)+1, 
+					 False);
+		}			
+	}
+
+	return;	
 }
 
 /****************************************************************
@@ -409,6 +427,23 @@
 	message_deregister(MSG_WINBIND_FAILED_TO_GO_ONLINE);
 
 	domain->online = True;
+
+	/* Send an online message to the idmap child when our
+	   primary domain comes online */
+
+	if ( domain->primary ) {
+		struct winbindd_child *idmap = idmap_child();
+		
+		if ( idmap->pid != 0 ) {
+			message_send_pid(pid_to_procid(idmap->pid), 
+					 MSG_WINBIND_ONLINE, 
+					 domain->name, 
+					 strlen(domain->name)+1, 
+					 False);
+		}			
+	}
+
+	return;	
 }
 
 /****************************************************************

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c	2007-05-06 21:06:55 UTC (rev 22714)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c	2007-05-06 21:10:30 UTC (rev 22715)
@@ -504,21 +504,6 @@
 		}
 		DEBUG(5,("winbind_msg_offline: marking %s offline.\n", domain->name));
 		set_domain_offline(domain);
-
-		/* Send an offline message to the idmap child when our
-		   primary domain goes offline */
-
-		if ( domain->primary ) {
-			struct winbindd_child *idmap = idmap_child();
-
-			if ( idmap->pid != 0 ) {
-				message_send_pid(pid_to_procid(idmap->pid), 
-						 MSG_WINBIND_OFFLINE, 
-						 domain->name, 
-						 strlen(domain->name)+1, 
-						 False);
-			}			
-		}
 	}
 
 	for (child = children; child != NULL; child = child->next) {
@@ -703,12 +688,6 @@
 		return;
 	}
 
-	/* Set our global state as offline. */
-	if (!set_global_winbindd_state_offline()) {
-		DEBUG(10,("child_msg_offline: offline request failed.\n"));
-		return;
-	}
-
 	/* Mark the requested domain offline. */
 
 	for (domain = domain_list(); domain; domain = domain->next) {

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd_cm.c	2007-05-06 21:06:55 UTC (rev 22714)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd_cm.c	2007-05-06 21:10:30 UTC (rev 22715)
@@ -246,8 +246,9 @@
         struct winbindd_domain *domain =
                 (struct winbindd_domain *)private_data;
 
-	DEBUG(10,("check_domain_online_handler: called for domain %s\n",
-		domain->name ));
+	DEBUG(10,("check_domain_online_handler: called for domain "
+		  "%s (online = %s)\n", domain->name, 
+		  domain->online ? "True" : "False" ));
 
 	if (domain->check_online_event) {
 		TALLOC_FREE(domain->check_online_event);
@@ -349,6 +350,23 @@
 
 	DEBUG(10,("set_domain_offline: added event handler for domain %s\n",
 		domain->name ));
+
+	/* Send an offline message to the idmap child when our
+	   primary domain goes offline */
+
+	if ( domain->primary ) {
+		struct winbindd_child *idmap = idmap_child();
+		
+		if ( idmap->pid != 0 ) {
+			message_send_pid(pid_to_procid(idmap->pid), 
+					 MSG_WINBIND_OFFLINE, 
+					 domain->name, 
+					 strlen(domain->name)+1, 
+					 False);
+		}			
+	}
+
+	return;	
 }
 
 /****************************************************************
@@ -409,6 +427,23 @@
 	message_deregister(MSG_WINBIND_FAILED_TO_GO_ONLINE);
 
 	domain->online = True;
+
+	/* Send an online message to the idmap child when our
+	   primary domain comes online */
+
+	if ( domain->primary ) {
+		struct winbindd_child *idmap = idmap_child();
+		
+		if ( idmap->pid != 0 ) {
+			message_send_pid(pid_to_procid(idmap->pid), 
+					 MSG_WINBIND_ONLINE, 
+					 domain->name, 
+					 strlen(domain->name)+1, 
+					 False);
+		}			
+	}
+
+	return;	
 }
 
 /****************************************************************

Modified: branches/SAMBA_3_0_26/source/nsswitch/winbindd_dual.c
===================================================================
--- branches/SAMBA_3_0_26/source/nsswitch/winbindd_dual.c	2007-05-06 21:06:55 UTC (rev 22714)
+++ branches/SAMBA_3_0_26/source/nsswitch/winbindd_dual.c	2007-05-06 21:10:30 UTC (rev 22715)
@@ -504,21 +504,6 @@
 		}
 		DEBUG(5,("winbind_msg_offline: marking %s offline.\n", domain->name));
 		set_domain_offline(domain);
-
-		/* Send an offline message to the idmap child when our
-		   primary domain goes offline */
-
-		if ( domain->primary ) {
-			struct winbindd_child *idmap = idmap_child();
-
-			if ( idmap->pid != 0 ) {
-				message_send_pid(pid_to_procid(idmap->pid), 
-						 MSG_WINBIND_OFFLINE, 
-						 domain->name, 
-						 strlen(domain->name)+1, 
-						 False);
-			}			
-		}
 	}
 
 	for (child = children; child != NULL; child = child->next) {
@@ -703,12 +688,6 @@
 		return;
 	}
 
-	/* Set our global state as offline. */
-	if (!set_global_winbindd_state_offline()) {
-		DEBUG(10,("child_msg_offline: offline request failed.\n"));
-		return;
-	}
-
 	/* Mark the requested domain offline. */
 
 	for (domain = domain_list(); domain; domain = domain->next) {



More information about the samba-cvs mailing list