changeset 4553:d1c0514754d5 HEAD

Require that master's version number matches the child's, unless version_ignore=yes. Usually it's an accidental installation problem if the version numbers don't match.
author Timo Sirainen <tss@iki.fi>
date Thu, 10 Aug 2006 21:46:53 +0300
parents ef71b2fdd433
children d59ab08a6b6a
files src/auth/main.c src/dict/main.c src/imap/main.c src/login-common/main.c src/master/main.c src/master/master-settings.c src/master/master-settings.h src/pop3/main.c
diffstat 8 files changed, 43 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/main.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/auth/main.c	Thu Aug 10 21:46:53 2006 +0300
@@ -206,6 +206,14 @@
 static void main_init(bool nodaemon)
 {
 	struct auth_master_listener *listener;
+	const char *value;
+
+	value = getenv("DOVECOT_VERSION");
+	if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
+		i_fatal("Dovecot version mismatch: "
+			"Master is v%s, dovecot-auth is v"PACKAGE_VERSION" "
+			"(if you don't care, set version_ignore=yes)", value);
+	}
 
         process_start_time = ioloop_time;
 
--- a/src/dict/main.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/dict/main.c	Thu Aug 10 21:46:53 2006 +0300
@@ -56,9 +56,16 @@
 
 static void main_init(void)
 {
-	const char *path;
+	const char *value, *path;
 	int fd;
 
+	value = getenv("DOVECOT_VERSION");
+	if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
+		i_fatal("Dovecot version mismatch: "
+			"Master is v%s, dict is v"PACKAGE_VERSION" "
+			"(if you don't care, set version_ignore=yes)", value);
+	}
+
 	lib_signals_init();
         lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
         lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL);
--- a/src/imap/main.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/imap/main.c	Thu Aug 10 21:46:53 2006 +0300
@@ -144,6 +144,13 @@
 	struct client *client;
 	const char *user, *str;
 
+	str = getenv("DOVECOT_VERSION");
+	if (str != NULL && strcmp(str, PACKAGE_VERSION) != 0) {
+		i_fatal("Dovecot version mismatch: "
+			"Master is v%s, imap is v"PACKAGE_VERSION" "
+			"(if you don't care, set version_ignore=yes)", str);
+	}
+
 	lib_signals_init();
         lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
         lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL);
--- a/src/login-common/main.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/login-common/main.c	Thu Aug 10 21:46:53 2006 +0300
@@ -228,6 +228,13 @@
 {
 	const char *value;
 
+	value = getenv("DOVECOT_VERSION");
+	if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
+		i_fatal("Dovecot version mismatch: "
+			"Master is v%s, login is v"PACKAGE_VERSION" "
+			"(if you don't care, set version_ignore=yes)", value);
+	}
+
 	lib_signals_init();
         lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
         lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL);
--- a/src/master/main.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/master/main.c	Thu Aug 10 21:46:53 2006 +0300
@@ -82,6 +82,8 @@
 		facility = LOG_MAIL;
 	env_put(t_strdup_printf("SYSLOG_FACILITY=%d", facility));
 
+	if (settings_root != NULL && !settings_root->defaults->version_ignore)
+		env_put("DOVECOT_VERSION="PACKAGE_VERSION);
 #ifdef DEBUG
 	if (gdb) env_put("GDB=1");
 #endif
--- a/src/master/master-settings.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/master/master-settings.c	Thu Aug 10 21:46:53 2006 +0300
@@ -77,6 +77,7 @@
 	DEF(SET_BOOL, verbose_ssl),
 	DEF(SET_BOOL, shutdown_clients),
 	DEF(SET_BOOL, nfs_check),
+	DEF(SET_BOOL, version_ignore),
 
 	/* login */
 	DEF(SET_STR, login_dir),
@@ -283,6 +284,7 @@
 	MEMBER(verbose_ssl) FALSE,
 	MEMBER(shutdown_clients) TRUE,
 	MEMBER(nfs_check) TRUE,
+	MEMBER(version_ignore) FALSE,
 
 	/* login */
 	MEMBER(login_dir) "login",
--- a/src/master/master-settings.h	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/master/master-settings.h	Thu Aug 10 21:46:53 2006 +0300
@@ -38,6 +38,7 @@
 	bool verbose_ssl;
 	bool shutdown_clients;
 	bool nfs_check;
+	bool version_ignore;
 
 	/* login */
 	const char *login_dir;
--- a/src/pop3/main.c	Thu Aug 10 20:46:05 2006 +0300
+++ b/src/pop3/main.c	Thu Aug 10 21:46:53 2006 +0300
@@ -160,7 +160,14 @@
         enum mail_storage_flags flags;
         enum mail_storage_lock_method lock_method;
 	struct mail_storage *storage;
-	const char *mail;
+	const char *mail, *value;
+
+	value = getenv("DOVECOT_VERSION");
+	if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
+		i_fatal("Dovecot version mismatch: "
+			"Master is v%s, pop3 is v"PACKAGE_VERSION" "
+			"(if you don't care, set version_ignore=yes)", value);
+	}
 
 	lib_signals_init();
         lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);