dovecot-2.2: Moved random_init() from lib-imap-urlauth to imap/i...

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 18 06:55:36 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/70ca88e74a4b
changeset: 15227:70ca88e74a4b
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 18 06:55:04 2012 +0300
description:
Moved random_init() from lib-imap-urlauth to imap/imap-urlauth main().
This way if the processes are chrooted they are still able to open
/dev/urandom.

diffstat:

 src/imap-urlauth/imap-urlauth-worker.c |  3 +++
 src/imap/main.c                        |  3 +++
 src/lib-imap-urlauth/imap-urlauth.c    |  4 ----
 3 files changed, 6 insertions(+), 4 deletions(-)

diffs (75 lines):

diff -r 0bb400d84134 -r 70ca88e74a4b src/imap-urlauth/imap-urlauth-worker.c
--- a/src/imap-urlauth/imap-urlauth-worker.c	Sat Oct 13 04:30:17 2012 +0300
+++ b/src/imap-urlauth/imap-urlauth-worker.c	Thu Oct 18 06:55:04 2012 +0300
@@ -14,6 +14,7 @@
 #include "hostpid.h"
 #include "var-expand.h"
 #include "process-title.h"
+#include "randgen.h"
 #include "restrict-access.h"
 #include "settings-parser.h"
 #include "master-service.h"
@@ -1011,6 +1012,7 @@
 	master_service_init_finish(master_service);
 	master_service_set_die_callback(master_service, imap_urlauth_worker_die);
 
+	random_init();
 	storage_service =
 		mail_storage_service_init(master_service,
 					  set_roots, storage_service_flags);
@@ -1037,6 +1039,7 @@
 	clients_destroy_all();
 
 	mail_storage_service_deinit(&storage_service);
+	random_deinit();
 	master_service_deinit(&master_service);
 	return 0;
 }
diff -r 0bb400d84134 -r 70ca88e74a4b src/imap/main.c
--- a/src/imap/main.c	Sat Oct 13 04:30:17 2012 +0300
+++ b/src/imap/main.c	Thu Oct 18 06:55:04 2012 +0300
@@ -8,6 +8,7 @@
 #include "str.h"
 #include "base64.h"
 #include "process-title.h"
+#include "randgen.h"
 #include "restrict-access.h"
 #include "fd-close-on-exec.h"
 #include "settings-parser.h"
@@ -369,6 +370,7 @@
 	commands_init();
 	imap_fetch_handlers_init();
 
+	random_init();
 	storage_service =
 		mail_storage_service_init(master_service,
 					  set_roots, storage_service_flags);
@@ -405,6 +407,7 @@
 	imap_fetch_handlers_deinit();
 	commands_deinit();
 
+	random_deinit();
 	master_service_deinit(&master_service);
 	return 0;
 }
diff -r 0bb400d84134 -r 70ca88e74a4b src/lib-imap-urlauth/imap-urlauth.c
--- a/src/lib-imap-urlauth/imap-urlauth.c	Sat Oct 13 04:30:17 2012 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth.c	Thu Oct 18 06:55:04 2012 +0300
@@ -37,8 +37,6 @@
 
 	i_assert(*config->url_host != '\0');
 
-	random_init();
-
 	uctx = i_new(struct imap_urlauth_context, 1);
 	uctx->user = user;
 	uctx->url_host = i_strdup(config->url_host);
@@ -78,8 +76,6 @@
 	i_free(uctx->access_user);
 	i_free(uctx->access_applications);
 	i_free(uctx);
-
-	random_deinit();
 }
 
 static const unsigned char *


More information about the dovecot-cvs mailing list