[dovecot-cvs] dovecot/src/master mail-process.c, 1.96.2.22, 1.96.2.23

tss at dovecot.org tss at dovecot.org
Wed Mar 28 23:07:07 EEST 2007


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv26231

Modified Files:
      Tag: branch_1_0
	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.96.2.22
retrieving revision 1.96.2.23
diff -u -d -r1.96.2.22 -r1.96.2.23
--- mail-process.c	23 Mar 2007 00:07:21 -0000	1.96.2.22
+++ mail-process.c	28 Mar 2007 20:06:35 -0000	1.96.2.23
@@ -479,7 +479,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) {
@@ -598,7 +602,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