X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/8a5d7421f117c332c90b94bfd6f50ca71494d705..HEAD:/src/src/exim.c?ds=sidebyside diff --git a/src/src/exim.c b/src/src/exim.c index 5c9e64021..8111a4489 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) The Exim Maintainers 2020 - 2023 */ +/* Copyright (c) The Exim Maintainers 2020 - 2024 */ /* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ /* SPDX-License-Identifier: GPL-2.0-or-later */ @@ -237,7 +237,7 @@ va_end(ap); static void term_handler(int sig) { -exit(1); +exim_exit(EXIT_FAILURE); } @@ -997,32 +997,35 @@ if (s) static gstring * show_db_version(gstring * g) { +g = string_cat(g, US"Hints DB:\n"); #ifdef DB_VERSION_STRING DEBUG(D_any) { - g = string_fmt_append(g, "Library version: BDB: Compile: %s\n", DB_VERSION_STRING); - g = string_fmt_append(g, " Runtime: %s\n", + g = string_fmt_append(g, " Library version: BDB: Compile: %s\n", DB_VERSION_STRING); + g = string_fmt_append(g, " Runtime: %s\n", db_version(NULL, NULL, NULL)); } else - g = string_fmt_append(g, "Berkeley DB: %s\n", DB_VERSION_STRING); + g = string_fmt_append(g, " Berkeley DB: %s\n", DB_VERSION_STRING); #elif defined(BTREEVERSION) && defined(HASHVERSION) # ifdef USE_DB - g = string_cat(g, US"Probably Berkeley DB version 1.8x (native mode)\n"); + g = string_cat(g, US" Probably Berkeley DB version 1.8x (native mode)\n"); # else - g = string_cat(g, US"Probably Berkeley DB version 1.8x (compatibility mode)\n"); + g = string_cat(g, US" Probably Berkeley DB version 1.8x (compatibility mode)\n"); # endif #elif defined(_DBM_RDONLY) || defined(dbm_dirfno) -g = string_cat(g, US"Probably ndbm\n"); +g = string_cat(g, US" Probably ndbm\n"); +#elif defined(USE_SQLITE) +g = string_cat(g, US" Using sqlite3\n"); #elif defined(USE_TDB) -g = string_cat(g, US"Using tdb\n"); +g = string_cat(g, US" Using tdb\n"); #else # ifdef USE_GDBM - g = string_cat(g, US"Probably GDBM (native mode)\n"); +g = string_cat(g, US" Probably GDBM (native mode)\n"); # else - g = string_cat(g, US"Probably GDBM (compatibility mode)\n"); +g = string_cat(g, US" Probably GDBM (compatibility mode)\n"); # endif #endif return g; @@ -1108,6 +1111,9 @@ g = string_cat(g, US"Support for:"); #ifndef DISABLE_ESMTP_LIMITS g = string_cat(g, US" ESMTP_Limits"); #endif +#ifndef DISABLE_WELLKNOWN + g = string_cat(g, US" ESMTP_Wellknown"); +#endif #ifndef DISABLE_EVENT g = string_cat(g, US" Event"); #endif @@ -2339,9 +2345,9 @@ on the second character (the one after '-'), to save some effort. */ /* -bh: Host checking - an IP address must follow. */ case 'h': - if (!*argrest || Ustrcmp(argrest, "c") == 0) + if ( (!*argrest || Ustrcmp(argrest, "c") == 0) + && ++i < argc) { - if (++i >= argc) { badarg = TRUE; break; } sender_host_address = string_copy_taint( exim_str_fail_toolong(argv[i], EXIM_IPADDR_MAX, "-bh"), GET_TAINTED); @@ -2349,7 +2355,8 @@ on the second character (the one after '-'), to save some effort. */ f.host_checking_callout = *argrest == 'c'; message_logs = FALSE; } - else badarg = TRUE; + else + badarg = TRUE; break; /* -bi: This option is used by sendmail to initialize *the* alias file, @@ -4685,12 +4692,12 @@ if (malware_test_file) if ((result = malware_in_file(malware_test_file)) == FAIL) { printf("No malware found.\n"); - exit(EXIT_SUCCESS); + exim_exit(EXIT_SUCCESS); } if (result != OK) { printf("Malware lookup returned non-okay/fail: %d\n", result); - exit(EXIT_FAILURE); + exim_exit(EXIT_FAILURE); } if (malware_name) printf("Malware found: %s\n", malware_name); @@ -4699,7 +4706,7 @@ if (malware_test_file) #else printf("Malware scanning not enabled at compile time.\n"); #endif - exit(EXIT_FAILURE); + exim_exit(EXIT_FAILURE); } /* Handle a request to list the delivery queue */ @@ -4708,7 +4715,7 @@ if (list_queue) { set_process_info("listing the queue"); queue_list(list_queue_option, argv + recipients_arg, argc - recipients_arg); - exit(EXIT_SUCCESS); + exim_exit(EXIT_SUCCESS); } /* Handle a request to count the delivery queue */ @@ -4717,7 +4724,7 @@ if (count_queue) { set_process_info("counting the queue"); fprintf(stdout, "%u\n", queue_count()); - exit(EXIT_SUCCESS); + exim_exit(EXIT_SUCCESS); } /* Handle actions on specific messages, except for the force delivery and @@ -4756,7 +4763,7 @@ if (msg_action_arg > 0 && msg_action != MSG_DELIVER && msg_action != MSG_LOAD) else if (!queue_action(argv[msg_action_arg], msg_action, argv, argc, recipients_arg)) yield = EXIT_FAILURE; - exit(yield); + exim_exit(yield); } /* We used to set up here to skip reading the ACL section, on @@ -5159,7 +5166,7 @@ if (f.daemon_listen || f.inetd_wait_mode || is_multiple_qrun()) (void)gettimeofday(&t0, NULL); # endif if (!tls_dropprivs_validate_require_cipher(FALSE)) - exit(1); + exim_exit(EXIT_FAILURE); # ifdef MEASURE_TIMING report_time_since(&t0, US"validate_ciphers (delta)"); # endif @@ -5443,11 +5450,14 @@ if (host_checking) } /* In case the given address is a non-canonical IPv6 address, canonicalize - it. The code works for both IPv4 and IPv6, as it happens. */ + it. Use the compressed form for IPv6. */ size = host_aton(sender_host_address, x); sender_host_address = store_get(48, GET_UNTAINTED); /* large enough for full IPv6 */ - (void)host_nmtoa(size, x, -1, sender_host_address, ':'); + if (size == 1) + (void) host_nmtoa(size, x, -1, sender_host_address, ':'); + else + (void) ipv6_nmtoa(x, sender_host_address); /* Now set up for testing */ @@ -6189,3 +6199,5 @@ return 0; /* To stop compiler warning */ /* End of exim.c */ +/* vi: aw ai sw=2 +*/