/* 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
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)
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
}
}
- 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;