dovecot: If setuid() fails, log the current effective uid.

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 2 17:58:19 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/dbe6224b0309
changeset: 6661:dbe6224b0309
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 02 17:58:14 2007 +0200
description:
If setuid() fails, log the current effective uid.

diffstat:

1 file changed, 4 insertions(+), 2 deletions(-)
src/lib/restrict-access.c |    6 ++++--

diffs (16 lines):

diff -r a7d462ed94df -r dbe6224b0309 src/lib/restrict-access.c
--- a/src/lib/restrict-access.c	Fri Nov 02 17:29:25 2007 +0200
+++ b/src/lib/restrict-access.c	Fri Nov 02 17:58:14 2007 +0200
@@ -196,8 +196,10 @@ void restrict_access_by_env(bool disallo
 	env = getenv("RESTRICT_SETUID");
 	uid = env == NULL ? 0 : (uid_t)strtoul(env, NULL, 10);
 	if (uid != 0) {
-		if (setuid(uid) != 0)
-			i_fatal("setuid(%s) failed: %m", dec2str(uid));
+		if (setuid(uid) != 0) {
+			i_fatal("setuid(%s) failed with euid=%s: %m",
+				dec2str(uid), dec2str(geteuid()));
+		}
 	}
 
 	/* verify that we actually dropped the privileges */


More information about the dovecot-cvs mailing list