From: Timo Sirainen Date: Tue, 5 May 2009 22:46:44 +0000 (-0400) Subject: Verify that service type string is known. Removed auth-destination type. X-Git-Tag: 2.0.alpha1~822 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32554cf307ecdcc51d88b81695cd268941b06bfe;p=thirdparty%2Fdovecot%2Fcore.git Verify that service type string is known. Removed auth-destination type. --HG-- branch : HEAD --- diff --git a/src/master/main.c b/src/master/main.c index e8b549f805..ed939318d0 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -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; diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 2b0be8f69a..632a92a744 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -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(