]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Give error message with unknown names in protocols setting.
authorTimo Sirainen <tss@iki.fi>
Wed, 23 Dec 2009 22:20:02 +0000 (17:20 -0500)
committerTimo Sirainen <tss@iki.fi>
Wed, 23 Dec 2009 22:20:02 +0000 (17:20 -0500)
--HG--
branch : HEAD

src/master/master-settings.c

index 04baae8da883a8d5e0da1cd0049e328d9f4faa82..ef673d0217c756acbd4a856cbc4b821e88117472 100644 (file)
@@ -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;
 }
 /* </settings checks> */