dovecot-2.0-sslstream: master: Give error message with unknown n...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:57:17 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/e4e31fa845a5
changeset: 10536:e4e31fa845a5
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Dec 23 17:20:02 2009 -0500
description:
master: Give error message with unknown names in protocols setting.

diffstat:

1 file changed, 23 insertions(+)
src/master/master-settings.c |   23 +++++++++++++++++++++++

diffs (40 lines):

diff -r 8f2c4d0f7247 -r e4e31fa845a5 src/master/master-settings.c
--- a/src/master/master-settings.c	Wed Dec 23 17:13:42 2009 -0500
+++ b/src/master/master-settings.c	Wed Dec 23 17:20:02 2009 -0500
@@ -299,6 +299,21 @@ static void service_set_login_dump_core(
 }
 
 static bool
+services_have_protocol(struct master_settings *set, const char *name)
+{
+	struct service_settings *const *services;
+
+	array_foreach(&set->services, services) {
+		struct service_settings *service = *services;
+
+		if (service->protocol != NULL &&
+		    strcmp(service->protocol, name) == 0)
+			return TRUE;
+	}
+	return FALSE;
+}
+
+static bool
 master_settings_verify(void *_set, pool_t pool, const char **error_r)
 {
 	struct master_settings *set = _set;
@@ -396,6 +411,14 @@ master_settings_verify(void *_set, pool_
 	}
 
 	set->protocols_split = p_strsplit(pool, set->protocols, " ");
+	for (i = 0; set->protocols_split[i] != NULL; i++) {
+		if (!services_have_protocol(set, set->protocols_split[i])) {
+			*error_r = t_strdup_printf("protocols: "
+						   "Unknown protocol: %s",
+						   set->protocols_split[i]);
+			return FALSE;
+		}
+	}
 	return TRUE;
 }
 /* </settings checks> */


More information about the dovecot-cvs mailing list