changeset 4224:8736c4deb253 HEAD

dump-capability wasn't working if dovecot wasn't run as root.
author Timo Sirainen <timo.sirainen@movial.fi>
date Mon, 24 Apr 2006 16:18:45 +0300
parents 606144f4e407
children abdef9d86a94
files src/master/master-settings.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/master-settings.c	Mon Apr 24 12:49:52 2006 +0300
+++ b/src/master/master-settings.c	Mon Apr 24 16:18:45 2006 +0300
@@ -591,6 +591,7 @@
 	int fd[2], status;
 	ssize_t ret;
 	unsigned int pos;
+	uid_t uid;
 
 	if (generated_capability != NULL) {
 		/* Reloading configuration. Don't try to execute the imap
@@ -602,6 +603,13 @@
 		return TRUE;
 	}
 
+	uid = geteuid();
+	if (uid != 0) {
+		/* use the current user */
+		args[0] = t_strdup_printf("uid=%s", dec2str(uid));
+		args[1] = t_strdup_printf("gid=%s", dec2str(getegid()));
+	}
+
 	memset(&ip, 0, sizeof(ip));
 	if (pipe(fd) < 0) {
 		i_error("pipe() failed: %m");