dovecot-2.2: lib-master: Added master_service_settings_output.pe...

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 1 14:18:29 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/5696b0162527
changeset: 16629:5696b0162527
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 01 14:18:00 2013 +0300
description:
lib-master: Added master_service_settings_output.permission_denied error flag.

diffstat:

 src/lib-master/master-service-settings.c |  7 ++++++-
 src/lib-master/master-service-settings.h |  4 ++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r 96ea65bf653c -r 5696b0162527 src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c	Thu Aug 01 13:51:57 2013 +0300
+++ b/src/lib-master/master-service-settings.c	Thu Aug 01 14:18:00 2013 +0300
@@ -150,6 +150,7 @@
 {
 	const char *path;
 	struct stat st;
+	int saved_errno = errno;
 
 	if (input->never_exec)
 		return;
@@ -161,6 +162,7 @@
 		/* it's a file, not a socket/pipe */
 		master_service_exec_config(service, input);
 	}
+	errno = saved_errno;
 }
 
 static int
@@ -377,8 +379,11 @@
 		for (;;) {
 			fd = master_service_open_config(service, input,
 							&path, error_r);
-			if (fd == -1)
+			if (fd == -1) {
+				if (errno == EACCES)
+					output_r->permission_denied = TRUE;
 				return -1;
+			}
 
 			if (config_send_request(service, input, fd,
 						path, error_r) == 0)
diff -r 96ea65bf653c -r 5696b0162527 src/lib-master/master-service-settings.h
--- a/src/lib-master/master-service-settings.h	Thu Aug 01 13:51:57 2013 +0300
+++ b/src/lib-master/master-service-settings.h	Thu Aug 01 14:18:00 2013 +0300
@@ -52,6 +52,10 @@
 	   local/remote ip/host */
 	unsigned int used_local:1;
 	unsigned int used_remote:1;
+	/* Config couldn't be read because we don't have enough permissions.
+	   The process probably should be restarted and the settings read
+	   before dropping privileges. */
+	unsigned int permission_denied:1;
 };
 
 extern const struct setting_parser_info master_service_setting_parser_info;


More information about the dovecot-cvs mailing list