[dovecot-cvs] dovecot/src/lib restrict-access.c,1.15,1.16
cras at dovecot.org
cras at dovecot.org
Fri Sep 24 16:05:11 EEST 2004
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv22205/lib
Modified Files:
restrict-access.c
Log Message:
updated error messages
Index: restrict-access.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/restrict-access.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- restrict-access.c 28 Aug 2004 09:22:06 -0000 1.15
+++ restrict-access.c 24 Sep 2004 13:05:09 -0000 1.16
@@ -195,14 +195,22 @@
/* verify that we actually dropped the privileges */
if (uid != 0 || disallow_root) {
- if (setuid(0) == 0)
+ if (setuid(0) == 0) {
+ if (uid == 0)
+ i_fatal("Running as root isn't permitted");
i_fatal("We couldn't drop root privileges");
+ }
}
env = getenv("RESTRICT_GID_FIRST");
if (gid != 0 || (env != NULL && atoi(env) != 0)) {
- if (getgid() == 0 || getegid() == 0 || setgid(0) == 0)
- i_fatal("We couldn't drop root group privileges");
+ if (getgid() == 0 || getegid() == 0 || setgid(0) == 0) {
+ if (gid == 0)
+ i_fatal("GID 0 isn't permitted");
+ i_fatal("We couldn't drop root group privileges "
+ "(wanted=%s, gid=%s, egid=%s)", dec2str(gid),
+ dec2str(getgid()), dec2str(getegid()));
+ }
}
/* clear the environment, so we don't fail if we get back here */
More information about the dovecot-cvs
mailing list