[dovecot-cvs] dovecot/src/master mail-process.c,1.13,1.14 main.c,1.42,1.43

cras at procontrol.fi cras at procontrol.fi
Wed Apr 16 20:05:47 EEST 2003


Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv180/master

Modified Files:
	mail-process.c main.c 
Log Message:
chdir() to base_dir at startup. chdir() mail processes to home dir if it's
known.



Index: mail-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mail-process.c	15 Apr 2003 16:58:48 -0000	1.13
+++ mail-process.c	16 Apr 2003 16:05:45 -0000	1.14
@@ -105,7 +105,7 @@
 			const char *data)
 {
 	static const char *argv[] = { NULL, NULL, NULL };
-	const char *host, *mail;
+	const char *host, *mail, *home_dir;
 	char title[1024];
 	pid_t pid;
 	int i, err;
@@ -154,8 +154,14 @@
 
 	restrict_process_size(process_size, (unsigned int)-1);
 
+	home_dir = data + reply->home_idx;
+	if (*home_dir != '\0') {
+		if (chdir(home_dir) < 0)
+			i_fatal("chdir(%s) failed: %m", home_dir);
+	}
+
 	env_put("LOGGED_IN=1");
-	env_put(t_strconcat("HOME=", data + reply->home_idx, NULL));
+	env_put(t_strconcat("HOME=", home_dir, NULL));
 	env_put(t_strconcat("MAIL_CACHE_FIELDS=",
 			    set->mail_cache_fields, NULL));
 	env_put(t_strconcat("MAIL_NEVER_CACHE_FIELDS=",

Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/main.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- main.c	15 Apr 2003 16:58:48 -0000	1.42
+++ main.c	16 Apr 2003 16:05:45 -0000	1.43
@@ -396,6 +396,9 @@
 
 	if (setsid() < 0)
 		i_fatal("setsid() failed: %m");
+
+	if (chdir(set->base_dir) < 0)
+		i_fatal("chdir(%s) failed: %m", set->base_dir);
 }
 
 static void print_help(void)




More information about the dovecot-cvs mailing list