Mercurial > dovecot > original-hg > dovecot-1.2
diff src/imap/main.c @ 5148:7f2c39d7a2cc HEAD
module_dir_load() doesn't call init() functions anymore. Added a new
module_dir_init() which does it. This way imap/pop3 can load the modules
before chrooting and initialize them after.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 16 Feb 2007 15:12:05 +0200 |
parents | cbc8f65d887b |
children | a7627141ec7f |
line wrap: on
line diff
--- a/src/imap/main.c Fri Feb 16 14:15:28 2007 +0200 +++ b/src/imap/main.c Fri Feb 16 15:12:05 2007 +0200 @@ -44,7 +44,7 @@ enum client_workarounds client_workarounds = 0; static struct io *log_io = NULL; -static struct module *modules; +static struct module *modules = NULL; static char log_prefix[128]; /* syslog() needs this to be permanent */ static pool_t namespace_pool; @@ -135,6 +135,16 @@ chrooting. */ random_init(); + /* Load the plugins before chrooting. Their init() is called later. */ + if (getenv("MAIL_PLUGINS") != NULL) { + const char *plugin_dir = getenv("MAIL_PLUGIN_DIR"); + + if (plugin_dir == NULL) + plugin_dir = MODULEDIR"/imap"; + modules = module_dir_load(plugin_dir, getenv("MAIL_PLUGINS"), + TRUE); + } + restrict_access_by_env(!IS_STANDALONE()); } @@ -190,16 +200,7 @@ commands_init(); imap_thread_init(); - if (getenv("MAIL_PLUGINS") == NULL) - modules = NULL; - else { - const char *plugin_dir = getenv("MAIL_PLUGIN_DIR"); - - if (plugin_dir == NULL) - plugin_dir = MODULEDIR"/imap"; - modules = module_dir_load(plugin_dir, getenv("MAIL_PLUGINS"), - TRUE); - } + module_dir_init(modules); if (getenv("DUMP_CAPABILITY") != NULL) { printf("%s\n", str_c(capability_string));