changeset 8584:0eac46c235e7 HEAD

Log a warning at startup if there doesn't seem to be any way to log in from non-localhost.
author Timo Sirainen <tss@iki.fi>
date Sun, 21 Dec 2008 10:15:58 +0200
parents 2ff2cac3578b
children 24ccf040026b
files src/master/master-settings.c
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/master-settings.c	Sun Dec 21 09:43:20 2008 +0200
+++ b/src/master/master-settings.c	Sun Dec 21 10:15:58 2008 +0200
@@ -581,6 +581,26 @@
 	return FALSE;
 }
 
+static bool settings_have_nonplaintext_auths(struct settings *set)
+{
+	struct auth_settings *auth;
+	struct server_settings *server;
+	const char *const *tmp;
+
+	for (server = set->server; server != NULL; server = server->next) {
+		for (auth = server->auths; auth != NULL; auth = auth->next) {
+			tmp = t_strsplit_spaces(auth->mechanisms, " ");
+			for (; *tmp != NULL; tmp++) {
+				if (strcasecmp(*tmp, "PLAIN") != 0 &&
+				    strcasecmp(*tmp, "LOGIN") != 0)
+					return TRUE;
+			}
+		}
+	}
+
+	return FALSE;
+}
+
 static void unlink_auth_sockets(const char *path, const char *prefix)
 {
 	DIR *dirp;
@@ -838,6 +858,13 @@
 		return FALSE;
 	}
 #endif
+	if (set->ssl_disable && set->disable_plaintext_auth &&
+	    strncmp(set->listen, "127.", 4) != 0 &&
+	    !settings_have_nonplaintext_auths(set)) {
+		i_warning("There is no way to login to this server: "
+			  "disable_plaintext_auth=yes, ssl_disable=yes, "
+			  "no non-plaintext auth mechanisms.");
+	}
 
 	if (set->max_mail_processes < 1) {
 		i_error("max_mail_processes must be at least 1");