[dovecot-cvs] dovecot/src/master master-settings.c,1.124,1.125

tss-movial at dovecot.org tss-movial at dovecot.org
Mon Apr 24 16:18:47 EEST 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv16102

Modified Files:
	master-settings.c 
Log Message:
dump-capability wasn't working if dovecot wasn't run as root.



Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- master-settings.c	14 Apr 2006 18:20:57 -0000	1.124
+++ master-settings.c	24 Apr 2006 13:18:45 -0000	1.125
@@ -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");



More information about the dovecot-cvs mailing list