X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/eb4c9690438d90c1cdec65fb194a39eb7b7cf371..d945e180cbe2b26392fb21f7ae4dd2ccc603a81b:/test/runtest diff --git a/test/runtest b/test/runtest index fbefff5e6..98914d171 100755 --- a/test/runtest +++ b/test/runtest @@ -18,7 +18,6 @@ #use strict; use v5.10.1; use warnings; -use if $^V >= v5.19.11, experimental => 'smartmatch'; use Errno; use FileHandle; @@ -33,7 +32,7 @@ use File::Copy; use lib "$RealBin/lib"; use Exim::Runtest; -use Exim::Utils qw(uniq numerically); +use Exim::Utils qw(uniq numerically cp); use if $ENV{DEBUG} && scalar($ENV{DEBUG} =~ /\bruntest\b/) => 'Smart::Comments' => '####'; use if $ENV{DEBUG} && scalar($ENV{DEBUG} =~ /\bruntest\b/) => 'Data::Dumper'; @@ -254,9 +253,11 @@ die "** runtest error: $_[1]\n"; sub new_value { my($oldid, $base, $sequence) = @_; my($newid) = $cache{$oldid}; +print ">> replace $oldid -> $newid\n" if ($debug && defined $newid); if (! defined $newid) { $newid = sprintf($base, $$sequence++); + print ">> new $oldid -> $newid\n" if $debug; $cache{$oldid} = $newid; } return $newid; @@ -342,7 +343,7 @@ return @yield; # into the same standard values throughout the data from a single test. # Message ids get this treatment (can't be made reliable for times), and # times in dumped retry databases are also handled in a special way, as are -# incoming port numbers. +# incoming port numbers and PIDs. # On entry to the subroutine, the file to write to is already opened with the # name MUNGED. The input file name is the only argument to the subroutine. @@ -369,6 +370,10 @@ my($is_mail) = $file =~ /mail/; $date = "\\d{2}-\\w{3}-\\d{4}\\s\\d{2}:\\d{2}:\\d{2}"; +# Debug time & pid + +$time_pid = "(?:\\d{2}:\\d{2}:\\d{2}\\s+\\d+\\s)"; + # Pattern for matching pids at start of stderr lines; initially something # that won't match. @@ -381,11 +386,23 @@ $spid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; LINE: while() { RESET_AFTER_EXTRA_LINE_READ: + if ($munge_skip) + { + # Munging is a no-op, except for exim_msgdate specials. + # Useful when testing exim_msgdate so that + # we compare unmunged dates and message-ids. + s%^localhost \d+ from message-id != given number \d+ at \K/.+(?=/test/eximdir/exim_msgdate line 387.$)%DIR%; + + print MUNGED; + next; + } + # Custom munges if ($extra) { next if $extra =~ m%^/% && eval $extra; eval $extra if $extra =~ m/^s/; + eval substr($extra, 1) if $extra =~ m/^R/; } # Check for "*** truncated ***" @@ -407,9 +424,12 @@ RESET_AFTER_EXTRA_LINE_READ: # patchexim should have fixed this for us #s/Exim \K\d+[._]\d+[\w_-]*/x.yz/i; - # Replace Exim message ids by a unique series - s/((?:[^\W_]{6}-){2}[^\W_]{2}) - /new_value($1, "10Hm%s-0005vi-00", \$next_msgid)/egx; + # Replace Exim message ids by a unique series. + # Both old and new formats, with separate replace series, for now. + s/(\d[^\W_]{5}-[^\W_]{6}-[^\W_]{2}) + /new_value($1, "10Hm%s-0005vi-00", \$next_msgid_old)/egx; + s/(\d[^\W_]{5}-[^\W_]{11}-[^\W_]{4}) + /new_value($1, "10Hm%s-000000005vi-0000", \$next_msgid)/egx; # The names of lock files appear in some error and debug messages s/\.lock(\.[-\w]+)+(\.[\da-f]+){2}/.lock.test.ex.dddddddd.pppppppp/; @@ -428,6 +448,8 @@ RESET_AFTER_EXTRA_LINE_READ: # There are differences in error messages between OpenSSL versions s/SSL_CTX_set_cipher_list/SSL_connect/; + s/error=\Kauthority and subject key identifier mismatch/self signed certificate/; + s/error=\Kself-signed certificate/self signed certificate/; # One error test in expansions mentions base 62 or 36 s/is not a base (36|62) number/is not a base 36\/62 number/; @@ -493,15 +515,25 @@ RESET_AFTER_EXTRA_LINE_READ: # time used was fixed when I first started running automatic Exim tests. # Date/time in header lines and SMTP responses - s/[A-Z][a-z]{2},\s\d\d?\s[A-Z][a-z]{2}\s\d{4}\s\d\d\:\d\d:\d\d\s[-+]\d{4} - /Tue, 2 Mar 1999 09:44:33 +0000/gx; + s/[A-Z][a-z]{2}, + (\s|\xE2\x96\x91) + \d\d? + (\s|\xE2\x96\x91) + [A-Z][a-z]{2} + (\s|\xE2\x96\x91) + \d{4} + (\s|\xE2\x96\x91) + \d\d\:\d\d:\d\d + (\s|\xE2\x96\x91) + [-+]\d{4} + /Tue,${1}2${2}Mar${3}1999${4}09:44:33${5}+0000/gx; # and in a French locale s/\S{4},\s\d\d?\s[^,]+\s\d{4}\s\d\d\:\d\d:\d\d\s[-+]\d{4} /dim., 10 f\xE9vr 2019 20:05:49 +0000/gx; # Date/time in logs and in one instance of a filter test s/^\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d(\s[+-]\d\d\d\d)?\s/1999-03-02 09:44:33 /gx; - s/^\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d\.\d{3}(\s[+-]\d\d\d\d)?\s/2017-07-30 18:51:05.712 /gx; + s/^\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d\.\d{3}(?:\s(?:[+-]\d\d\d\d|[A-Z]{2}T))?\s/2017-07-30 18:51:05.712 /gx; s/^Logwrite\s"\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d/Logwrite "1999-03-02 09:44:33/gx; # Date/time in syslog test s/^SYSLOG:\s\'\K\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d\s/2017-07-30 18:51:05 /gx; @@ -513,8 +545,14 @@ RESET_AFTER_EXTRA_LINE_READ: s/((D|[RQD]T)=)\d\.\d{3}s/$1q.qqqs/g; # Date/time in message separators - s/(?:[A-Z][a-z]{2}\s){2}\d\d\s\d\d:\d\d:\d\d\s\d\d\d\d - /Tue Mar 02 09:44:33 1999/gx; + s/(?:[A-Z][a-z]{2} + (\s|\xE2\x96\x91) + ){2}\d\d + (\s|\xE2\x96\x91) + \d\d:\d\d:\d\d + (\s|\xE2\x96\x91) + \d\d\d\d + /Tue${1}Mar${1}02${2}09:44:33${3}1999/gx; # Date of message arrival in spool file as shown by -Mvh s/^\d{9,10}\s0$/ddddddddd 0/; @@ -599,11 +637,13 @@ RESET_AFTER_EXTRA_LINE_READ: # LibreSSL # TLSv1:AES256-GCM-SHA384:256 # TLSv1:ECDHE-RSA-CHACHA20-POLY1305:256 + # TLS1.3:AEAD-AES256-GCM-SHA384:256 # # ECDHE-RSA-CHACHA20-POLY1305 # AES256-GCM-SHA384 s/(?opened and my $port = $dynamic_socket->sockport) { s/^Connecting to 127\.0\.0\.1 port \K$port//; @@ -827,10 +868,10 @@ RESET_AFTER_EXTRA_LINE_READ: # ======== IP error numbers and messages ======== # These vary between operating systems - s/Can(no|')t assign requested address/Network Error/; + s/(?:Can(?:no|')t assign requested address|Address not available)/Netwk addr not available/; s/Operation timed out/Connection timed out/; s/Address family not supported by protocol family/Network Error/; - s/Network( is)? unreachable/Network Error/; + s/Network(?: is)? unreachable/Network Error/; s/Invalid argument/Network Error/; s/\(\d+\): Network/(dd): Network/; @@ -866,7 +907,7 @@ RESET_AFTER_EXTRA_LINE_READ: s/([\s,])S=\d+\b/$1S=sss/; s/:S\d+\b/:Ssss/; - s/^(\s*\d+m\s+)\d+(\s+[a-z0-9-]{16} <)/$1sss$2/i if $is_stdout; + s/^(\s*\d+[mhd]\s+)\d+(\s+(?:[a-z0-9-]{23}|[a-z0-9-]{18}) <)/TTT sss$2/i if $is_stdout; s/\sSIZE=\d+\b/ SIZE=ssss/; s/\ssize=\d+\b/ size=sss/ if $is_stderr; s/old size = \d+\b/old size = sssss/; @@ -900,12 +941,21 @@ RESET_AFTER_EXTRA_LINE_READ: # numbers, or handle specific bad conditions in different ways, leading to # different wording in the error messages, so we cannot compare them. -#XXX This loses any trailing "deliving unencypted to" which is unfortunate +#XXX This loses any trailing "delivering unencypted to" which is unfortunate # but I can't work out how to deal with that. s/(TLS session: \(SSL_\w+\): error:)(.*)(?!: delivering)/$1 <>/; + s/TLS error on connection from .*\K\(SSL_accept\): error:.*:unexpected eof while reading$/(tls lib accept fn): TCP connection closed by peer/; s/(TLS error on connection from .* \(SSL_\w+\): error:)(.*)/$1 <>/; next if /SSL verify error: depth=0 error=certificate not trusted/; + # OpenSSL 3.0.0 + s/TLS error \(D-H param setting .* error:\K.*dh key too small/xxxxxxxx:SSL routines::dh key too small/; + + # OpenSSL 1.1.1 + s/error:\K0B080074:x509 certificate routines:X509_check_private_key(?=:key values mismatch$)/05800074:x509 certificate routines:/; + s/error:\K02001002:system library:fopen(?=:No such file or directory$)/80000002:system library:/; + s/error:\K0909006C:PEM routines:get_name(?=:no start line$)/0480006C:PEM routines:/; + # ======== Maildir things ======== # timestamp output in maildir processing s/(timestamp=|\(timestamp_only\): )\d+/$1ddddddd/g; @@ -955,6 +1005,9 @@ RESET_AFTER_EXTRA_LINE_READ: # MIME boundaries in RFC3461 DSN messages s/\d{8,10}-eximdsn-\d+/NNNNNNNNNN-eximdsn-MMMMMMMMMM/; + # Cyrus SASL library version differences (rejectlog) + s/Cyrus SASL permanent failure: \Kuser not found$/generic failure/; + # ========================================================== # Some munging is specific to the specific file types @@ -996,8 +1049,10 @@ RESET_AFTER_EXTRA_LINE_READ: next if /SSL verify error: depth=0 error=certificate not trusted/; s/SSL3_READ_BYTES/ssl3_read_bytes/i; s/CONNECT_CR_FINISHED/ssl3_read_bytes/i; - s/^\d+:error:\d+(?:E\d+)?(:SSL routines:ssl3_read_bytes:[^:]+:).*(:SSL alert number \d\d)$/pppp:error:dddddddd$1\[...\]$2/; - s/^error:[^:]*:(SSL routines:ssl3_read_bytes:(tls|ssl)v\d+ alert)/error:dddddddd:$1/; + s/^[[:xdigit:]]+:error:[[:xdigit:]]+(?:E[[:xdigit:]]+)?(:SSL routines:ssl3_read_bytes:[^:]+:).*(:SSL alert number \d\d)$/pppp:error:dddddddd$1\[...\]$2/; + s/^error:\K[^:]*:(SSL routines:ssl3_read_bytes:(tls|ssl)v\d+ alert)/dddddddd:$1/; + s/^error:\K[[:xdigit:]]+:SSL routines::(tlsv13 alert certificate required)$/dddddddd:SSL routines:ssl3_read_bytes:$1/; + s/^error:\K[[:xdigit:]]+:SSL routines::((tlsv1|sslv3) alert (unknown ca|certificate revoked))$/dddddddd:SSL routines:ssl3_read_bytes:$1/; # gnutls version variances next if /^Error in the pull function./; @@ -1007,7 +1062,8 @@ RESET_AFTER_EXTRA_LINE_READ: s/conversion: german.xn--strae-oqa.de/conversion: german.straße.de/; # subsecond timstamp info in reported header-files - s/^(-received_time_usec \.)\d{6}$/$1uuuuuu/; + s/^-received_time_usec \.\K\d{6}$/uuuuuu/; + s/^-received_time_complete \K\d+\.\d{6}$/tttt.uuuuuu/; # Postgres server takes varible time to shut down; lives in various places s/^waiting for server to shut down\.+ done$/waiting for server to shut down.... done/; @@ -1015,16 +1071,39 @@ RESET_AFTER_EXTRA_LINE_READ: # DMARC is not always supported by the build next if /^dmarc_tld_file =/; + # timestamp in dmarc history file + s/received \K\d{10}$/1692480217/; # ARC is not always supported by the build next if /^arc_sign =/; + # LIMITS is not always supported by the build + next if /^limits_advertise_hosts =/; + + # PRDR + next if /^hosts_try_prdr = *$/; + # TLS resumption is not always supported by the build next if /^tls_resumption_hosts =/; next if /^-tls_resumption/; + next if /^host_name_extract = /; # gsasl library version may not support some methods s/250-AUTH ANONYMOUS PLAIN SCRAM-SHA-1\K SCRAM-SHA-256//; + + # mailq times change with when the run is done, vs. static-source spoolfiles + s/\s*\d*[hd](?= 317 (?:[-0-9A-Za-z]{23}|[-0-9A-Za-z]{16}) )/DDd/; + # mailq sizes change with caller running the test + s/\s[01]m [34]\d\d(?= (?:[-0-9A-Za-z]{23}|[-0-9A-Za-z]{16}) )/ 1m 396/; + + # Not all builds include EXPERIMENTAL_DSN_INFO (1 of 2) + if (/^X-Exim-Diagnostic:/) + { + while () { + last if (/^$/ || !/^\s/); + } + goto RESET_AFTER_EXTRA_LINE_READ; + } } # ======== stderr ======== @@ -1032,14 +1111,33 @@ RESET_AFTER_EXTRA_LINE_READ: elsif ($is_stderr) { # The very first line of debugging output will vary - s/^Exim version .*/Exim version x.yz ..../; - # Debugging lines for Exim terminations and process-generation + # Skip some lines that Exim puts out at the start of debugging output + # because they will be different in different binaries. + + next if /^$time_pid? + (?: Berkeley\ DB:\s + | Probably\ (?:Berkeley\ DB|ndbm|GDBM) + | Using\ tdb + | Authenticators: + | Lookups(?:\(built-in\))?: + | Support\ for: + | Routers: + | Transports: + | Malware: + | log\ selectors\ = + | cwd= + | Fixed\ never_users + | Configure\ owner + | Size\ of\ off_t: + ) + /x; + + # Lines with a leading pid. Only handle >= 4-digit PIDs to avoid converting SMTP respose codes + s/^\s*(\d{4,})\s(?!(?:previous message|in\s|bytes remain in|SMTP accept process running))/new_value($1, "p%s", \$next_pid) . ' '/e; - s/(?<=^>>>>>>>>>>>>>>>> Exim pid=)\d+(?= terminating)/pppp/; - s/^(proxy-proc \w{5}-pid) \d+$/$1 pppp/; - s/^(?:\s*\d+ )(exec .* -oPX)$/pppp $1/; + # Debugging lines for Exim terminations and process-generation next if /(?:postfork: | fork(?:ing|ed) for )/; # IP address lookups use gethostbyname() when IPv6 is not supported, @@ -1053,6 +1151,14 @@ RESET_AFTER_EXTRA_LINE_READ: # we don't care what TZ enviroment the testhost was running next if /^Reset TZ to/; + # port numbers + s/(?:\[[^\]]*\]:|V4NET\.0\.0\.0:|localhost::?|127\.0\.0\.1[.:]:?|port[= ])\K$parm_port_d/PORT_D/; + s/(?:\[[^\]]*\]:|V4NET\.0\.0\.0:|localhost::?|127\.0\.0\.1[.:]:?|port[= ])\K$parm_port_d2/PORT_D2/; + s/(?:\[[^\]]*\]:|V4NET\.0\.0\.0:|localhost::?|127\.0\.0\.1[.:]:?|port[= ])\K$parm_port_d3/PORT_D3/; + s/(?:\[[^\]]*\]:|V4NET\.0\.0\.0:|localhost::?|127\.0\.0\.1[.:]:?|port[= ])\K$parm_port_d4/PORT_D4/; + s/(?:\[[^\]]*\]:|V4NET\.0\.0\.0:|localhost::?|127\.0\.0\.1[.:]:?|port[= ])\K$parm_port_s/PORT_S/; + s/(?:\[[^\]]*\]:|V4NET\.0\.0\.0:|localhost::?|127\.0\.0\.1[.:]:?|port[= ])\K$parm_port_n/PORT_N/; + # ========= Exim lookups ================== # Lookups have a char which depends on the number of lookup types compiled in, # in stderr output. Replace with a "0". Recognising this while avoiding @@ -1062,6 +1168,11 @@ RESET_AFTER_EXTRA_LINE_READ: # drop gnutls version strings next if /GnuTLS compile-time version: \d+[\.\d]+$/; next if /GnuTLS runtime version: \d+[\.\d]+$/; + # and unwanted debug + next if /^GnuTLS<2>: FIPS140-2 (context is not set|operation mode switched from initial to not-approved)$/; + next if /^GnuTLS<3>: ASSERT: sign.c\[_gnutls_sign_is_secure2\]:\d+$/; + next if /^GnuTLS<3>: ASSERT: \.\.\/\.\.\/lib\/pkcs11.c\[find_multi_objs_cb\]:/; + next if /^GnuTLS<3>: ASSERT: \.\.\/\.\.\/lib\/pkcs11.c\[gnutls_pkcs11_obj_list_import_url3\]:/; # drop openssl version strings next if /OpenSSL compile-time version: OpenSSL \d+[\.\da-z]+/; @@ -1073,10 +1184,10 @@ RESET_AFTER_EXTRA_LINE_READ: # TLS preload # only OpenSSL speaks of these - next if /^TLS: (preloading (DH params|ECDH curve|CA bundle) for server|generating selfsigned server cert)/; - next if /^Diffie-Hellman initialized from default/; - next if /^ECDH OpenSSL (< )?[\d.+]+: temp key parameter settings:/; - next if /^ECDH: .*'prime256v1'/; + next if /^TLS: (preloading (DH params \S+|ECDH curve \S+|CA bundle) for server|generating selfsigned server cert)/; + next if /^ Diffie-Hellman initialized from default/; + next if /^ ECDH OpenSSL (< )?[\d.+]+: temp key parameter settings:/; + next if /^ ECDH: .*'prime256v1'/; next if /^tls_verify_certificates: system$/; next if /^tls_set_watch: .*\/cert.pem/; next if /^Generating 2048 bit RSA key/; @@ -1090,11 +1201,20 @@ RESET_AFTER_EXTRA_LINE_READ: next if /^GnuTLS<2>: added \d+ protocols, \d+ ciphersuites, \d+ sig algos and \d+ groups into priority list$/; next if /^GnuTLS<2>: (Disabling X.509 extensions|signing structure using RSA-SHA256)/; next if /^GnuTLS.*(wrap_nettle_mpi_print|gnutls_subject_alt_names_get|get_alt_name)/; + next if /^GnuTLS<[23]>: (p11|ASSERT: pkcs11.c|Initializing needed PKCS #11 modules)/; + next if /^GnuTLS<2>: Intel (AES|GCM) accelerator was detected/; + next if /^Added \d{3} certificate authorities/; + next if /^TLS: not preloading CRL for server/; + next if /^GnuTLS<3>: ASSERT: extensions.c\[_gnutls_get_extension/; + next if /^GnuTLS<3>: ASSERT: \.\.\/\.\.\/\.\.\/lib\/x509\//; + next if /^GnuTLS<2>: Initializing PKCS #11 modules/; + # only kevent platforms (FreeBSD, OpenBSD) say this next if /^watch dir/; next if /^watch file .*\/usr\/local/; next if /^watch file .*\/etc\/ssl/; + next if /^closing watch fd:/; # TLS preload # there happen in different orders for OpenSSL/GnuTLS/noTLS @@ -1102,29 +1222,32 @@ RESET_AFTER_EXTRA_LINE_READ: next if /^TLS: not preloading (CA bundle|cipher list) for server$/; next if /^TLS: not preloading server certs$/; + # some platforms are missing the standard CA bundle file + next if /^tls_set_watch\(\) fail on '\/usr\/lib\/ssl\/cert.pem': No such file or directory$/; + # drop lookups - next if /^Lookups \(built-in\):/; - next if /^Loading lookup modules from/; - next if /^Loaded \d+ lookup modules/; - next if /^Total \d+ lookups/; + next if /^$time_pid?(?: Lookups\ \(built-in\): + | Loading\ lookup\ modules\ from + | Loaded\ \d+\ lookup\ modules + | Total\ \d+\ lookups)/x; # drop compiler information - next if /^Compiler:/; + next if /^$time_pid?Compiler:/; # and the ugly bit # different libraries will have different numbers (possibly 0) of follow-up # lines, indenting with more data - if (/^Library version:/) { + if (/^$time_pid?Library version:/) { while (1) { $_ = ; - next if /^\s/; + next if /^$time_pid?\s/; goto RESET_AFTER_EXTRA_LINE_READ; } } # drop other build-time controls emitted for debugging - next if /^WHITELIST_D_MACROS:/; - next if /^TRUSTED_CONFIG_LIST:/; + next if /^$time_pid?WHITELIST_D_MACROS:/; + next if /^$time_pid?TRUSTED_CONFIG_LIST:/; # As of Exim 4.74, we log when a setgid fails; because we invoke Exim # with -be, privileges will have been dropped, so this will always @@ -1153,7 +1276,7 @@ RESET_AFTER_EXTRA_LINE_READ: # drop pdkim debugging header next if /^DKIM( <<<<<<<<<<<<<<<<<<<<<<<<<<<<<+|: no signatures)$/; - # Some platforms have TIOCOUTome do not + # Some platforms have TIOCOUT, some do not next if /\d+ bytes remain in socket output buffer$/; # Various other IPv6 lines must be omitted too @@ -1170,20 +1293,23 @@ RESET_AFTER_EXTRA_LINE_READ: next; } - # Non-TLS bulds have a different Recieved: header expansion - s/^((.*)\t}}}}by \$primary_hostname \$\{if def:received_protocol \{with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; - s/^((\s*).*considering: with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; - if (/condition: def:tls_in_cipher_std$/) + # Non-TLS builds have a different default Recieved: header expansion + s/^((.*)\t}}}}by \$primary_hostname \$\{if def:received_protocol \{with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_ver { (\$tls_in_ver)}}\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; + s/^((\s*).*considering: with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_ver { (\$tls_in_ver)}}\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; + if (/condition: def:tls_in_ver$/) { $_= ; $_= ; $_= ; $_= ; $_= ; $_= ; $_= ; $_= ; - $_= ; $_= ; $_= ; next; + $_= ; $_= ; $_= ; $_= ; + $_= ; $_= ; $_= ; $_= ; + $_= ; $_= ; $_= ; $_= ; $_= ; next; } # Skip tls_advertise_hosts and hosts_require_tls checks when the options # are unset, because tls ain't always there. + next if /^((>>>)?\s*host)? in tls_advertise_hosts\?$/; next if /in\s(?:tls_advertise_hosts\?|hosts_require_tls\?) \sno\s\((option\sunset|end\sof\slist)\)/x; @@ -1255,9 +1381,7 @@ RESET_AFTER_EXTRA_LINE_READ: next if /in\shosts_require_dane\?\sno\s\(option\sunset\)/x; # daemon notifier socket - s/^(\s*\d+|ppppp) (creating notifier socket)$/ppppp $2/; - s/^ \@(.*exim_daemon_notify)$/ $1/; - s/^(\s*\d+|ppppp) \@?(.*exim_daemon_notify)$/ppppp $2/; + s% \@(?=[^ @]+/spool/exim_daemon_notify$)% %; next if /unlinking notifier socket/; # daemon notifier socket @@ -1269,6 +1393,15 @@ RESET_AFTER_EXTRA_LINE_READ: $_ = $line . $_; } + # Different builds will have different lookup types included + s/search_type \K\d+ \((\w+)\) quoting -1 \(none\)$/NN ($1) quoting -1 (none)/; + # and different numbers of lookup types result in different type-code letters, + # so convert them all to "0" + s%(?>>)?\s*host in pipelining_connect_advertise_hosts\?$/ ) + { + $_ = ; + while ( /^(>>>)?\s*list element:/ ) { $_ = ; } + goto RESET_AFTER_EXTRA_LINE_READ; + } + next if / in (?:pipelining_connect_advertise_hosts|hosts_pipe_connect)?\? no /; # Experimental_International next if / in smtputf8_advertise_hosts\? no \(option unset\)/; @@ -1284,9 +1423,26 @@ RESET_AFTER_EXTRA_LINE_READ: # Experimental_REQUIRETLS next if / in tls_advertise_requiretls?\? no \(end of list\)/; + # Experimental_LIMITS + if ( /^((>>>)?\s*host)? in limits_advertise_hosts\?$/ ) + { + $_ = ; + while ( /^(>>>)?\s*list element: !\*$/ ) { $_ = ; } + goto RESET_AFTER_EXTRA_LINE_READ; + } + next if / in limits_advertise_hosts?\? no \(matched "!\*"\)/; + + # Experimental_XCLIENT + next if / in hosts_xclient?\? no \(option unset\)/; + # TCP Fast Open next if /^(ppppp )?setsockopt FASTOPEN: Network Error/; + # DISABLE_TLS_RESUME + # TLS resumption is not always supported by the build + next if /in tls_resumption_hosts\?/; + next if /RE '.outlook.com/; + # Environment cleaning next if /\w+ in keep_environment\? (yes|no)/; @@ -1294,7 +1450,7 @@ RESET_AFTER_EXTRA_LINE_READ: s/^cmd buf flush \d+ bytes/cmd buf flush ddd bytes/; # Spool filesystem free space changes on different systems. - s/^((?:spool|log) directory space =) -?\d+K (inodes =)\s*-?\d+/$1 nnnnnK $2 nnnnn/; + s/((?:spool|log) directory space =) -?\d+K (inodes =)\s*-?\d+/$1 nnnnnK $2 nnnnn/; # Non-TLS builds have different expansions for received_header_text if (s/(with \$received_protocol)\}\} \$\{if def:tls_cipher \{\(\$tls_cipher\)\n$/$1/) @@ -1313,6 +1469,7 @@ RESET_AFTER_EXTRA_LINE_READ: # Not all platforms build with SPF enabled next if /^(spf_conn_init|SPF_dns_exim_new|spf_compile\.c)/; + next if /try option spf_smtp_comment_template$/; # Not all platforms have sendfile support next if /^cannot use sendfile for body: no support$/; @@ -1329,9 +1486,9 @@ RESET_AFTER_EXTRA_LINE_READ: s/ \.\.\. >>> / ... /; if (s/ non-TFO mode connection attempt to 224.0.0.0, 0 data\b$//) { chomp; $_ .= ; } s/Address family not supported by protocol family/Network Error/; - s/Network is unreachable/Network Error/; + s/Network(?: is)? unreachable/Network Error/; } - next if /^(ppppp )?setsockopt FASTOPEN: Protocol not available$/; + next if /^(ppppp |\d+ )?setsockopt FASTOPEN: Protocol not available$/; s/^(Connecting to .* \.\.\. sending) \d+ (nonTFO early-data)$/$1 dd $2/; if (/^([0-9: ]* # possible timestamp @@ -1372,13 +1529,12 @@ RESET_AFTER_EXTRA_LINE_READ: # Postgres version-dependent differences s/^initdb: warning: (enabling "trust" authentication for local connections)$/\nWARNING: $1/; + # Postgre DB server PID + s/ \[\d+\] (?=(LOG: redirecting log|HINT: Future log output))/ [pppp] /; # Not all builds include DMARC next if /^DMARC: no (dmarc_tld_file|sender_host_address)$/ ; - # TLS resumption is not always supported by the build - next if /in tls_resumption_hosts\?/; - # Platform differences in errno strings s/ SMTP\(Operation timed out\)</; # When Exim is checking the size of directories for maildir, it uses # the check_dir_size() function to scan directories. Of course, the order @@ -1410,26 +1574,7 @@ RESET_AFTER_EXTRA_LINE_READ: @saved = (); } - # Skip some lines that Exim puts out at the start of debugging output - # because they will be different in different binaries. - - print MUNGED - unless (/^Berkeley DB: / || - /^Probably (?:Berkeley DB|ndbm|GDBM)/ || - /^Authenticators:/ || - /^Lookups:/ || - /^Support for:/ || - /^Routers:/ || - /^Transports:/ || - /^Malware:/ || - /^log selectors =/ || - /^cwd=/ || - /^Fixed never_users:/ || - /^Configure owner:/ || - /^Size of off_t:/ - ); - - + print MUNGED; } next; @@ -1443,15 +1588,17 @@ RESET_AFTER_EXTRA_LINE_READ: next if / Berkeley DB error: /; # CHUNKING: exact sizes depend on hostnames in headers - s/(=>.* K C="250- \d)\d+ (byte chunk, total \d)\d+/$1nn $2nn/; + s/(=>.* K (?:DKIM=\S+ )?C="250- \d)\d+ (byte chunk, total \d)\d+/$1nn $2nn/; - # openssl version variances - s/(TLS error on connection [^:]*: error:)[0-9A-F]{8}(:system library):(?:fopen|func\(4095\)):(No such file or directory)$/$1xxxxxxxx$2:fopen:$3/; - s/(DANE attempt failed.*error:)[0-9A-F]{8}(:SSL routines:)(?:(?i)ssl3_get_server_certificate|tls_process_server_certificate|CONNECT_CR_CERT)(?=:certificate verify failed$)/$1xxxxxxxx$2ssl3_get_server_certificate/; + # OpenSSL version variances + s/(TLS error on connection [^:]*: error:)[0-9A-F]{8}(:system library):(?:fopen|func\(4095\)|):(No such file or directory)$/$1xxxxxxxx$2:fopen:$3/; + next if /TLS error \(SSL_read\): .*error:0A000126:SSL routines::unexpected eof while reading$/ ; + s/EVDATA: \K\(SSL_accept\): error:0A000126:SSL routines::unexpected eof while reading/SSL_accept: TCP connection closed by peer/; + s/(DANE attempt failed.*error:)[0-9A-F]{8}(:SSL routines:)(?:(?i)ssl3_get_server_certificate|tls_process_server_certificate|CONNECT_CR_CERT|)(?=:certificate verify failed$)/$1xxxxxxxx$2ssl3_get_server_certificate/; s/(DKIM: validation error: )error:[0-9A-F]{8}:rsa routines:(?:(?i)int_rsa_verify|CRYPTO_internal):(?:bad signature|algorithm mismatch)$/$1Public key signature verification has failed./; s/ARC: AMS signing: privkey PEM-block import: error:\K[0-9A-F]{8}:(PEM routines):get_name:(no start line)/0906D06C:$1:PEM_read_bio:$2/; - # gnutls version variances + # GnuTLS version variances if (/TLS error on connection \(recv\): .* (Decode error|peer did not send any certificate)/) { my $prev = $_; @@ -1464,19 +1611,26 @@ RESET_AFTER_EXTRA_LINE_READ: else { $_ = $prev; } } - # translate gnutls error into the openssl one + # translate GnuTLS error into the OpenSSL one s/ARC: AMS signing: privkey PEM-block import: \KThe requested data were not available.$/error:0906D06C:PEM routines:PEM_read_bio:no start line/; + # and then both into the OpenSSL 3.x one + s/ARC: AMS signing: privkey PEM-block import: error:\K[0-9A-F]{8}:PEM routines:PEM_read_bio:no start line$/1E08010C:DECODER routines::unsupported/; # DKIM timestamps - if ( /(DKIM: d=.*) t=([0-9]*) x=([0-9]*) / ) + if ( /(DKIM: d=.*) t=([0-9]*) x=([0-9]*) \[/ ) { my ($prefix, $t_diff) = ($1, $3 - $2); s/DKIM: d=.* t=[0-9]* x=[0-9]* /${prefix} t=T x=T+${t_diff} /; } + else + { s/DKIM: d=.* \Kt=[0-9]* \[/t=T [/; } # GnuTLS reports a different keysize vs. OpenSSL, for ed25519 keys s/signer: [^ ]* bits:\K 256/ 253/; s/public key too short:\K 256 bits/ 253 bits/; + # with GnuTLS we cannot log single bad ALPN. So ignore the with-OpenSSL log line. + # next if /TLS ALPN (http) rejected$/; + # port numbers s/(?:\[[^\]]*\]:|port )\K$parm_port_d/PORT_D/; s/(?:\[[^\]]*\]:|port )\K$parm_port_d2/PORT_D2/; @@ -1496,6 +1650,8 @@ RESET_AFTER_EXTRA_LINE_READ: s/session: \K\((SSL_connect|gnutls_handshake)\): timed out/(tls lib connect fn): timed out/; s/TLS error on connection from .*\K\((SSL_accept|gnutls_handshake)\): timed out/(tls lib accept fn): timed out/; s/TLS error on connection from .*\K(SSL_accept: TCP connection closed by peer|\(gnutls_handshake\): The TLS connection was non-properly terminated.)/(tls lib accept fn): TCP connection closed by peer/; + s/TLS session: \K\(gnutls_handshake\): rxd alert: No supported application protocol could be negotiated/(SSL_connect): error: <>/; + s/\(gnutls_handshake\): No common application protocol could be negotiated./(SSL_accept): error: <>/; } # ======== mail ======== @@ -1510,6 +1666,22 @@ RESET_AFTER_EXTRA_LINE_READ: ; ; } + elsif ( /^(\s+)t=([0-9]*); b=[A-Za-z0-9+\/]+$/ ) + { + my $indent = $1; + s/.*/${indent}t=T; b=bbbb;/; + ; + ; + } + + # Not all builds include EXPERIMENTAL_DSN_INFO (2 of 2) + if (/^X-Exim-Diagnostic:/) + { + while () { + last if (/^$/ || !/^\s/); + } + goto RESET_AFTER_EXTRA_LINE_READ; + } } # ======== All files other than stderr ======== @@ -1746,13 +1918,13 @@ if (-e $sf_current) for (my $i = 0; $i < @munged; $i++) { - if ($munged[$i] =~ /^[-\d]{10}\s[:\d]{8}\s[-A-Za-z\d]{16}\s[-=*]>/) + if ($munged[$i] =~ /^[-\d]{10}\s[:\d]{8}(\.\d{3})?\s[-A-Za-z\d]{23}\s[-=*]>/) { my $j; for ($j = $i + 1; $j < @munged; $j++) { last if $munged[$j] !~ - /^[-\d]{10}\s[:\d]{8}\s[-A-Za-z\d]{16}\s[-=*]>/; + /^[-\d]{10}\s[:\d]{8}(\.\d{3})?\s[-A-Za-z\d]{23}\s[-=*]>/; } @temp = splice(@munged, $i, $j - $i); @temp = sort(@temp); @@ -1822,7 +1994,8 @@ return 2; # Usable files are: # paniclog, rejectlog, mainlog, stdout, stderr, msglog, mail # Search strings starting with 's' do substitutions; -# with '/' do line-skips. +# with '/' do line-skips, +# with 'R' run given code. # Triggered by a scriptfile line "munge " ################################################## $munges = @@ -1868,11 +2041,14 @@ $munges = 'rejectlog' => 's/ X=TLS\S+ / X=TLS_proto_and_cipher /', }, - 'debug_pid' => - { 'stderr' => 's/(^\s{0,4}|(?<=Process )|(?<=child ))\d+/ppppp/g' }, - 'optional_dsn_info' => - { 'mail' => '/^(X-(Remote-MTA-(smtp-greeting|helo-response)|Exim-Diagnostic|(body|message)-linecount):|Remote-MTA: X-ip;)/' + { 'mail' => 'Rif (/^(X-(Remote-MTA-(smtp-greeting|helo-response)|Exim-Diagnostic|(body|message)-linecount):|Remote-MTA: X-ip;)/) { + while (1) { + $_ = ; + next if /^ /; + goto RESET_AFTER_EXTRA_LINE_READ; + } + }' }, 'optional_config' => @@ -1897,11 +2073,6 @@ $munges = { 'mainlog' => 's/^(.* SMTP protocol synchronization error .* next input=.{8}).*$/$1/', 'rejectlog' => 's/^(.* SMTP protocol synchronization error .* next input=.{8}).*$/$1/'}, - 'debuglog_stdout' => - { 'stdout' => 's/^\d\d:\d\d:\d\d\s+\d+ //; - s/Process \d+ is ready for new message/Process pppp is ready for new message/' - }, - 'timeout_errno' => # actual errno differs Solaris vs. Linux { 'mainlog' => 's/((?:host|message) deferral .* errno) <\d+> /$1 /' }, @@ -2002,7 +2173,7 @@ if (! $message_skip) foreach $mail (@mails) { - next if $mail eq "test-mail/oncelog"; + next if $mail =~ /^test-mail\/oncelog(.(dir|pag|db))?$/; $saved_mail = substr($mail, 10); # Remove "test-mail/" $saved_mail =~ s/^$parm_caller(\/|$)/CALLER/; # Convert caller name @@ -2086,9 +2257,15 @@ if (! $msglog_skip) foreach $msglog (@msglogs) { next if ($msglog eq "." || $msglog eq ".." || $msglog eq "CVS"); + ($munged_msglog = $msglog) =~ s/((?:[^\W_]{6}-){2}[^\W_]{2}) - /new_value($1, "10Hm%s-0005vi-00", \$next_msgid)/egx; + /new_value($1, "10Hm%s-0005vi-00", \$next_msgid_old)/egx; + + $munged_msglog =~ + s/([^\W_]{6}-[^\W_]{11}-[^\W_]{4}) + /new_value($1, "10Hm%s-000000005vi-0000", \$next_msgid)/egx; + $yield = max($yield, check_file("spool/msglog/$msglog", undef, "test-msglog-munged", "msglog/$testno.$munged_msglog", 0, $munge->{msglog})); @@ -2179,6 +2356,7 @@ system($cmd); # Arguments: the current test number # reference to the subtest number, holding previous value # reference to the expected return code value +# reference to flag for not-expected return value # reference to where to put the command name (for messages) # auxiliary information returned from a previous run # @@ -2194,16 +2372,18 @@ system($cmd); sub run_command{ my($testno) = $_[0]; my($subtestref) = $_[1]; -my($commandnameref) = $_[3]; -my($aux_info) = $_[4]; +my($commandnameref) = $_[4]; +my($aux_info) = $_[5]; my($yield) = 1; our %ENV = map { $_ => $ENV{$_} } grep { /^(?:USER|SHELL|PATH|TERM|EXIM_TEST_.*)$/ } keys %ENV; -if (/^(\d+)\s*$/) # Handle unusual return code +if (/^(~)?(\d+)\s*(?:([A-Z]+)=(\S+))?$/) # Handle unusual return code { - my($r) = $_[2]; - $$r = $1 << 8; + my($r, $rn) = ($_[2], $_[3]); + $$r = $2 << 8; + $$rn = 1 if (defined $1); + $ENV{$3} = $4 if (defined $3); $_ =