[dovecot-cvs] dovecot/src/util rawlog.c,1.8.2.2,1.8.2.3

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


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

Modified Files:
      Tag: branch_1_0
	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.8.2.2
retrieving revision 1.8.2.3
diff -u -d -r1.8.2.2 -r1.8.2.3
--- rawlog.c	26 Jan 2007 13:58:41 -0000	1.8.2.2
+++ rawlog.c	28 Mar 2007 20:07:34 -0000	1.8.2.3
@@ -273,13 +273,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 */
@@ -292,6 +295,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