[dovecot-cvs] dovecot/src/imap main.c,1.85,1.86

tss at dovecot.org tss at dovecot.org
Fri Feb 16 13:12:15 UTC 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv5379/imap

Modified Files:
	main.c 
Log Message:
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.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- main.c	15 Feb 2007 11:39:27 -0000	1.85
+++ main.c	16 Feb 2007 13:12:11 -0000	1.86
@@ -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));



More information about the dovecot-cvs mailing list