dovecot-1.1: expire-tool: Fixed changing uid/gid.
dovecot at dovecot.org
dovecot at dovecot.org
Sun May 25 15:11:02 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/5b27f5cbf016
changeset: 7551:5b27f5cbf016
user: Timo Sirainen <tss at iki.fi>
date: Sun May 25 15:10:59 2008 +0300
description:
expire-tool: Fixed changing uid/gid.
diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
src/plugins/expire/auth-client.c | 14 +++++++++-----
diffs (33 lines):
diff -r d920ec986c34 -r 5b27f5cbf016 src/plugins/expire/auth-client.c
--- a/src/plugins/expire/auth-client.c Sun May 25 05:01:47 2008 +0300
+++ b/src/plugins/expire/auth-client.c Sun May 25 15:10:59 2008 +0300
@@ -130,20 +130,24 @@ static void auth_parse_input(struct auth
return;
}
+ if (uid != conn->current_uid && conn->current_uid != 0) {
+ if (seteuid(0) != 0)
+ i_fatal("seteuid(0) failed: %m");
+ conn->current_uid = 0;
+ }
+
+ /* change GID */
+ restrict_access_by_env(FALSE);
+
/* we'll change only effective UID. This is a bit unfortunate since
it allows reverting back to root, but we'll have to be able to
access different users' mailboxes.. */
if (uid != conn->current_uid) {
- if (conn->current_uid != 0) {
- if (seteuid(0) != 0)
- i_fatal("seteuid(0) failed: %m");
- }
if (seteuid(uid) < 0)
i_fatal("seteuid(%s) failed: %m", dec2str(uid));
conn->current_uid = uid;
}
- restrict_access_by_env(FALSE);
conn->return_value = 1;
}
More information about the dovecot-cvs
mailing list