[dovecot-cvs] dovecot/src/pop3 main.c,1.48.2.3,1.48.2.4

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


Update of /var/lib/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv5370/pop3

Modified Files:
      Tag: branch_1_0
	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/pop3/main.c,v
retrieving revision 1.48.2.3
retrieving revision 1.48.2.4
diff -u -d -r1.48.2.3 -r1.48.2.4
--- main.c	20 Dec 2006 05:10:52 -0000	1.48.2.3
+++ main.c	16 Feb 2007 13:12:04 -0000	1.48.2.4
@@ -37,7 +37,7 @@
 void (*hook_mail_storage_created)(struct mail_storage *storage) = NULL;
 void (*hook_client_created)(struct client **client) = NULL;
 
-static struct module *modules;
+static struct module *modules = NULL;
 static char log_prefix[128]; /* syslog() needs this to be permanent */
 static struct io *log_io = NULL;
 
@@ -152,6 +152,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());
 }
 
@@ -194,16 +204,7 @@
 	mail_storage_register_all();
 	clients_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);
 
 	mail = getenv("MAIL");
 	if (mail == NULL) {



More information about the dovecot-cvs mailing list