Mercurial > dovecot > core-2.2
changeset 9230:d83bfe8c38c2 HEAD
Verify that service type string is known. Removed auth-destination type.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 05 May 2009 18:46:44 -0400 |
parents | e5303fd61b5c |
children | 8f770c8ad198 |
files | src/master/main.c src/master/master-settings.c |
diffstat | 2 files changed, 27 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/main.c Tue May 05 15:33:44 2009 -0400 +++ b/src/master/main.c Tue May 05 18:46:44 2009 -0400 @@ -163,6 +163,20 @@ i_error("unlink(%s) failed: %m", path); } +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]->name, name) == 0) + return TRUE; + } + return FALSE; +} + static bool services_have_auth_destinations(const struct master_settings *set) { struct service_settings *const *services; @@ -170,8 +184,10 @@ services = array_get(&set->services, &count); for (i = 0; i < count; i++) { - if (strcmp(services[i]->type, "auth-destination") == 0) - return TRUE; + if (strcmp(services[i]->type, "auth-source") == 0) { + if (services_has_name(set, services[i]->auth_dest_service)) + return TRUE; + } } return FALSE; }
--- a/src/master/master-settings.c Tue May 05 15:33:44 2009 -0400 +++ b/src/master/master-settings.c Tue May 05 18:46:44 2009 -0400 @@ -280,6 +280,15 @@ "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(