Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7473:1b15881ed93b HEAD
mail_uid and mail_gid settings weren't handled correctly.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 04 May 2008 03:00:32 +0300 |
parents | aa41caaf8e0b |
children | 40929ce03622 |
files | src/deliver/auth-client.c |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/deliver/auth-client.c Sun May 04 02:53:55 2008 +0300 +++ b/src/deliver/auth-client.c Sun May 04 03:00:32 2008 +0300 @@ -110,10 +110,6 @@ conn->user); return_value = EX_TEMPFAIL; } - if (conn->euid != uid) { - env_put(t_strconcat("RESTRICT_SETUID=", - dec2str(uid), NULL)); - } } else if (strncmp(*tmp, "gid=", 4) == 0) { gid = strtoul(*tmp + 4, NULL, 10); @@ -122,11 +118,6 @@ conn->user); return_value = EX_TEMPFAIL; } - - if (conn->euid == 0 || getegid() != gid) { - env_put(t_strconcat("RESTRICT_SETGID=", - *tmp + 4, NULL)); - } } else if (strncmp(*tmp, "chroot=", 7) == 0) { chroot = *tmp + 7; } else { @@ -139,7 +130,7 @@ } } - if (uid == 0 && getenv("MAIL_UID")) { + if (uid == 0 && getenv("MAIL_UID") != NULL) { if (!parse_uid(getenv("MAIL_UID"), &uid) || uid == 0) { i_error("mail_uid setting is invalid"); return_value = EX_TEMPFAIL; @@ -151,7 +142,7 @@ return_value = EX_TEMPFAIL; return; } - if (gid == 0 && getenv("MAIL_GID")) { + if (gid == 0 && getenv("MAIL_GID") != NULL) { if (!parse_gid(getenv("MAIL_GID"), &gid) || gid == 0) { i_error("mail_gid setting is invalid"); return_value = EX_TEMPFAIL; @@ -164,6 +155,11 @@ return; } + if (conn->euid != uid) + env_put(t_strconcat("RESTRICT_SETUID=", dec2str(uid), NULL)); + if (conn->euid == 0 || getegid() != gid) + env_put(t_strconcat("RESTRICT_SETGID=", dec2str(gid), NULL)); + if (chroot != NULL) env_put(t_strconcat("RESTRICT_CHROOT=", chroot, NULL));