]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Verify that service type string is known. Removed auth-destination type.
authorTimo Sirainen <tss@iki.fi>
Tue, 5 May 2009 22:46:44 +0000 (18:46 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 5 May 2009 22:46:44 +0000 (18:46 -0400)
--HG--
branch : HEAD

src/master/main.c
src/master/master-settings.c

index e8b549f805bdfa77a3c4fb2ba30ccee452c2d835..ed939318d0237a674a711d7c0e4101b9ba657865 100644 (file)
@@ -163,19 +163,35 @@ static void fatal_log_check(const struct master_settings *set)
                i_error("unlink(%s) failed: %m", path);
 }
 
-static bool services_have_auth_destinations(const struct master_settings *set)
+static bool
+services_has_name(const struct master_settings *set, const char *name)
 {
        struct service_settings *const *services;
        unsigned int i, count;
 
        services = array_get(&set->services, &count);
        for (i = 0; i < count; i++) {
-               if (strcmp(services[i]->type, "auth-destination") == 0)
+               if (strcmp(services[i]->name, name) == 0)
                        return TRUE;
        }
        return FALSE;
 }
 
+static bool services_have_auth_destinations(const struct master_settings *set)
+{
+       struct service_settings *const *services;
+       unsigned int i, count;
+
+       services = array_get(&set->services, &count);
+       for (i = 0; i < count; i++) {
+               if (strcmp(services[i]->type, "auth-source") == 0) {
+                       if (services_has_name(set, services[i]->auth_dest_service))
+                               return TRUE;
+               }
+       }
+       return FALSE;
+}
+
 static bool auths_have_debug(const struct master_settings *set)
 {
        struct master_auth_settings *const *auths;
index 2b0be8f69abaac84650b835ca451730ac0061ca5..632a92a744ec4681c1cbf383f3c720390459f88d 100644 (file)
@@ -280,6 +280,15 @@ master_settings_verify(void *_set, pool_t pool, const char **error_r)
                                "Service #%d is missing name", i);
                        return FALSE;
                }
+               if (*services[i]->type != '\0' &&
+                   strcmp(services[i]->type, "log") != 0 &&
+                   strcmp(services[i]->type, "config") != 0 &&
+                   strcmp(services[i]->type, "auth") != 0 &&
+                   strcmp(services[i]->type, "auth-source") != 0) {
+                       *error_r = t_strconcat("Unknown service type: ",
+                                              services[i]->type, NULL);
+                       return FALSE;
+               }
                for (j = 0; j < i; j++) {
                        if (strcmp(services[i]->name, services[j]->name) == 0) {
                                *error_r = t_strdup_printf(