changeset 12367:9f179255b796

lib-master: Stop accepting new connections after auth-master gets disconnected.
author Timo Sirainen <tss@iki.fi>
date Tue, 02 Nov 2010 18:21:05 +0000
parents 0b77044fbdd4
children 055e5206b836
files src/lib-master/master-login-auth.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-master/master-login-auth.c	Tue Nov 02 18:13:39 2010 +0000
+++ b/src/lib-master/master-login-auth.c	Tue Nov 02 18:21:05 2010 +0000
@@ -10,6 +10,7 @@
 #include "hash.h"
 #include "str.h"
 #include "master-interface.h"
+#include "master-service.h"
 #include "master-auth.h"
 #include "master-login-auth.h"
 
@@ -282,7 +283,10 @@
 	case 0:
 		return;
 	case -1:
-		/* disconnected */
+		/* disconnected. stop accepting new connections, because in
+		   default configuration we no longer have permissions to
+		   connect back to auth-master */
+		master_service_stop_new_connections(master_service);
 		master_login_auth_disconnect(auth);
 		return;
 	case -2:
@@ -411,6 +415,9 @@
 
 	if (auth->fd == -1) {
 		if (master_login_auth_connect(auth) < 0) {
+			/* we couldn't connect to auth now,
+			   so we probably can't in future either. */
+			master_service_stop_new_connections(master_service);
 			callback(NULL, MASTER_AUTH_ERRMSG_INTERNAL_FAILURE,
 				 context);
 			return;