[dovecot-cvs] dovecot/src/util rawlog.c,1.12,1.13

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


Update of /var/lib/cvs/dovecot/src/util
In directory talvi:/tmp/cvs-serv26372

Modified Files:
	rawlog.c 
Log Message:
Fixed to work with chrooting



Index: rawlog.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/util/rawlog.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rawlog.c	8 Mar 2007 22:07:32 -0000	1.12
+++ rawlog.c	28 Mar 2007 20:07:38 -0000	1.13
@@ -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");
 



More information about the dovecot-cvs mailing list