Mercurial > dovecot > original-hg > dovecot-1.2
changeset 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 | 9c4f9c47299b |
children | 22985329af92 |
files | src/login-common/main.c src/master/login-process.c |
diffstat | 2 files changed, 5 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/login-common/main.c Mon Jan 12 20:35:07 2009 -0500 +++ b/src/login-common/main.c Tue Jan 13 13:12:21 2009 -0500 @@ -264,10 +264,10 @@ /* if we don't chroot, we must chdir */ value = getenv("LOGIN_DIR"); - if (value != NULL) { - if (chdir(value) < 0) - i_error("chdir(%s) failed: %m", value); - } + if (value == NULL) + i_fatal("LOGIN_DIR environment missing"); + if (chdir(value) < 0) + i_error("chdir(%s) failed: %m", value); } /* Initialize SSL proxy so it can read certificate and private
--- 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;