changeset 9549:6794893d03c9 HEAD

Improved setgid/setuid failure's error message.
author Timo Sirainen <tss@iki.fi>
date Mon, 08 Mar 2010 19:07:06 +0200
parents 7c3b7c3a86ff
children affad804356e
files src/lib/restrict-access.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/restrict-access.c	Wed Mar 03 18:33:00 2010 +0200
+++ b/src/lib/restrict-access.c	Mon Mar 08 19:07:06 2010 +0200
@@ -92,10 +92,13 @@
 		}
 
 		if (setgid(primary_gid) != 0) {
-			i_fatal("setgid(%s) failed with euid=%s, "
-				"gid=%s, egid=%s: %m",
+			i_fatal("setgid(%s) failed with "
+				"euid=%s, gid=%s, egid=%s: %m "
+				"(This binary should probably be called with "
+				"process group set to %s instead of %s)",
 				get_gid_str(primary_gid), get_uid_str(geteuid()),
-				get_gid_str(getgid()), get_gid_str(getegid()));
+				get_gid_str(getgid()), get_gid_str(getegid()),
+				get_gid_str(primary_gid), get_uid_str(geteuid()));
 		}
 		return;
 	}
@@ -324,7 +327,10 @@
 	uid = env == NULL || *env == '\0' ? 0 : (uid_t)strtoul(env, NULL, 10);
 	if (uid != 0) {
 		if (setuid(uid) != 0) {
-			i_fatal("setuid(%s) failed with euid=%s: %m",
+			i_fatal("setuid(%s) failed with euid=%s: %m "
+				"(This binary should probably be called with "
+				"process user set to %s instead of %s)",
+				get_uid_str(uid), get_uid_str(geteuid()),
 				get_uid_str(uid), get_uid_str(geteuid()));
 		}
 	}