[dovecot-cvs] dovecot/src/auth main.c,1.30,1.31

cras at dovecot.org cras at dovecot.org
Mon Dec 20 18:00:59 EET 2004


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv31647/auth

Modified Files:
	main.c 
Log Message:
Fixes for using socket listen { .. } in auth sections.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/main.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- main.c	8 Oct 2004 17:51:47 -0000	1.30
+++ main.c	20 Dec 2004 16:00:56 -0000	1.31
@@ -54,30 +54,6 @@
 	i_set_failure_timestamp_format(getenv("LOGSTAMP"));
 }
 
-static void drop_privileges(void)
-{
-	unsigned int seed;
-
-	verbose = getenv("VERBOSE") != NULL;
-	verbose_debug = getenv("VERBOSE_DEBUG") != NULL;
-
-	open_logfile();
-
-	/* Open /dev/urandom before chrooting */
-	random_init();
-	random_fill(&seed, sizeof(seed));
-	srand(seed);
-
-	/* Initialize databases so their configuration files can be readable
-	   only by root. Also load all modules here. */
-	userdb_preinit();
-	passdb_preinit();
-        password_schemes_init();
-
-	/* Password lookups etc. may require roots, allow it. */
-	restrict_access_by_env(FALSE);
-}
-
 static uid_t get_uid(const char *user)
 {
 	struct passwd *pw;
@@ -191,6 +167,33 @@
 	}
 }
 
+static void drop_privileges(void)
+{
+	unsigned int seed;
+
+	verbose = getenv("VERBOSE") != NULL;
+	verbose_debug = getenv("VERBOSE_DEBUG") != NULL;
+
+	open_logfile();
+
+	/* Open /dev/urandom before chrooting */
+	random_init();
+	random_fill(&seed, sizeof(seed));
+	srand(seed);
+
+	/* Initialize databases so their configuration files can be readable
+	   only by root. Also load all modules here. */
+	userdb_preinit();
+	passdb_preinit();
+        password_schemes_init();
+
+	masters_buf = buffer_create_dynamic(default_pool, 64);
+	add_extra_listeners();
+
+	/* Password lookups etc. may require roots, allow it. */
+	restrict_access_by_env(FALSE);
+}
+
 static void main_init(int nodaemon)
 {
 	struct auth_master_connection *master, **master_p;
@@ -204,8 +207,6 @@
 	lib_init_signals(sig_quit);
 	mech_init();
 
-	masters_buf = buffer_create_dynamic(default_pool, 64);
-
 	env = getenv("AUTH_PROCESS");
 	standalone = env == NULL;
 	if (standalone) {
@@ -245,8 +246,6 @@
 		buffer_append(masters_buf, &master, sizeof(master));
 	}
 
-	add_extra_listeners();
-
 	/* everything initialized, notify masters that all is well */
 	master_p = buffer_get_modifyable_data(masters_buf, &size);
 	size /= sizeof(*master_p);
@@ -288,10 +287,10 @@
 	/* NOTE: we start rooted, so keep the code minimal until
 	   restrict_access_by_env() is called */
 	lib_init();
-	drop_privileges();
-
 	ioloop = io_loop_create(system_pool);
 
+	drop_privileges();
+
 	main_init(argc > 1 && strcmp(argv[1], "-F") == 0);
         io_loop_run(ioloop);
 	main_deinit();



More information about the dovecot-cvs mailing list