changeset 19836:0090a7192286

lib-storage: Verify settings only after applying settings from userdb This is especially important to verify() functions that parse the settings and store data permanently based on them, e.g. pop3_delete_flag or imap_client_workarounds, which effectively couldn't be overwritten by userdb.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 24 Feb 2016 15:00:31 +0200
parents c2999b133d37
children b02d6f8ebf88
files src/lib-storage/mail-storage-service.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-storage-service.c	Tue Feb 23 23:41:28 2016 +0200
+++ b/src/lib-storage/mail-storage-service.c	Wed Feb 24 15:00:31 2016 +0200
@@ -1221,8 +1221,6 @@
 	user->flags = flags;
 
 	user->set_parser = settings_parser_dup(set_parser, user_pool);
-	if (!settings_parser_check(user->set_parser, user_pool, &error))
-		i_panic("settings_parser_check() failed: %s", error);
 
 	sets = master_service_settings_parser_get_others(master_service,
 							 user->set_parser);
@@ -1248,6 +1246,11 @@
 			ret = -2;
 		}
 	}
+	if (ret > 0 && !settings_parser_check(user->set_parser, user_pool, &error)) {
+		i_error("Invalid settings (probably caused by userdb): %s", error);
+		*error_r = ERRSTR_INVALID_USER_SETTINGS;
+		ret = -2;
+	}
 	pool_unref(&temp_pool);
 
 	/* load per-user plugins */