diff src/master/login-process.c @ 8620:9edf4a6e0cdb HEAD

Always send LOGIN_DIR environment to login processes.
author Timo Sirainen <tss@iki.fi>
date Tue, 13 Jan 2009 13:12:21 -0500
parents b9faf4db2a9f
children e85c7cb22ad7
line wrap: on
line diff
--- a/src/master/login-process.c	Mon Jan 12 20:35:07 2009 -0500
+++ b/src/master/login-process.c	Tue Jan 13 13:12:21 2009 -0500
@@ -617,6 +617,7 @@
 		env_put(t_strconcat("TRUSTED_NETWORKS=",
 				    set->login_trusted_networks, NULL));
 	}
+	env_put(t_strconcat("LOGIN_DIR=", set->login_dir, NULL));
 }
 
 static pid_t create_login_process(struct login_group *group)
@@ -714,14 +715,6 @@
 	env_put(t_strdup_printf("LISTEN_FDS=%u", listen_count));
 	env_put(t_strdup_printf("SSL_LISTEN_FDS=%u", ssl_listen_count));
 
-	if (!group->set->login_chroot) {
-		/* no chrooting, but still change to the directory */
-		if (chdir(group->set->login_dir) < 0) {
-			i_fatal("chdir(%s) failed: %m",
-				group->set->login_dir);
-		}
-	}
-
 	restrict_process_size(group->set->login_process_size, (unsigned int)-1);
 
 	/* make sure we don't leak syslog fd, but do it last so that
@@ -892,16 +885,6 @@
 		}
 	}
 
-	if (!p->group->set->login_chroot) {
-		/* if we're not chrooting, we need to tell login process
-		   where its base directory is */
-		const char *str = t_strdup_printf("LOGIN_DIR=%s\n",
-						  p->group->set->login_dir);
-		len = strlen(str);
-		if (o_stream_send(p->output, str, len) != len)
-			ret = -1;
-	}
-
 	if (ret == 0 && o_stream_send(p->output, "\n", 1) != 1)
 		ret = -1;