X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fdaemon.c;h=ebd06b523114f09c847d23fce968674a292d3193;hb=d5c0d8c9374623620844d539d4810da63e9abca1;hp=bc33aec45619dc9a13acb9393c74c0d041225928;hpb=4fab92fbc2b63bac2d89c1dae69fa1845cb640b7;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/daemon.c b/src/src/daemon.c index bc33aec45..ebd06b523 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 - 2016 */ +/* Copyright (c) University of Cambridge 1995 - 2017 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions concerned with running Exim as a daemon */ @@ -19,7 +19,7 @@ typedef struct smtp_slot { } smtp_slot; /* An empty slot for initializing (Standard C does not allow constructor -expressions in assigments except as initializers in declarations). */ +expressions in assignments except as initializers in declarations). */ static smtp_slot empty_smtp_slot = { 0, NULL }; @@ -290,7 +290,7 @@ if ((max_for_this_host > 0) && int other_host_count = 0; /* keep a count of non matches to optimise */ for (i = 0; i < smtp_accept_max; ++i) - if (smtp_slots[i].host_address != NULL) + if (smtp_slots[i].host_address) { if (Ustrcmp(sender_host_address, smtp_slots[i].host_address) == 0) host_accept_count++; @@ -542,9 +542,9 @@ if (pid == 0) DEBUG(D_receive) { int i; - if (sender_address != NULL) + if (sender_address) debug_printf("Sender: %s\n", sender_address); - if (recipients_list != NULL) + if (recipients_list) { debug_printf("Recipients:\n"); for (i = 0; i < recipients_count; i++) @@ -564,6 +564,17 @@ if (pid == 0) /* Reclaim up the store used in accepting this message */ + return_path = sender_address = NULL; + authenticated_sender = NULL; + sending_ip_address = NULL; + deliver_host_address = deliver_host = + deliver_domain_orig = deliver_localpart_orig = NULL; + dnslist_domain = dnslist_matched = NULL; + callout_address = NULL; +#ifndef DISABLE_DKIM + dkim_cur_signer = NULL; +#endif + acl_var_m = NULL; store_reset(reset_point); /* If queue_only is set or if there are too many incoming connections in @@ -734,6 +745,8 @@ else (void)close(dup_accept_socket); the incoming host address and an expanded active_hostname. */ log_close_all(); +interface_address = +sender_host_address = NULL; store_reset(reset_point); sender_host_address = NULL; } @@ -842,13 +855,12 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) /* If it's a listening daemon for which we are keeping track of individual subprocesses, deal with an accepting process that has terminated. */ - if (smtp_slots != NULL) + if (smtp_slots) { for (i = 0; i < smtp_accept_max; i++) - { if (smtp_slots[i].pid == pid) { - if (smtp_slots[i].host_address != NULL) + if (smtp_slots[i].host_address) store_free(smtp_slots[i].host_address); smtp_slots[i] = empty_smtp_slot; if (--smtp_accept_count < 0) smtp_accept_count = 0; @@ -856,7 +868,6 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) smtp_accept_count, (smtp_accept_count == 1)? "" : "es"); break; } - } if (i < smtp_accept_max) continue; /* Found an accepting process */ } @@ -1119,7 +1130,7 @@ if (daemon_listen && !inetd_wait_mode) } /* Create a list of default SMTP ports, to be used if local_interfaces - contains entries without explict ports. First count the number of ports, then + contains entries without explicit ports. First count the number of ports, then build a translated list in a vector. */ list = daemon_smtp_port; @@ -1425,6 +1436,9 @@ if (daemon_listen && !inetd_wait_mode) necessary for (some release of) USAGI Linux; other IP stacks fail at the listen() stage instead. */ +#ifdef TCP_FASTOPEN + tcp_fastopen_ok = TRUE; +#endif for(;;) { uschar *msg, *addr; @@ -1461,7 +1475,10 @@ if (daemon_listen && !inetd_wait_mode) #ifdef TCP_FASTOPEN if (setsockopt(listen_sockets[sk], IPPROTO_TCP, TCP_FASTOPEN, &smtp_connect_backlog, sizeof(smtp_connect_backlog))) + { DEBUG(D_any) debug_printf("setsockopt FASTOPEN: %s\n", strerror(errno)); + tcp_fastopen_ok = FALSE; + } #endif /* Start listening on the bound socket, establishing the maximum backlog of @@ -1670,6 +1687,16 @@ else if (daemon_listen) } else if (ipa->address[0] == 0) (void)sprintf(CS p, " port %d (IPv4)", ipa->port); + else if ( i > 0 + && host_is_tls_on_connect_port(ipa[-1].port) == (j > 0) + && Ustrcmp(ipa->address, ipa[-1].address) == 0 + ) + { + if (p[-1] == '}') p--; + while (isdigit(*--p)) ; + (void)sprintf(CS p+1, "%s%d,%d}", *p == ',' ? "" : "{", + ipa[-1].port, ipa->port); + } else (void)sprintf(CS p, " [%s]:%d", ipa->address, ipa->port); while (*p != 0) p++;