X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/2f21487fa76ef002f7f8a3565e68460fd046a152..93a680e4c9c899d86ff3fde0933fb5367b34af50:/src/src/daemon.c diff --git a/src/src/daemon.c b/src/src/daemon.c index 65195ccd1..b73f76fcf 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2016 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions concerned with running Exim as a daemon */ @@ -341,6 +341,7 @@ arrange to unset the selector in the subprocess. */ if (LOGGING(smtp_connection)) { uschar *list = hosts_connection_nolog; + memset(sender_host_cache, 0, sizeof(sender_host_cache)); if (list != NULL && verify_check_host(&list) == OK) save_log_selector &= ~L_smtp_connection; else @@ -926,13 +927,12 @@ if (inetd_wait_mode) int on = 1; listen_socket_count = 1; - listen_sockets = store_get(sizeof(int *)); + listen_sockets = store_get(sizeof(int)); (void) close(3); if (dup2(0, 3) == -1) - { log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to dup inetd socket safely away: %s", strerror(errno)); - } + listen_sockets[0] = 3; (void) close(0); (void) close(1); @@ -956,8 +956,10 @@ if (inetd_wait_mode) /* As per below, when creating sockets ourselves, we handle tcp_nodelay for our own buffering; we assume though that inetd set the socket REUSEADDR. */ - if (tcp_nodelay) setsockopt(3, IPPROTO_TCP, TCP_NODELAY, - (uschar *)(&on), sizeof(on)); + if (tcp_nodelay) + if (setsockopt(3, IPPROTO_TCP, TCP_NODELAY, US &on, sizeof(on))) + log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to set socket NODELAY: %s", + strerror(errno)); } @@ -1275,7 +1277,7 @@ if (daemon_listen && !inetd_wait_mode) for (ipa = addresses; ipa != NULL; ipa = ipa->next) listen_socket_count++; - listen_sockets = store_get(sizeof(int *) * listen_socket_count); + listen_sockets = store_get(sizeof(int) * listen_socket_count); } /* daemon_listen but not inetd_wait_mode */ @@ -1380,8 +1382,7 @@ if (daemon_listen && !inetd_wait_mode) wildcard = ipa->address[0] == 0; } - listen_sockets[sk] = ip_socket(SOCK_STREAM, af); - if (listen_sockets[sk] < 0) + if ((listen_sockets[sk] = ip_socket(SOCK_STREAM, af)) < 0) { if (check_special_case(0, addresses, ipa, FALSE)) { @@ -1704,7 +1705,6 @@ else /* Do any work it might be useful to amortize over our children (eg: compile regex) */ -deliver_init(); dns_pattern_init(); #ifdef WITH_CONTENT_SCAN