]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Verify settings only after applying settings from userdb
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 24 Feb 2016 13:00:31 +0000 (15:00 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 24 Feb 2016 13:03:45 +0000 (15:03 +0200)
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.

src/lib-storage/mail-storage-service.c

index b306e49f2eaf52d7b3bd506a9eb5de0928e1689e..f6b28902062325a5b4044c97232151a09a334a0c 100644 (file)
@@ -1221,8 +1221,6 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx,
        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 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx,
                        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 */