X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/a4034eb84d56cfa1e8525bcf8b2f5af74e916ace..5013d912e961203f2ab2d5f64be90255cda81b80:/src/src/exim.c diff --git a/src/src/exim.c b/src/src/exim.c index 95f8cef3b..383382072 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -12,7 +12,7 @@ Also a few functions that don't naturally fit elsewhere. */ #include "exim.h" -#ifdef __GLIBC__ +#if defined(__GLIBC__) && !defined(__UCLIBC__) # include #endif @@ -365,7 +365,7 @@ return 0; /* Exim uses a time + a pid to generate a unique identifier in two places: its message IDs, and in file names for maildir deliveries. Because some OS now re-use pids within the same second, sub-second times are now being used. -However, for absolute certaintly, we must ensure the clock has ticked before +However, for absolute certainty, we must ensure the clock has ticked before allowing the relevant process to complete. At the time of implementation of this code (February 2003), the speed of processors is such that the clock will invariably have ticked already by the time a process has done its job. This @@ -840,9 +840,15 @@ fprintf(f, "Support for:"); #ifdef SUPPORT_SOCKS fprintf(f, " SOCKS"); #endif +#ifdef TCP_FASTOPEN + fprintf(f, " TCP_Fast_Open"); +#endif #ifdef EXPERIMENTAL_LMDB fprintf(f, " Experimental_LMDB"); #endif +#ifdef EXPERIMENTAL_QUEUEFILE + fprintf(f, " Experimental_QUEUEFILE"); +#endif #ifdef EXPERIMENTAL_SPF fprintf(f, " Experimental_SPF"); #endif @@ -996,6 +1002,9 @@ fprintf(f, "Transports:"); #ifdef TRANSPORT_PIPE fprintf(f, " pipe"); #endif +#ifdef EXPERIMENTAL_QUEUEFILE + fprintf(f, " queuefile"); +#endif #ifdef TRANSPORT_SMTP fprintf(f, " smtp"); #endif @@ -1010,6 +1019,8 @@ if (fixed_never_users[0] > 0) fprintf(f, "%d\n", (unsigned int)fixed_never_users[i]); } +fprintf(f, "Configure owner: %d:%d\n", config_uid, config_gid); + fprintf(f, "Size of off_t: " SIZE_T_FMT "\n", sizeof(off_t)); /* Everything else is details which are only worth reporting when debugging. @@ -1033,7 +1044,7 @@ DEBUG(D_any) do { fprintf(f, "Compiler: \n"); #endif -#ifdef __GLIBC__ +#if defined(__GLIBC__) && !defined(__UCLIBC__) fprintf(f, "Library version: Glibc: Compile: %d.%d\n", __GLIBC__, __GLIBC_MINOR__); if (__GLIBC_PREREQ(2, 1)) @@ -1320,7 +1331,7 @@ static void exim_usage(uschar *progname) { -/* Handle specific program invocation varients */ +/* Handle specific program invocation variants */ if (Ustrcmp(progname, US"-mailq") == 0) { fprintf(stderr, @@ -1688,8 +1699,6 @@ big_buffer = store_malloc(big_buffer_size); descriptive text. */ set_process_info("initializing"); -readconf_features(); -readconf_options(); os_restarting_signal(SIGUSR1, usr1_handler); /* SIGHUP is used to get the daemon to reconfigure. It gets set as appropriate @@ -1891,7 +1900,7 @@ for (i = 1; i < argc; i++) break; } - /* An option consistion of -- terminates the options */ + /* An option consisting of -- terminates the options */ if (Ustrcmp(arg, "--") == 0) { @@ -2285,7 +2294,7 @@ for (i = 1; i < argc; i++) #ifdef ALT_CONFIG_PREFIX int sep = 0; int len = Ustrlen(ALT_CONFIG_PREFIX); - uschar *list = argrest; + const uschar *list = argrest; uschar *filename; while((filename = string_nextinlist(&list, &sep, big_buffer, big_buffer_size)) != NULL) @@ -2448,7 +2457,7 @@ for (i = 1; i < argc; i++) exit(EXIT_FAILURE); } - m = macro_create(name, s, TRUE); + m = macro_create(name, s, TRUE, FALSE); if (clmacro_count >= MAX_CLMACROS) { @@ -2699,18 +2708,19 @@ for (i = 1; i < argc; i++) return EXIT_FAILURE; } - /* Set up $sending_ip_address and $sending_port */ + /* Set up $sending_ip_address and $sending_port, unless proxied */ - if (getsockname(fileno(stdin), (struct sockaddr *)(&interface_sock), - &size) == 0) - sending_ip_address = host_ntoa(-1, &interface_sock, NULL, - &sending_port); - else - { - fprintf(stderr, "exim: getsockname() failed after -MC option: %s\n", - strerror(errno)); - return EXIT_FAILURE; - } + if (!continue_proxy_cipher) + if (getsockname(fileno(stdin), (struct sockaddr *)(&interface_sock), + &size) == 0) + sending_ip_address = host_ntoa(-1, &interface_sock, NULL, + &sending_port); + else + { + fprintf(stderr, "exim: getsockname() failed after -MC option: %s\n", + strerror(errno)); + return EXIT_FAILURE; + } if (running_in_test_harness) millisleep(500); break; @@ -2718,7 +2728,7 @@ for (i = 1; i < argc; i++) else if (*argrest == 'C' && argrest[1] && !argrest[2]) { - switch(argrest[1]) + switch(argrest[1]) { /* -MCA: set the smtp_authenticated flag; this is useful only when it precedes -MC (see above). The flag indicates that the host to which @@ -2762,6 +2772,19 @@ for (i = 1; i < argc; i++) case 'S': smtp_peer_options |= PEER_OFFERED_SIZE; break; #ifdef SUPPORT_TLS + /* -MCt: similar to -MCT below but the connection is still open + via a proxy proces which handles the TLS context and coding. + Require three arguments for the proxied local address and port, + and the TLS cipher. */ + + case 't': if (++i < argc) sending_ip_address = argv[i]; + else badarg = TRUE; + if (++i < argc) sending_port = (int)(Uatol(argv[i])); + else badarg = TRUE; + if (++i < argc) continue_proxy_cipher = argv[i]; + else badarg = TRUE; + /*FALLTHROUGH*/ + /* -MCT: set the tls_offered flag; this is useful only when it precedes -MC (see above). The flag indicates that the host to which Exim is connected has offered TLS support. */ @@ -3186,7 +3209,10 @@ for (i = 1; i < argc; i++) } else { + int old_pool = store_pool; + store_pool = POOL_PERM; received_protocol = string_copyn(argrest, hn - argrest); + store_pool = old_pool; sender_host_name = hn + 1; } } @@ -5078,7 +5104,7 @@ if (host_checking) verify_get_ident(1413); } - /* In case the given address is a non-canonical IPv6 address, canonicize + /* In case the given address is a non-canonical IPv6 address, canonicalize it. The code works for both IPv4 and IPv6, as it happens. */ size = host_aton(sender_host_address, x); @@ -5112,12 +5138,21 @@ if (host_checking) if (smtp_start_session()) { - reset_point = store_get(0); - for (;;) + for (reset_point = store_get(0); ; store_reset(reset_point)) { - store_reset(reset_point); if (smtp_setup_msg() <= 0) break; if (!receive_msg(FALSE)) break; + + return_path = sender_address = NULL; + dnslist_domain = dnslist_matched = NULL; +#ifndef DISABLE_DKIM + dkim_cur_signer = NULL; +#endif + acl_var_m = NULL; + deliver_localpart_orig = NULL; + deliver_domain_orig = NULL; + callout_address = sending_ip_address = NULL; + sender_rate = sender_rate_limit = sender_rate_period = NULL; } smtp_log_no_mail(); } @@ -5240,8 +5275,11 @@ if (smtp_input) } else { - if (received_protocol == NULL) + int old_pool = store_pool; + store_pool = POOL_PERM; + if (!received_protocol) received_protocol = string_sprintf("local%s", called_as); + store_pool = old_pool; set_process_info("accepting a local non-SMTP message from <%s>", sender_address); } @@ -5327,7 +5365,7 @@ February 2003: That's *still* not the end of the story. There are now versions of Linux (where SIG_IGN does work) that are picky. If, having set SIG_IGN, a process then calls waitpid(), a grumble is written to the system log, because this is logically inconsistent. In other words, it doesn't like the paranoia. -As a consequenc of this, the waitpid() below is now excluded if we are sure +As a consequence of this, the waitpid() below is now excluded if we are sure that SIG_IGN works. */ if (!synchronous_delivery) @@ -5355,7 +5393,6 @@ collapsed). */ while (more) { - store_reset(reset_point); message_id[0] = 0; /* Handle the SMTP case; call smtp_setup_mst() to deal with the initial SMTP @@ -5397,7 +5434,7 @@ while (more) more = receive_msg(extract_recipients); if (message_id[0] == 0) { - if (more) continue; + if (more) goto moreloop; smtp_log_no_mail(); /* Log no mail if configured */ exim_exit(EXIT_FAILURE); } @@ -5547,7 +5584,7 @@ while (more) if (!receive_timeout) { - struct timeval t = { 30*60, 0 }; /* 30 minutess */ + struct timeval t = { 30*60, 0 }; /* 30 minutes */ fd_set r; FD_ZERO(&r); FD_SET(0, &r); @@ -5760,6 +5797,23 @@ while (more) #ifndef SIG_IGN_WORKS while (waitpid(-1, NULL, WNOHANG) > 0); #endif + +moreloop: + return_path = sender_address = NULL; + authenticated_sender = NULL; + deliver_localpart_orig = NULL; + deliver_domain_orig = NULL; + deliver_host = deliver_host_address = NULL; + dnslist_domain = dnslist_matched = NULL; +#ifdef WITH_CONTENT_SCAN + malware_name = NULL; +#endif + callout_address = NULL; + sending_ip_address = NULL; + acl_var_m = NULL; + { int i; for(i=0; i