Mercurial > dovecot > core-2.2
changeset 5447:04404fd54cf6 HEAD
Fixed to work with chrooting
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Mar 2007 23:07:38 +0300 |
parents | ce1e1fab1e1d |
children | beabd433cdae |
files | src/util/rawlog.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/util/rawlog.c Wed Mar 28 23:06:37 2007 +0300 +++ b/src/util/rawlog.c Wed Mar 28 23:07:38 2007 +0300 @@ -267,13 +267,16 @@ static void rawlog_open(enum rawlog_flags flags) { - const char *home, *path; + const char *chroot, *home, *path; struct stat st; int sfd[2]; pid_t pid; + chroot = getenv("RESTRICT_CHROOT"); home = getenv("HOME"); - if (home == NULL) + if (chroot != NULL) + home = t_strconcat(chroot, home, NULL); + else if (home == NULL) home = "."; /* see if we want rawlog */ @@ -286,6 +289,11 @@ if (!S_ISDIR(st.st_mode)) return; + if (chroot != NULL) { + /* we'll chroot soon. skip over the chroot in the path. */ + path += strlen(chroot); + } + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0) i_fatal("socketpair() failed: %m");