19
19
#include <unistd.h>
20
20
#include <syslog.h>
22
bool disable_plaintext_auth, process_per_connection, greeting_capability;
22
bool disable_plaintext_auth, process_per_connection;
23
23
bool verbose_proctitle, verbose_ssl, verbose_auth, auth_debug;
24
bool ssl_require_client_cert;
24
bool ssl_required, ssl_require_client_cert;
25
25
const char *greeting, *log_format;
26
26
const char *const *log_format_elements;
27
const char *trusted_networks;
27
28
unsigned int max_connections;
28
29
unsigned int login_process_uid;
29
30
struct auth_client *auth_client;
69
static void sig_die(int signo, void *context ATTR_UNUSED)
70
static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED)
71
72
/* warn about being killed because of some signal, except SIGINT (^C)
72
73
which is too common at least while testing :) */
74
i_warning("Killed with signal %d", signo);
74
if (si->si_signo != SIGINT) {
75
i_warning("Killed with signal %d (by pid=%s uid=%s code=%s)",
76
si->si_signo, dec2str(si->si_pid),
78
lib_signal_code_to_str(si->si_signo, si->si_code));
75
80
io_loop_stop(ioloop);
264
271
value == NULL ? LOG_MAIL : atoi(value));
274
value = getenv("DOVECOT_VERSION");
275
if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
276
i_fatal("Dovecot version mismatch: "
277
"Master is v%s, login is v"PACKAGE_VERSION" "
278
"(if you don't care, set version_ignore=yes)", value);
267
281
value = getenv("LOGIN_DIR");
268
282
if (value == NULL)
269
283
i_fatal("LOGIN_DIR environment missing");
302
316
const char *value;
304
value = getenv("DOVECOT_VERSION");
305
if (value != NULL && strcmp(value, PACKAGE_VERSION) != 0) {
306
i_fatal("Dovecot version mismatch: "
307
"Master is v%s, login is v"PACKAGE_VERSION" "
308
"(if you don't care, set version_ignore=yes)", value);
311
318
lib_signals_init();
312
319
lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
313
320
lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL);
314
321
lib_signals_ignore(SIGPIPE, TRUE);
316
disable_plaintext_auth = getenv("DISABLE_PLAINTEXT_AUTH") != NULL;
317
323
process_per_connection = getenv("PROCESS_PER_CONNECTION") != NULL;
318
324
verbose_proctitle = getenv("VERBOSE_PROCTITLE") != NULL;
319
325
verbose_ssl = getenv("VERBOSE_SSL") != NULL;
320
326
verbose_auth = getenv("VERBOSE_AUTH") != NULL;
321
327
auth_debug = getenv("AUTH_DEBUG") != NULL;
328
ssl_required = getenv("SSL_REQUIRED") != NULL;
322
329
ssl_require_client_cert = getenv("SSL_REQUIRE_CLIENT_CERT") != NULL;
330
disable_plaintext_auth = ssl_required ||
331
getenv("DISABLE_PLAINTEXT_AUTH") != NULL;
324
333
greeting = getenv("GREETING");
325
334
if (greeting == NULL)
326
335
greeting = PACKAGE" ready.";
327
greeting_capability = getenv("GREETING_CAPABILITY") != NULL;
329
337
value = getenv("LOG_FORMAT_ELEMENTS");
330
338
if (value == NULL)
353
363
auth_client = auth_client_new(login_process_uid);
354
364
auth_client_set_connect_notify(auth_client, auth_connect_notify, NULL);
357
368
if (!ssl_initialized && ssl_listen_count > 0) {
358
369
/* this shouldn't happen, master should have
433
444
drop_privileges(&max_fds);
446
if (argv[1] != NULL && strcmp(argv[1], "-D") == 0)
447
restrict_access_allow_coredumps(TRUE);
435
449
process_title_init(argv, envp);
436
450
ioloop = io_loop_create();
437
451
io_loop_set_max_fd_count(ioloop, max_fds);