[dovecot-cvs] dovecot/src/master login-process.c, 1.60, 1.61 master-login-interface.h, 1.5, 1.6

cras at dovecot.org cras at dovecot.org
Tue Oct 19 04:17:41 EEST 2004


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv17154/master

Modified Files:
	login-process.c master-login-interface.h 
Log Message:
Added version to login <-> master communication as well.



Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- login-process.c	13 Oct 2004 16:38:36 -0000	1.60
+++ login-process.c	19 Oct 2004 01:17:39 -0000	1.61
@@ -238,6 +238,14 @@
 	}
 
 	ret = fd_read(p->fd, &req, sizeof(req), &client_fd);
+	if (ret >= (ssize_t)sizeof(req.version) &&
+	    req.version != MASTER_LOGIN_PROTOCOL_VERSION) {
+		i_error("login: Protocol version mismatch "
+			"(mixed old and new binaries?)");
+		login_process_destroy(p);
+		return;
+	}
+
 	if (ret != sizeof(req)) {
 		if (ret == 0) {
 			/* disconnected, ie. the login process died */

Index: master-login-interface.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-login-interface.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- master-login-interface.h	31 May 2004 18:04:47 -0000	1.5
+++ master-login-interface.h	19 Oct 2004 01:17:39 -0000	1.6
@@ -7,11 +7,16 @@
 #define LOGIN_SSL_LISTEN_FD 1
 #define LOGIN_MASTER_SOCKET_FD 3
 
+/* Increase the version number every time master_login_request
+   (or something else) is changed. */
+#define MASTER_LOGIN_PROTOCOL_VERSION 1
+
 struct master_login_request {
-	unsigned int tag;
+	uint32_t version;
+	uint32_t tag;
 
-	unsigned int auth_pid;
-	unsigned int auth_id;
+	uint32_t auth_pid;
+	uint32_t auth_id;
 
 	struct ip_addr local_ip, remote_ip;
 };



More information about the dovecot-cvs mailing list