dovecot-1.1: Always send LOGIN_DIR environment to login processes.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jan 13 20:13:30 EET 2009
details: http://hg.dovecot.org/dovecot-1.1/rev/7782b2ed9b61
changeset: 8090:7782b2ed9b61
user: Timo Sirainen <tss at iki.fi>
date: Tue Jan 13 13:12:21 2009 -0500
description:
Always send LOGIN_DIR environment to login processes.
diffstat:
2 files changed, 5 insertions(+), 22 deletions(-)
src/login-common/main.c | 8 ++++----
src/master/login-process.c | 19 +------------------
diffs (61 lines):
diff -r 9504dbe25d0f -r 7782b2ed9b61 src/login-common/main.c
--- a/src/login-common/main.c Mon Jan 12 19:18:56 2009 -0500
+++ b/src/login-common/main.c Tue Jan 13 13:12:21 2009 -0500
@@ -263,10 +263,10 @@ static void drop_privileges(void)
/* 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
diff -r 9504dbe25d0f -r 7782b2ed9b61 src/master/login-process.c
--- a/src/master/login-process.c Mon Jan 12 19:18:56 2009 -0500
+++ b/src/master/login-process.c Tue Jan 13 13:12:21 2009 -0500
@@ -591,6 +591,7 @@ static void login_process_init_env(struc
set->imap_capability :
set->imap_generated_capability, NULL));
}
+ env_put(t_strconcat("LOGIN_DIR=", set->login_dir, NULL));
}
static pid_t create_login_process(struct login_group *group)
@@ -687,14 +688,6 @@ static pid_t create_login_process(struct
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);
@@ -866,16 +859,6 @@ static int login_process_send_env(struct
}
}
- 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;
More information about the dovecot-cvs
mailing list