dovecot-1.2: imap/pop3: If chdir() to home failed, euid was alwa...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jul 26 21:21:56 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/25650d7f6b85
changeset: 9246:25650d7f6b85
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jul 26 14:21:49 2009 -0400
description:
imap/pop3: If chdir() to home failed, euid was always logged as being root.

diffstat:

1 file changed, 4 insertions(+), 5 deletions(-)
src/master/mail-process.c |    9 ++++-----

diffs (26 lines):

diff -r 6a6091e473cc -r 25650d7f6b85 src/master/mail-process.c
--- a/src/master/mail-process.c	Sun Jul 26 14:17:30 2009 -0400
+++ b/src/master/mail-process.c	Sun Jul 26 14:21:49 2009 -0400
@@ -819,11 +819,6 @@ create_mail_process(enum process_type pr
 				  full_home_dir, CHDIR_TIMEOUT - left);
 		}
 
-		/* Change UID back. No need to change GID back, it doesn't
-		   really matter. */
-		if (uid != master_uid && seteuid(master_uid) < 0)
-			i_fatal("seteuid(%s) failed: %m", dec2str(master_uid));
-
 		/* If user's home directory doesn't exist and we're not
 		   trying to chroot anywhere, fallback to /tmp as the mails
 		   could be stored elsewhere. The ENOTDIR check is mostly for
@@ -840,6 +835,10 @@ create_mail_process(enum process_type pr
 							       full_home_dir));
 			}
 		}
+		/* Change UID back. No need to change GID back, it doesn't
+		   really matter. */
+		if (uid != master_uid && seteuid(master_uid) < 0)
+			i_fatal("seteuid(%s) failed: %m", dec2str(master_uid));
 	}
 	if (ret < 0) {
 		/* We still have to change to some directory where we have


More information about the dovecot-cvs mailing list