[dovecot-cvs] dovecot/src/master auth-process.c,1.23,1.24 login-process.c,1.25,1.26

cras at procontrol.fi cras at procontrol.fi
Wed Jan 8 23:13:07 EET 2003


Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv21783/master

Modified Files:
	auth-process.c login-process.c 
Log Message:
Auth and login processes send an "we're ok" reply at the end of
initialization. If the process dies before master receives that reply, it
shutdowns itself. Usually this is because of some configuration error and
it's not nice to start spamming the log files.



Index: auth-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- auth-process.c	5 Jan 2003 15:19:50 -0000	1.23
+++ auth-process.c	8 Jan 2003 21:13:05 -0000	1.24
@@ -29,6 +29,8 @@
 	char reply_buf[sizeof(struct auth_cookie_reply_data)];
 
 	struct waiting_request *requests, **next_request;
+
+	unsigned int initialized:1;
 };
 
 struct waiting_request {
@@ -109,6 +111,18 @@
 		return;
 	}
 
+	if (!p->initialized) {
+		if (p->reply_buf[0] != 'O') {
+			i_fatal("Auth process sent invalid initialization "
+				"notification");
+		}
+
+		p->initialized = TRUE;
+
+		ret--;
+		memmove(p->reply_buf, p->reply_buf + 1, ret);
+	}
+
 	p->reply_pos += ret;
 	if (p->reply_pos < sizeof(p->reply_buf))
 		return;
@@ -145,6 +159,9 @@
 {
 	struct auth_process **pos;
 	struct waiting_request *next;
+
+	if (!p->initialized)
+		i_fatal("Auth process died too early - shutting down");
 
 	for (pos = &processes; *pos != NULL; pos = &(*pos)->next) {
 		if (*pos == p) {

Index: login-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- login-process.c	5 Jan 2003 13:09:53 -0000	1.25
+++ login-process.c	8 Jan 2003 21:13:05 -0000	1.26
@@ -24,6 +24,7 @@
 	int fd;
 	struct io *io;
 	struct ostream *output;
+	unsigned int initialized:1;
 	unsigned int listening:1;
 	unsigned int destroyed:1;
 };
@@ -131,9 +132,14 @@
 	}
 
 	if (client_fd == -1) {
-		/* just a notification that the login process isn't
-		   listening for new connections anymore */
-		login_process_mark_nonlistening(p);
+		/* just a notification that the login process */
+		if (!p->initialized) {
+			/* initialization notify */
+			p->initialized = TRUE;;
+		} else {
+			/* not listening for new connections anymore */
+			login_process_mark_nonlistening(p);
+		}
 		return;
 	}
 
@@ -210,6 +216,8 @@
 		return;
 	p->destroyed = TRUE;
 
+	if (!p->initialized)
+		i_fatal("Login process died too early - shutting down");
 	if (p->listening)
 		listening_processes--;
 




More information about the dovecot-cvs mailing list