From b3e9324852c39d1ec618079e82eb0b2215182f18 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Tue, 5 Oct 2021 17:05:04 +0000 Subject: [PATCH] Up to 4.95; still using SRS_ALT implementation over new, native one (need migration guide first) --- branch.sh | 4 +- exim.spec | 15 +- exim4-EDITME.patch | 4 +- localscan_dlopen_exim_4.20_or_better.patch | 147 ++++++++++++------- messageid.patch | 155 --------------------- 5 files changed, 103 insertions(+), 222 deletions(-) delete mode 100644 messageid.patch diff --git a/branch.sh b/branch.sh index c72985c..f8a676f 100755 --- a/branch.sh +++ b/branch.sh @@ -2,8 +2,8 @@ set -e url=git://git.exim.org/exim.git package=exim -tag=exim-4.94.2 -branch=exim-4.94.2+fixes +tag=exim-4.95 +branch=exim-4.95+fixes out=$package-git.patch repo=$package.git diff --git a/exim.spec b/exim.spec index 3226683..3265c5b 100644 --- a/exim.spec +++ b/exim.spec @@ -23,15 +23,15 @@ Summary: University of Cambridge Mail Transfer Agent Summary(pl.UTF-8): Agent Transferu Poczty Uniwersytetu w Cambridge Summary(pt_BR.UTF-8): Servidor de correio eletrônico exim Name: exim -Version: 4.94.2 -Release: 6 +Version: 4.95 +Release: 1 Epoch: 2 License: GPL v2+ Group: Networking/Daemons/SMTP Source0: ftp://ftp.exim.org/pub/exim/exim4/%{name}-%{version}.tar.bz2 -# Source0-md5: e484d048bf0541a27951560ce3bf6d93 +# Source0-md5: 0c66c53a7c9ebdcfae04f9d25821333d Source1: ftp://ftp.exim.org/pub/exim/exim4/%{name}-html-%{version}.tar.bz2 -# Source1-md5: 50cbdaecc5542cb2dfa382aa041fe2bc +# Source1-md5: ce74af7115255c4184d97829575bf080 Source2: %{name}.init Source3: %{name}.cron.db Source4: %{name}4.conf @@ -58,7 +58,6 @@ Patch3: exim-defs.patch Patch4: %{name}4-Makefile-Default.patch # http://marc.merlins.org/linux/exim/files/sa-exim-cvs/localscan_dlopen_exim_4.20_or_better.patch Patch5: localscan_dlopen_%{name}_4.20_or_better.patch -Patch6: messageid.patch Patch8: %{name}-spam-timeout.patch @@ -176,14 +175,13 @@ Pliki nagłówkowe dla Exima. %prep %setup -q -a1 -a7 -%patch100 -p2 +#%patch100 -p2 %patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 -%patch6 -p2 %patch8 -p1 @@ -204,7 +202,6 @@ EXPERIMENTAL_DCC=yes EXPERIMENTAL_PRDR=yes EXPERIMENTAL_DSN_INFO=yes EXPERIMENTAL_QUEUEFILE=yes -EXPERIMENTAL_QUEUE_RAMP=yes SUPPORT_DANE=yes SUPPORT_I18N=yes SUPPORT_I18N_2008=yes @@ -219,7 +216,7 @@ SUPPORT_SPF=yes LOOKUP_LIBS+=-lspf2 %endif %if %{with srs} -EXPERIMENTAL_SRS=yes +EXPERIMENTAL_SRS_ALT=yes LOOKUP_LIBS+=-lsrs_alt %endif %if %{with hiredis} diff --git a/exim4-EDITME.patch b/exim4-EDITME.patch index e22fef4..93de4d5 100644 --- a/exim4-EDITME.patch +++ b/exim4-EDITME.patch @@ -28,8 +28,8 @@ # If you specify EXIM_USER as a name, this is looked up at build time, and the # uid number is built into the binary. However, you can specify that this -@@ -211,11 +212,11 @@ SPOOL_DIRECTORY=/var/spool/exim - # If you are buliding with TLS, the library configuration must be done: +@@ -211,11 +211,11 @@ SPOOL_DIRECTORY=/var/spool/exim + # If you are building with TLS, the library configuration must be done: # Uncomment this if you are using OpenSSL -# USE_OPENSSL=yes diff --git a/localscan_dlopen_exim_4.20_or_better.patch b/localscan_dlopen_exim_4.20_or_better.patch index d1d223a..0947c3c 100644 --- a/localscan_dlopen_exim_4.20_or_better.patch +++ b/localscan_dlopen_exim_4.20_or_better.patch @@ -1,19 +1,18 @@ -diff -urN exim-4.94.org/src/config.h.defaults exim-4.94/src/config.h.defaults ---- exim-4.94.org/src/config.h.defaults 2020-05-30 22:35:38.000000000 +0200 -+++ exim-4.94/src/config.h.defaults 2020-11-27 08:10:34.967732017 +0100 -@@ -33,6 +33,8 @@ - - #define AUTH_VARS 3 - -+#define DLOPEN_LOCAL_SCAN -+ - #define BIN_DIRECTORY - - #define CONFIGURE_FILE -diff -urN exim-4.94.org/src/EDITME exim-4.94/src/EDITME ---- exim-4.94.org/src/EDITME 2020-11-27 08:10:27.727507700 +0100 -+++ exim-4.94/src/EDITME 2020-11-27 08:10:34.967732017 +0100 -@@ -878,6 +878,21 @@ +Description: Allow one to use and switch between different local_scan functions + without recompiling exim. + http://marc.merlins.org/linux/exim/files/sa-exim-current/ Original patch from + David Woodhouse, modified first by Derrick 'dman' Hudson and then by Marc + MERLIN for SA-Exim and minor/major API version tracking +Author: David Woodhouse, Derrick 'dman' Hudson, Marc MERLIN +Origin: other, http://marc.merlins.org/linux/exim/files/sa-exim-current/ +Forwarded: https://bugs.exim.org/show_bug.cgi?id=2671 +Last-Update: 2021-07-28 + +--- a/src/EDITME ++++ b/src/EDITME +@@ -881,10 +881,25 @@ + # as the traditional crypt() function. + # *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** #------------------------------------------------------------------------------ @@ -35,10 +34,28 @@ diff -urN exim-4.94.org/src/EDITME exim-4.94/src/EDITME # The default distribution of Exim contains only the plain text form of the # documentation. Other forms are available separately. If you want to install # the documentation in "info" format, first fetch the Texinfo documentation -diff -urN exim-4.94.org/src/globals.c exim-4.94/src/globals.c ---- exim-4.94.org/src/globals.c 2020-11-27 08:10:27.714173954 +0100 -+++ exim-4.94/src/globals.c 2020-11-27 08:10:34.967732017 +0100 -@@ -117,6 +117,10 @@ + # sources from the ftp directory and unpack them, which should create files + # with the extension "texinfo" in the doc directory. You may find that the +--- a/src/config.h.defaults ++++ b/src/config.h.defaults +@@ -33,10 +33,12 @@ + #define AUTH_SPA + #define AUTH_TLS + + #define AUTH_VARS 4 + ++#define DLOPEN_LOCAL_SCAN ++ + #define BIN_DIRECTORY + + #define CONFIGURE_FILE + #define CONFIGURE_FILE_USE_EUID + #define CONFIGURE_FILE_USE_NODE +--- a/src/globals.c ++++ b/src/globals.c +@@ -119,10 +119,14 @@ + uschar *dsn_envid = NULL; + int dsn_ret = 0; const pcre *regex_DSN = NULL; uschar *dsn_advertise_hosts = NULL; @@ -49,10 +66,13 @@ diff -urN exim-4.94.org/src/globals.c exim-4.94/src/globals.c #ifndef DISABLE_TLS BOOL gnutls_compat_mode = FALSE; BOOL gnutls_allow_auto_pkcs11 = FALSE; -diff -urN exim-4.94.org/src/globals.h exim-4.94/src/globals.h ---- exim-4.94.org/src/globals.h 2020-11-27 08:10:27.714173954 +0100 -+++ exim-4.94/src/globals.h 2020-11-27 08:10:34.967732017 +0100 -@@ -148,6 +148,9 @@ + uschar *hosts_require_alpn = NULL; + uschar *openssl_options = NULL; +--- a/src/globals.h ++++ b/src/globals.h +@@ -154,10 +154,13 @@ + extern uschar *dsn_envid; /* DSN envid string */ + extern int dsn_ret; /* DSN ret type*/ extern const pcre *regex_DSN; /* For recognizing DSN settings */ extern uschar *dsn_advertise_hosts; /* host for which TLS is advertised */ @@ -62,10 +82,13 @@ diff -urN exim-4.94.org/src/globals.h exim-4.94/src/globals.h /* Input-reading functions for messages, so we can use special ones for incoming TCP/IP. */ -diff -urN exim-4.94.org/src/local_scan.c exim-4.94/src/local_scan.c ---- exim-4.94.org/src/local_scan.c 2020-05-30 22:35:38.000000000 +0200 -+++ exim-4.94/src/local_scan.c 2020-11-27 08:10:34.967732017 +0100 -@@ -6,22 +6,6 @@ + extern int (*lwr_receive_getc)(unsigned); + extern uschar * (*lwr_receive_getbuf)(unsigned *); +--- a/src/local_scan.c ++++ b/src/local_scan.c +@@ -4,60 +4,135 @@ + + /* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -88,10 +111,10 @@ diff -urN exim-4.94.org/src/local_scan.c exim-4.94/src/local_scan.c /* This is the only Exim header that you should include. The effect of including any other Exim header is not defined, and may change from release to release. Use only the documented interface! */ -@@ -29,37 +13,130 @@ - #include "local_scan.h" + #include "local_scan.h" +- -/* This is a "do-nothing" version of a local_scan() function. The arguments -are: - @@ -118,7 +141,6 @@ diff -urN exim-4.94.org/src/local_scan.c exim-4.94/src/local_scan.c -*/ +#ifdef DLOPEN_LOCAL_SCAN +#include -+#include +static int (*local_scan_fn)(int fd, uschar **return_text) = NULL; +static int load_local_scan_library(void); +#endif @@ -126,9 +148,8 @@ diff -urN exim-4.94.org/src/local_scan.c exim-4.94/src/local_scan.c int local_scan(int fd, uschar **return_text) { - fd = fd; /* Keep picky compilers happy */ - return_text = return_text; -return LOCAL_SCAN_ACCEPT; ++ +#ifdef DLOPEN_LOCAL_SCAN +/* local_scan_path is defined AND not the empty string */ +if (local_scan_path && *local_scan_path) @@ -159,8 +180,8 @@ diff -urN exim-4.94.org/src/local_scan.c exim-4.94/src/local_scan.c +else +#endif + return LOCAL_SCAN_ACCEPT; - } - ++} ++ +#ifdef DLOPEN_LOCAL_SCAN + +static int load_local_scan_library(void) @@ -238,16 +259,16 @@ diff -urN exim-4.94.org/src/local_scan.c exim-4.94/src/local_scan.c + return FALSE; + } +return TRUE; -+} -+ + } + +#endif /* DLOPEN_LOCAL_SCAN */ -+ + /* End of local_scan.c */ -diff -urN exim-4.94.org/src/local_scan.h exim-4.94/src/local_scan.h ---- exim-4.94.org/src/local_scan.h 2020-05-30 22:35:38.000000000 +0200 -+++ exim-4.94/src/local_scan.h 2020-11-27 08:10:34.967732017 +0100 -@@ -27,6 +27,7 @@ +--- a/src/local_scan.h ++++ b/src/local_scan.h +@@ -25,10 +25,11 @@ + /* Some basic types that make some things easier, the Exim configuration + settings, and the store functions. */ #include #include @@ -255,7 +276,11 @@ diff -urN exim-4.94.org/src/local_scan.h exim-4.94/src/local_scan.h #include "config.h" #include "mytypes.h" #include "store.h" -@@ -166,6 +167,9 @@ + + +@@ -164,10 +165,13 @@ + extern header_line *header_last; /* Final header */ + extern header_line *header_list; /* First header */ extern BOOL host_checking; /* Set when checking a host */ extern uschar *interface_address; /* Interface for incoming call */ extern int interface_port; /* Port number for incoming call */ @@ -265,30 +290,38 @@ diff -urN exim-4.94.org/src/local_scan.h exim-4.94/src/local_scan.h extern uschar *message_id; /* Internal id of message being handled */ extern uschar *received_protocol; /* Name of incoming protocol */ extern int recipients_count; /* Number of recipients */ -@@ -235,4 +239,6 @@ + extern recipient_item *recipients_list;/* List of recipient addresses */ + extern unsigned char *sender_address; /* Sender address */ +@@ -233,6 +237,8 @@ + extern pid_t child_open_exim_function(int *, const uschar *); + extern pid_t child_open_exim2_function(int *, uschar *, uschar *, const uschar *); extern pid_t child_open_function(uschar **, uschar **, int, int *, int *, BOOL, const uschar *); #endif +#pragma GCC visibility pop + /* End of local_scan.h */ -diff -urN exim-4.94.org/src/readconf.c exim-4.94/src/readconf.c ---- exim-4.94.org/src/readconf.c 2020-11-27 08:10:27.704173644 +0100 -+++ exim-4.94/src/readconf.c 2020-11-27 08:10:34.967732017 +0100 -@@ -205,6 +205,9 @@ +--- a/src/readconf.c ++++ b/src/readconf.c +@@ -213,10 +213,13 @@ + #endif + { "local_from_check", opt_bool, {&local_from_check} }, { "local_from_prefix", opt_stringptr, {&local_from_prefix} }, { "local_from_suffix", opt_stringptr, {&local_from_suffix} }, { "local_interfaces", opt_stringptr, {&local_interfaces} }, +#ifdef DLOPEN_LOCAL_SCAN -+ { "local_scan_path", opt_stringptr, {&local_scan_path} }, ++ { "local_scan_path", opt_stringptr, &local_scan_path }, +#endif #ifdef HAVE_LOCAL_SCAN { "local_scan_timeout", opt_time, {&local_scan_timeout} }, #endif -diff -urN exim-4.94.org/src/string.c exim-4.94/src/string.c ---- exim-4.94.org/src/string.c 2020-11-27 08:10:27.704173644 +0100 -+++ exim-4.94/src/string.c 2020-11-27 08:10:34.971065453 +0100 -@@ -418,6 +418,7 @@ + { "local_sender_retain", opt_bool, {&local_sender_retain} }, + { "localhost_number", opt_stringptr, {&host_number_string} }, +--- a/src/string.c ++++ b/src/string.c +@@ -416,10 +416,11 @@ + + #if (defined(HAVE_LOCAL_SCAN) || defined(EXPAND_DLFUNC)) \ && !defined(MACRO_PREDEF) && !defined(COMPILE_UTILITY) @@ -296,7 +329,11 @@ diff -urN exim-4.94.org/src/string.c exim-4.94/src/string.c /************************************************* * Copy and save string * *************************************************/ -@@ -470,6 +471,7 @@ + + /* +@@ -468,10 +469,11 @@ + uschar *ss = store_get(n + 1, is_tainted(s)); + Ustrncpy(ss, s, n); ss[n] = 0; return ss; } @@ -304,3 +341,5 @@ diff -urN exim-4.94.org/src/string.c exim-4.94/src/string.c #endif + /************************************************* + * Copy and save string in malloc'd store * diff --git a/messageid.patch b/messageid.patch deleted file mode 100644 index 78c0631..0000000 --- a/messageid.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 889894461aa958da4604299acc161c29e2aa603c Mon Sep 17 00:00:00 2001 -From: Jeremy Harris -Date: Sun, 5 Sep 2021 11:32:09 +0100 -Subject: [PATCH] Fix validation of domain-literals in Message_ID: headers. - Bug 2805 - ---- - src/src/parse.c | 34 +++++++++++++++++++++------------- - src/src/receive.c | 3 ++- - 5 files changed, 43 insertions(+), 20 deletions(-) - -diff --git a/src/src/parse.c b/src/src/parse.c -index 58f8941..42f1234 100644 ---- a/src/src/parse.c -+++ b/src/src/parse.c -@@ -224,16 +224,20 @@ If allow_domain_literals is TRUE, a "domain" may also be an IP address enclosed - in []. Make sure the output is set to the null string if there is a syntax - error as well as if there is no domain at all. - -+Optionally, msg_id domain literals ( printable-ascii enclosed in [] ) -+are permitted. -+ - Arguments: - s current character pointer - t where to put the domain -+ msg_id_literals flag for relaxed domain-literal processing - errorptr put error message here on failure (*t will be 0 on exit) - - Returns: new character pointer - */ - - static const uschar * --read_domain(const uschar *s, uschar *t, uschar **errorptr) -+read_domain(const uschar *s, uschar *t, BOOL msg_id_literals, uschar **errorptr) - { - uschar *tt = t; - s = skip_comment(s); -@@ -259,7 +263,11 @@ if (*s == '[') - t += 5; - s += 5; - } -- while (*s == '.' || *s == ':' || isxdigit(*s)) *t++ = *s++; -+ -+ if (msg_id_literals) -+ while (*s >= 33 && *s <= 90 || *s >= 94 && *s <= 126) *t++ = *s++; -+ else -+ while (*s == '.' || *s == ':' || isxdigit(*s)) *t++ = *s++; - - if (*s == ']') *t++ = *s++; else - { -@@ -267,7 +275,7 @@ if (*s == '[') - *tt = 0; - } - -- if (!allow_domain_literals) -+ if (!allow_domain_literals && !msg_id_literals) - { - *errorptr = US"domain literals not allowed"; - *tt = 0; -@@ -500,7 +508,7 @@ BOOL commas = FALSE; - while (*s == '@') - { - *t++ = '@'; -- s = read_domain(s+1, t, errorptr); -+ s = read_domain(s+1, t, FALSE, errorptr); - if (*t == 0) return s; - t += Ustrlen((const uschar *)t); - if (*s != ',') break; -@@ -559,7 +567,7 @@ if (*errorptr == NULL) - t += Ustrlen((const uschar *)t); - *t++ = *s++; - *domainptr = t; -- s = read_domain(s, t, errorptr); -+ s = read_domain(s, t, FALSE, errorptr); - } - return s; - } -@@ -649,7 +657,7 @@ if (*s != '@' && *s != '<') - { - if (*s == 0 || *s == ';') - { -- if (*t == 0) FAILED(US"empty address"); -+ if (!*t) FAILED(US"empty address"); - endptr = last_comment_position; - goto PARSE_SUCCEEDED; /* Bare local part */ - } -@@ -740,7 +748,7 @@ if (*s == '<') - } - - endptr = s; -- if (*errorptr != NULL) goto PARSE_FAILED; -+ if (*errorptr) goto PARSE_FAILED; - while (bracket_count-- > 0) if (*s++ != '>') - { - *errorptr = s[-1] == 0 -@@ -759,14 +767,14 @@ should be the domain. However, for flexibility we allow for a route-address - not enclosed in <> as well, which is indicated by an empty first local - part preceding '@'. The source routing is, however, ignored. */ - --else if (*t == 0) -+else if (!*t) - { - uschar *domainptr = yield; - s = read_route(s, t, errorptr); -- if (*errorptr != NULL) goto PARSE_FAILED; -+ if (*errorptr) goto PARSE_FAILED; - *t = 0; /* Ensure route is ignored - probably overkill */ - s = read_addr_spec(s, t, 0, errorptr, &domainptr); -- if (*errorptr != NULL) goto PARSE_FAILED; -+ if (*errorptr) goto PARSE_FAILED; - *domain = domainptr - yield; - endptr = last_comment_position; - if (*domain == 0) FAILED(US"domain missing in source-routed address"); -@@ -779,8 +787,8 @@ else - t += Ustrlen((const uschar *)t); - *t++ = *s++; - *domain = t - yield; -- s = read_domain(s, t, errorptr); -- if (*t == 0) goto PARSE_FAILED; -+ s = read_domain(s, t, TRUE, errorptr); -+ if (!*t) goto PARSE_FAILED; - endptr = last_comment_position; - } - -@@ -789,7 +797,7 @@ through for other cases. Endptr may have been moved over whitespace, so - move it back past white space if necessary. */ - - PARSE_SUCCEEDED: --if (*s != 0) -+if (*s) - { - if (f.parse_found_group && *s == ';') - { -diff --git a/src/src/receive.c b/src/src/receive.c -index c2b313c..5471aa7 100644 ---- a/src/src/receive.c -+++ b/src/src/receive.c -@@ -1663,7 +1663,6 @@ int process_info_len = Ustrlen(process_info); - int error_rc = error_handling == ERRORS_SENDER - ? errors_sender_rc : EXIT_FAILURE; - int header_size = 256; --int start, end, domain; - int id_resolution = 0; - int had_zero = 0; - int prevlines_length = 0; -@@ -4084,6 +4083,8 @@ if ( LOGGING(msg_id) && msgid_header - uschar * old_id; - BOOL save_allow_domain_literals = allow_domain_literals; - allow_domain_literals = TRUE; -+ int start, end, domain; -+ - old_id = parse_extract_address(Ustrchr(msgid_header->text, ':') + 1, - &errmsg, &start, &end, &domain, FALSE); - allow_domain_literals = save_allow_domain_literals; - -- 2.44.0