From: Timo Sirainen Date: Wed, 23 Dec 2009 22:20:02 +0000 (-0500) Subject: master: Give error message with unknown names in protocols setting. X-Git-Tag: 2.0.beta2~84 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c747508eea6eea38be57042fc47942081c0f0733;p=thirdparty%2Fdovecot%2Fcore.git master: Give error message with unknown names in protocols setting. --HG-- branch : HEAD --- diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 04baae8da8..ef673d0217 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -298,6 +298,21 @@ static void service_set_login_dump_core(struct service_settings *set) set->login_dump_core = TRUE; } +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) { @@ -396,6 +411,14 @@ master_settings_verify(void *_set, pool_t pool, const char **error_r) } 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; } /* */