[dovecot-cvs] dovecot/src/master mail-process.c,1.121,1.122
tss at dovecot.org
tss at dovecot.org
Wed Mar 28 23:06:40 EEST 2007
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv26220
Modified Files:
mail-process.c
Log Message:
When using chrooting, force the home directory to have '/' prefix so it's
not treated as relative.
Index: mail-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- mail-process.c 23 Mar 2007 00:07:24 -0000 1.121
+++ mail-process.c 28 Mar 2007 20:06:37 -0000 1.122
@@ -477,7 +477,11 @@
if (*chroot_dir == '\0' && (p = strstr(home_dir, "/./")) != NULL) {
/* wu-ftpd like <chroot>/./<home> */
chroot_dir = t_strdup_until(home_dir, p);
- home_dir = p + 3;
+ home_dir = p + 2;
+ } else if (*chroot_dir != '\0' && *home_dir != '/') {
+ /* home directories should never be relative, but force this
+ with chroots. */
+ home_dir = t_strconcat("/", home_dir, NULL);
}
if (!dump_capability) {
@@ -596,7 +600,7 @@
ret = -1;
} else {
full_home_dir = *chroot_dir == '\0' ? home_dir :
- t_strconcat(chroot_dir, "/", home_dir, NULL);
+ t_strconcat(chroot_dir, home_dir, NULL);
/* NOTE: if home directory is NFS-mounted, we might not
have access to it as root. Change the effective UID and GID
temporarily to make it work. */
More information about the dovecot-cvs
mailing list