Merge branch '4.next' 4.next github/4.next
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 4 Nov 2023 14:20:45 +0000 (14:20 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 4 Nov 2023 14:29:25 +0000 (14:29 +0000)
140 files changed:
.gitignore
.mailmap
configs/ABOUT
configs/system-integration/README.md [new file with mode: 0644]
configs/system-integration/systemd/.gitignore [new file with mode: 0644]
configs/system-integration/systemd/README.md [new file with mode: 0644]
configs/system-integration/systemd/daemon/exim.service [new file with mode: 0644]
configs/system-integration/systemd/inetd/exim.socket [new file with mode: 0644]
configs/system-integration/systemd/inetd/exim@.service [new file with mode: 0644]
configs/system-integration/systemd/install [new file with mode: 0755]
configs/system-integration/systemd/maintenance/exim-maintenance.service [new file with mode: 0644]
configs/system-integration/systemd/maintenance/exim-maintenance.timer [new file with mode: 0644]
configs/system-integration/systemd/queuerunner/exim-queuerunner.service [new file with mode: 0644]
configs/system-integration/systemd/queuerunner/exim-queuerunner.timer [new file with mode: 0644]
configs/system-integration/systemd/socket/exim.service [new file with mode: 0644]
configs/system-integration/systemd/socket/exim.socket [new file with mode: 0644]
doc/doc-docbook/filter.xfpt
doc/doc-docbook/spec.xfpt
doc/doc-scripts/g2t
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
release-process/scripts/mk_exim_release
src/Makefile
src/OS/Makefile-Base
src/OS/Makefile-FreeBSD
src/OS/Makefile-OpenBSD
src/OS/Makefile-SunOS5
src/exim_monitor/em_main.c
src/exim_monitor/em_menu.c
src/exim_monitor/em_queue.c
src/scripts/MakeLinks
src/scripts/exim_install
src/src/EDITME
src/src/acl.c
src/src/arc.c
src/src/auths/auth-spa.c
src/src/auths/auth-spa.h
src/src/auths/check_serv_cond.c
src/src/auths/cram_md5.c
src/src/auths/cyrus_sasl.c
src/src/auths/dovecot.c
src/src/auths/external.c
src/src/auths/get_data.c
src/src/auths/gsasl_exim.c
src/src/auths/heimdal_gssapi.c
src/src/auths/plaintext.c
src/src/auths/spa.c
src/src/auths/xtextdecode.c
src/src/base64.c
src/src/buildconfig.c
src/src/config.h.defaults
src/src/daemon.c
src/src/dcc.c
src/src/debug.c
src/src/dkim.c
src/src/dkim_transport.c
src/src/dns.c
src/src/drtables.c
src/src/environment.c
src/src/exicyclog.src
src/src/exigrep.src
src/src/exim.c
src/src/exim_checkaccess.src
src/src/exim_dbmbuild.c
src/src/exim_dbutil.c
src/src/exim_msgdate.src
src/src/eximon.src
src/src/eximstats.src
src/src/exinext.src
src/src/exipick.src
src/src/exiwhat.src
src/src/expand.c
src/src/filter.c
src/src/functions.h
src/src/globals.c
src/src/globals.h
src/src/hash.c
src/src/host.c
src/src/imap_utf7.c
src/src/ip.c
src/src/local_scan.h
src/src/log.c
src/src/lookups/README
src/src/lookups/dnsdb.c
src/src/lookups/ldap.c
src/src/lookups/lf_check_file.c
src/src/lookups/lsearch.c
src/src/lookups/pgsql.c
src/src/lookups/readsock.c
src/src/lss.c
src/src/macro_predef.c
src/src/macro_predef.h
src/src/macros.h
src/src/malware.c
src/src/match.c
src/src/mime.c
src/src/moan.c
src/src/mytypes.h
src/src/os.c
src/src/parse.c
src/src/pdkim/pdkim.c
src/src/pdkim/signing.c
src/src/priv.c
src/src/readconf.c
src/src/receive.c
src/src/regex.c
src/src/regex_cache.c
src/src/retry.c
src/src/rewrite.c
src/src/rfc2047.c
src/src/routers/iplookup.c
src/src/routers/queryprogram.c
src/src/routers/rf_self_action.c
src/src/search.c
src/src/sieve.c
src/src/smtp_in.c
src/src/smtp_out.c
src/src/spf.c
src/src/spool_in.c
src/src/spool_mbox.c
src/src/spool_out.c
src/src/store.c
src/src/string.c
src/src/structs.h
src/src/tls-gnu.c
src/src/tls-openssl.c
src/src/tls.c
src/src/tlscert-openssl.c
src/src/transport-filter.src
src/src/transport.c
src/src/transports/appendfile.c
src/src/transports/lmtp.c
src/src/transports/pipe.c
src/src/transports/smtp.c
src/src/transports/tf_maildir.c
src/src/tree.c
src/src/verify.c
test/runtest
test/scripts/0000-Basic/0002
test/stdout/0002

index 8c2660a9fca0d0e641343dc9cb10d63744cc735d..c55dcdcdd644fd96aebd2ecfe364b52d88c336b3 100644 (file)
@@ -1,4 +1,4 @@
-exim-*
+!/system-integration/
 !/test/aux-fixed/exim-ca
 *~
 *.bak
index 8373e46977d14647e0934866aa02697b5bfb0046..086ff80f12de366aa944d9623cfbba42696dea81 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -5,7 +5,7 @@ Andreas Metzler <ametzler@bebt.de> <eximusers@downhill.at.eu.org>
 Andrew Colin Kissa <andrew@topdog.za.net>
 Andrew Lewis <exim@judo.za.org>
 Axel Rau <axel.rau@chaos1.de>
-bes-internal <bes.internal@gmail.com>
+Vladimir Varlamov <bes.internal@gmail.com>
 David Woodhouse <David.Woodhouse@intel.com>
 Dirk Mueller <dmueller@suse.com>
 Eric Andresen <eandres@google.com>
index 13d9230b6d24c848c1613ae9888bced3d0799e94..8c28844a8c2b933366600ce768039acc1549d2bf 100644 (file)
@@ -1,7 +1,8 @@
-Exim repository: configs
-------------------------
+Exim repository: configs/
+-------------------------
 
-This directory contains sample configurations and similar files that have been
-submitted by Exim users. The files are not locally modified.
+This directory contains sample configurations and files for
+integrating Exim with the system. These have been submitted by Exim
+users and may or may not fit your your environment.
 
-End
+But we're interested in feedback and improvements.
diff --git a/configs/system-integration/README.md b/configs/system-integration/README.md
new file mode 100644 (file)
index 0000000..d06afc5
--- /dev/null
@@ -0,0 +1,8 @@
+# System Integration
+
+Various systems use various ways to integrate Exim with the system.
+Mainly these tasks have to be accomplished:
+
+- startup procedure (running as a service or on demand)
+- queue runs
+- regular maintenance tasks (log rotation, database cleanup)
diff --git a/configs/system-integration/systemd/.gitignore b/configs/system-integration/systemd/.gitignore
new file mode 100644 (file)
index 0000000..15c1e5d
--- /dev/null
@@ -0,0 +1 @@
+.installed
diff --git a/configs/system-integration/systemd/README.md b/configs/system-integration/systemd/README.md
new file mode 100644 (file)
index 0000000..297edbc
--- /dev/null
@@ -0,0 +1,86 @@
+# Systemd Unit Examples for Exim
+
+This directory contains several examples for Systemd units to manage an Exim installation.
+There is room for improvement, so please share your ideas or setups that are proven to work
+in your environment.
+
+All the service units try to protect the system from unintentional
+writes to locations outside of Exim's spool, and log directories.  You
+may need to override specific settings, we recommend using Systemd's
+override mechanism (`systemd edit â€¦`).
+
+The .service units use `ProtectSystem=strict`, which implies a read-only
+file system structure. Exim needs write access to the spool directory
+(main config option: `spool_directory`), and the log directory (main
+config option: `log_file_path`). For improved security you can even set
+`NoNewPrivileges`, if you don't do local deliveries.
+
+The provides Systemd units are examples, containing placeholders
+`{{…}}`. The [install script](./install) helps substituting them.\1av
+The following placeholders are used currently:
+- `exim`:
+- `spooldir:`
+- `logdir`:
+
+
+## Daemon
+
+This is best suited for *average to high traffic systems*, it engages
+all built-in Exim facilities, as queue runner management and system load
+depending message processing.
+
+The [systemd service unit](./daemon/exim.service) starts the Exim main
+process. This process listens on the ports configured in the _runtime
+configuration_ (typically `exim.conf`), and supervises all other
+activities, including management of queue runner startups. Basically it
+calls `exim -odf -q...`.
+
+For regular maintenance tasks (database cleanup) additional units are
+[required](./maintenance).
+
+## Socket
+
+This is best suited for *low traffic* systems, which experience a
+message *burst* from time to time. Regular desktop, and edge systems fit this
+pattern.
+
+Exim's start is delayed until the first connection. Once a connection is
+initiated, Exim starts a listener on the port configured in the [systemd
+socket unit](./socket/exim.socket) and waits for more connections. It
+exits after being idle for a while. Basically it calls `exim -bw ...`.
+
+Additional [_queue runner_ timer and service units](#queue-runner) are required.
+
+For regular maintenance tasks (database cleanup)
+additional units are [required](./maintenance).
+
+## Inetd
+
+This is best suited for systems with *low traffic*, if the
+[socket](#socket) approach doesn't work.
+
+For each incoming connection a new Exim instance starts, handling
+exactly this connection and then exits. The listener port is configured
+in the [systemd socket unit](./inetd/exim.socket).
+
+Additional [_queue runner_ timer and service units](#queue-runner) are required.
+
+For regular maintenance tasks (database cleanup)
+additional units are [required](./maintenance).
+
+## Queue Runner
+
+This is a *timer*, and a *service* unit which starts Exim queue runner
+processes. This is necessary, as the socket activated Exim instances
+(from [socket](#socket) and [inetd](#inetd) do not care, once the first
+delivery attempt is done.
+
+## Maintenance
+
+This is a *timer* unit, and a *service* unit for regular maintenance
+tasks.  For security it is recommended to use the `User=` Systemd
+directive in a local override file.
+
+The service unit cares about tidying Exim's hint databases. It *does
+not* rotate the log files, as most systems have their own mechanism for
+doing this job (e.g. Logrotate).
diff --git a/configs/system-integration/systemd/daemon/exim.service b/configs/system-integration/systemd/daemon/exim.service
new file mode 100644 (file)
index 0000000..5d49ab3
--- /dev/null
@@ -0,0 +1,29 @@
+[Unit]
+Description=Exim MTA (as daemon)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+Requires=network.target
+After=networking.target
+
+[Service]
+Environment=DAEMON_OPTS=
+Environment=QUEUE_OPTS=-q15m
+EnvironmentFile=-/etc/default/{{exim}}
+
+Type=exec
+ExecStart={{exim}} -bdf $DAEMON_OPTS $QUEUE_OPTS
+ExecReload=kill -HUP ${MAINPID}
+
+# If you do not need local deliveries, enabling the
+# next option can improve security
+#NoNewPrivileges=yes
+
+ProtectSystem=strict
+ReadWriteDirectories={{spooldir}}
+ReadWriteDirectories={{logdir}}
+
+Slice=exim.slice
+
+[Install]
+WantedBy=multi-user.target
diff --git a/configs/system-integration/systemd/inetd/exim.socket b/configs/system-integration/systemd/inetd/exim.socket
new file mode 100644 (file)
index 0000000..a802e8e
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Exim MTA (inetd)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Socket]
+ListenStream=25
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/configs/system-integration/systemd/inetd/exim@.service b/configs/system-integration/systemd/inetd/exim@.service
new file mode 100644 (file)
index 0000000..7771fde
--- /dev/null
@@ -0,0 +1,27 @@
+[Unit]
+Description=Exim MTA (socket activated - inetd mode)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Service]
+Type=exec
+
+# We can't use -odf, as this would ask exim to keep the connection
+# from the client open until the delivery is done
+ExecStart={{exim}} -bs
+
+StandardInput=socket
+StandardError=journal
+
+# Don't kill the delivery process we spawned as a child
+KillMode=process
+
+# If you do not need local deliveries, enabling the
+# next option can improve security
+#NoNewPrivileges=yes
+
+ProtectSystem=strict
+ReadWriteDirectories={{spooldir}}
+ReadWriteDirectories={{logdir}}
+
+Slice=exim.slice
diff --git a/configs/system-integration/systemd/install b/configs/system-integration/systemd/install
new file mode 100755 (executable)
index 0000000..83a648a
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/bash
+# simple helper, mainly for testing the provided Systemd units.
+
+set -eu
+export LC_ALL=C
+
+: ${EXIM=exim}
+: ${EXIM_LOGDIR=/var/log/exim}
+: ${EXIM_SPOOLDIR=/var/spool/exim}
+
+# Packagers should install to $(systemd-path systemd-system-unit)
+# which mostly is something like /lib/systemd/system
+dstdir=
+
+usage="$0 [OPTIONS] variant...
+  This simple script installs Systemd unit files to the desired destination, replacing
+  the {{Placeholder}}s.
+
+  VARIANT: one of daemon, inet, socket, maintainance, queuerunner
+
+  OPTIONS:
+  --help          print this help and exit cleanly
+  --uninstall|-u  uninstall the installed files
+  --dstdir|-d DIR the destination directory (mandatory, use 'DEFAULT'
+                  to use Systemd's default location (`systemd-path systemd-system-conf`)
+
+  Placeholders:
+  {{exim}} from \$EXIM ($EXIM)
+  {{logdir}} from \$EXIM_LOGDIR ($EXIM_LOGDIR)
+  {{spooldir}} from \$EXIM_SPOOLDIR ($EXIM_SPOOLDIR)
+"
+
+
+tmp=$(getopt -n $0 -o d:n --long dstdir:,help,uninstall -- "$@")
+eval set -- "$tmp"
+while true
+do
+       o=$1; shift
+       case $o in
+                -d|--dstdir) dstdir=$1; shift;;
+                --help) echo "$usage"; exit;;
+               -n|--uninstall) uninstall=1;;
+               --) break
+       esac
+done
+
+if [[ -v uninstall ]]
+then
+       if ! [[ -r .installed ]]
+       then
+               echo "$0: noting to uninstall (.installed is empty or isn't readable)" >&2
+               exit
+       fi
+
+       rm -vf $(<.installed)
+       rm -f .installed
+       exit
+fi
+
+case $dstdir in
+        DEFAULT) dstdir=$(systemd-path systemd-system-conf);;
+        "") echo "$0: --dstdir is mandatory" >&2; exit 1;;
+        *) ;;
+esac
+
+if (( $# == 0 ))
+then echo "$0: need variant" >&2; exit 1;
+fi
+
+function xform() {
+        sed -e "s|{{exim}}|${EXIM:?}|g" \
+            -e "s|{{logdir}}|${EXIM_LOGDIR:?}|g" \
+            -e "s|{{spooldir}}|${EXIM_SPOOLDIR:?}|g"
+}
+
+for dir in ${@:?need source dir(s)}
+do
+               echo "# $dir"
+               for src in "$dir"/*
+               do
+                       dst="$dstdir/${src##*/}"
+                       echo "installing $dst"
+                       xform <"$src" >"$dst"
+                       echo $dst >> .installed
+               done
+done
+
+if [[ $dstdir == $(systemd-path systemd-system-conf) ]]
+then
+        echo "# reloading systemd configuration"
+        systemctl daemon-reload
+fi
diff --git a/configs/system-integration/systemd/maintenance/exim-maintenance.service b/configs/system-integration/systemd/maintenance/exim-maintenance.service
new file mode 100644 (file)
index 0000000..42722d3
--- /dev/null
@@ -0,0 +1,24 @@
+[Unit]
+Description=Exim MTA (maintenance)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Service]
+Type=oneshot
+ExecReload=kill -HUP ${MAINPID}
+
+# Dollars are doubled for systemd!
+WorkingDirectory={{spooldir}}
+ExecStart=sh -ec 'for db in db/* ;\
+               do \
+                       test -f "$$db" && [ "$${db##*.}" != lockfile ] || continue ;\
+                       exim_tidydb $$PWD "$${db##*/}"; \
+               done'
+
+ProtectSystem=strict
+ReadWriteDirectories={{spooldir}}/db
+
+Slice=exim.slice
+
+[Install]
+WantedBy=multi-user.target
diff --git a/configs/system-integration/systemd/maintenance/exim-maintenance.timer b/configs/system-integration/systemd/maintenance/exim-maintenance.timer
new file mode 100644 (file)
index 0000000..bd192cd
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Exim MTA (maintenance timer)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Timer]
+OnActiveSec=1h
+OnUnitActiveSec=1d
+
+[Install]
+WantedBy=timers.target
diff --git a/configs/system-integration/systemd/queuerunner/exim-queuerunner.service b/configs/system-integration/systemd/queuerunner/exim-queuerunner.service
new file mode 100644 (file)
index 0000000..e6e9ca7
--- /dev/null
@@ -0,0 +1,21 @@
+[Unit]
+Description=Exim MTA (queue runner service)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Service]
+Type=oneshot
+
+ExecStart={{exim}} -q
+KillMode=process
+
+# If you do not need local deliveries, enabling the
+# next option can improve security
+#NoNewPrivileges=yes
+
+ProtectSystem=strict
+ReadWriteDirectories={{spooldir}}
+ReadWriteDirectories={{logdir}}
+ReadWriteDirectories=/var/mail /var/spool/mail
+
+Slice=exim.slice
diff --git a/configs/system-integration/systemd/queuerunner/exim-queuerunner.timer b/configs/system-integration/systemd/queuerunner/exim-queuerunner.timer
new file mode 100644 (file)
index 0000000..6988b7c
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Exim MTA (queue runner timer)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Timer]
+OnActiveSec=120
+OnUnitActiveSec=15m
+
+[Install]
+WantedBy=timers.target
diff --git a/configs/system-integration/systemd/socket/exim.service b/configs/system-integration/systemd/socket/exim.service
new file mode 100644 (file)
index 0000000..a4576ae
--- /dev/null
@@ -0,0 +1,26 @@
+[Unit]
+Description=Exim MTA (socket activated)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+PartOf=exim.socket
+
+[Service]
+Type=exec
+Environment=INACTIVITY_TIMEOUT=5m
+EnvironmentFile=-/etc/default/exim
+
+ExecStart=exim -bw${INACTIVITY_TIMEOUT}
+
+StandardInput=socket
+StandardError=journal
+
+# If you do not need local deliveries, enabling the
+# next option can improve security
+#NoNewPrivileges=yes
+
+ProtectSystem=strict
+ReadWriteDirectories={{spooldir}}
+ReadWriteDirectories={{logdir}}
+ReadWriteDirectories=/var/mail /var/spool/mail
+
+Slice=exim.slice
diff --git a/configs/system-integration/systemd/socket/exim.socket b/configs/system-integration/systemd/socket/exim.socket
new file mode 100644 (file)
index 0000000..8b38766
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Exim MTA (socket)
+Documentation=man:exim
+Documentation=https://exim.org/docs.html
+
+[Socket]
+ListenStream=25
+
+[Install]
+WantedBy=sockets.target
index 3129e605638455e083f9acba9316e8aa6c0cc317..c1e1d8fce28c455285f3713ef968629e736e3d33 100644 (file)
@@ -48,7 +48,7 @@
 . Copyright year.  Update this (only) when changing content.
 
 .macro copyyear
-2021
+2023
 .endmacro
 
 . ===========================================================================
index 70988384dca6f5e22fc46af00feade2059292b82..f856af346219587ee3183e046472cf55bb70e02a 100644 (file)
@@ -46,7 +46,7 @@
 . Update the Copyright year (only) when changing content.
 . /////////////////////////////////////////////////////////////////////////////
 
-.set previousversion "4.96"
+.set previousversion "4.97"
 .include ./local_params
 
 .set ACL "access control lists (ACLs)"
@@ -55,7 +55,7 @@
 .set drivernamemax "64"
 
 .macro copyyear
-2022
+2023
 .endmacro
 
 . /////////////////////////////////////////////////////////////////////////////
@@ -996,12 +996,9 @@ contains the number of seconds since the start of the epoch (the normal Unix
 way of representing the date and time of day).
 .next
 After the first hyphen, the next
-.new
 eleven
-.wen
 characters are the id of the process that received the message.
 .next
-.new
 There are two different possibilities for the final four characters:
 .olist
 .oindex "&%localhost_number%&"
@@ -1017,7 +1014,6 @@ If &%localhost_number%& is set, it is multiplied by
 500000 (250000) and added to
 the fractional part of the time, which in this case is in units of 2 us (4 us).
 .endlist
-.wen
 .endlist
 
 After a message has been received, Exim waits for the clock to tick at the
@@ -2846,13 +2842,11 @@ of Exim is installed. It is not necessary to do this when other files that are
 referenced from the configuration (for example, alias files) are changed,
 because these are reread each time they are used.
 
-.new
 Either a SIGTERM or a SIGINT signal should be used to cause the daemon
 to cleanly shut down.
 Subprocesses handling recceiving or delivering messages,
 or for scanning the queue,
 will not be affected by the termination of the daemon process.
-.wen
 
 .cmdopt -bdf
 This option has the same effect as &%-bd%& except that it never disconnects
@@ -2890,11 +2884,9 @@ defined and macros will be expanded.
 Because macros in the config file are often used for secrets, those are only
 available to admin users.
 
-.new
 The word &"set"& at the start of a line, followed by a single space,
 is recognised specially as defining a value for a variable.
 The syntax is otherwise the same as the ACL modifier &"set ="&.
-.wen
 
 .cmdopt -bem <&'filename'&>
 .cindex "testing" "string expansion"
@@ -4450,7 +4442,6 @@ It is only relevant when the &%-bd%& (start listening daemon) option is also
 given.
 Normally the daemon creates this socket, unless a &%-oX%& and &*no*& &%-oP%&
 option is also present.
-.new
 If this option is given then the socket will not be created.  This is required
 if the system is running multiple daemons, in which case it should
 be used on all.
@@ -4464,7 +4455,6 @@ caching compiled regexes
 .next
 obtaining a current queue size
 .endlist
-.wen
 
 .cmdopt -pd
 .cindex "Perl" "starting the interpreter"
@@ -4569,12 +4559,10 @@ delivered down a single SMTP
 .cindex "multiple SMTP deliveries"
 connection because of the hints that were set up during the first queue scan.
 
-.new
 Two-phase queue runs should be used on systems which, even intermittently,
 have a large queue (such as mailing-list operators).
 They may also be useful for hosts that are connected to the Internet
 intermittently.
-.wen
 
 .vitem &%-q[q]i...%&
 .oindex "&%-qi%&"
@@ -4660,14 +4648,12 @@ combined daemon at system boot time is to use a command such as
 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
 process every 30 minutes.
 
-.new
 .cindex "named queues" "queue runners"
 It is possible to set up runners for multiple named queues within one daemon,
 For example:
 .code
 exim -qGhipri/2m -q10m -qqGmailinglist/1h
 .endd
-.wen
 
 When a daemon is started by &%-q%& with a time value, but without &%-bd%&, no
 pid file is written unless one is explicitly requested by the &%-oP%& option.
@@ -7409,10 +7395,8 @@ For example, the way to write the NIS+ query is
 [name="${quote_nisplus:$local_part}"]
 .endd
 .cindex "tainted data" "in lookups"
-.new
 &*All*& tainted data used in a query-style lookup must be quoted
 using a mechanism appropriate for the lookup type.
-.wen
 See chapter &<<CHAPexpand>>& for full coverage of string expansions. The quote
 operator can be used for all lookup types, but has no effect for single-key
 lookups, since no quoting is ever needed in their key strings.
@@ -8234,7 +8218,7 @@ daemon as in the other SQL databases.
 .oindex &%sqlite_dbfile%&
 There are two ways of
 specifying the file.
-The first is is by using the &%sqlite_dbfile%& main option.
+The first is by using the &%sqlite_dbfile%& main option.
 The second, which allows separate files for each query,
 is to use an option appended, comma-separated, to the &"sqlite"&
 lookup type word.  The option is the word &"file"&, then an equals,
@@ -9622,7 +9606,6 @@ value. Nevertheless the &%-be%& option can be useful for checking out file and
 database lookups, and the use of expansion operators such as &%sg%&, &%substr%&
 and &%nhash%&.
 
-.new
 When reading lines from the standard input,
 macros can be defined and ACL variables can be set.
 For example:
@@ -9631,7 +9614,6 @@ MY_MACRO = foo
 set acl_m_myvar = bar
 .endd
 Such macros and variables can then be used in later input lines.
-.wen
 
 Exim gives up its root privilege when it is called with the &%-be%& option, and
 instead runs under the uid and gid it was called with, to prevent users from
@@ -9748,9 +9730,7 @@ Example use (as an ACL modifier):
       add_header = :at_start:${authresults {$primary_hostname}}
 .endd
 This is safe even if no authentication results are available
-.new
 and would generally be placed in the DATA ACL.
-.wen
 
 
 .vitem "&*${certextract{*&<&'field'&>&*}{*&<&'certificate'&>&*}&&&
@@ -10010,9 +9990,7 @@ default, but the separator can be changed in the usual way (&<<SECTlistsepchange
 For each item
 in this list, its value is placed in &$item$&, and then the condition is
 evaluated.
-.new
 Any modification of &$value$& by this evaluation is discarded.
-.wen
 If the condition is true, &$item$& is added to the output as an
 item in a new list; if the condition is false, the item is discarded. The
 separator used for the output list is the same as the one used for the
@@ -10633,7 +10611,7 @@ expansion items.
 This item inserts &"raw"& header lines. It is described with the &%header%&
 expansion item in section &<<SECTexpansionitems>>& above.
 
-.vitem "&*${run<&'options'&> {*&<&'command&~arg&~list'&>&*}{*&<&'string1'&>&*}&&&
+.vitem "&*${run<&'options'&> {*&<&'command&~string'&>&*}{*&<&'string1'&>&*}&&&
         {*&<&'string2'&>&*}}*&"
 .cindex "expansion" "running a command"
 .cindex "&%run%& expansion item"
@@ -10642,8 +10620,8 @@ One option is supported after the word &'run'&, comma-separated
 and without whitespace.
 
 If the option &'preexpand'& is not used,
-the command string is split into individual arguments by spaces
-and then each argument is expanded.
+the command string before expansion is split into individual arguments by spaces
+and then each argument is separately expanded.
 Then the command is run
 in a separate process, but under the same uid and gid.  As in other command
 executions from Exim, a shell is not used by default. If the command requires
@@ -10655,9 +10633,9 @@ potential attacker;
 a careful assessment for security vulnerabilities should be done.
 
 If the option &'preexpand'& is used,
-the command and its arguments are first expanded as one string. The result is
-split apart into individual arguments by spaces, and then the command is run
-as above.
+the command string is first expanded as a whole.
+The expansion result is split apart into individual arguments by spaces,
+and then the command is run as above.
 Since the arguments are split by spaces, when there is a variable expansion
 which has an empty result, it will cause the situation that the argument will
 simply be omitted when the program is actually executed by Exim. If the
@@ -11122,7 +11100,6 @@ abbreviation &%h%& can be used when &%hash%& is used as an operator.
 
 
 
-.new
 .vitem &*${headerwrap_*&<&'cols'&>&*_*&<&'limit'&>&*:*&<&'string'&>&*}*&
 .cindex header "wrapping operator"
 .cindex expansion "header wrapping"
@@ -11136,7 +11113,6 @@ column number is reached.
 Whitespace at a chosen wrap point is removed.
 A line-wrap consists of a newline followed by a tab,
 and the tab is counted as 8 columns.
-.wen
 
 
 
@@ -13436,7 +13412,6 @@ The main use of this variable is expected to be to distinguish between
 rejections of MAIL and rejections of RCPT.
 
 .tvar &$recipients$&
-.new
 .tvar &$recipients_list$&
 These variables both contain the envelope recipients for a message.
 
@@ -13445,7 +13420,6 @@ The first uses a comma and a space separate the addresses in the replacement tex
 this variable is not intended for further processing.
 
 The second is a proper Exim list; colon-separated.
-.wen
 
 However, the variables
 are not generally available, to prevent exposure of Bcc recipients in
@@ -15754,10 +15728,8 @@ by a setting such as this:
 dns_again_means_nonexist = *.in-addr.arpa
 .endd
 This option applies to all DNS lookups that Exim does,
-.new
 except for TLSA lookups (where knowing about such failures
 is security-relevant).
-.wen
 It also applies when the
 &[gethostbyname()]& or &[getipnodebyname()]& functions give temporary errors,
 since these are most likely to be caused by DNS lookup problems. The
@@ -16337,10 +16309,8 @@ This option is obsolete, and retained only for backward compatibility, because
 nowadays the ACL specified by &%acl_smtp_connect%& can also reject incoming
 connections immediately.
 
-.new
 If the connection is on a TLS-on-connect port then the TCP connection is
 just dropped.  Otherwise, an SMTP error is sent first.
-.wen
 
 The ability to give an immediate rejection (either by this option or using an
 ACL) is provided for use in unusual cases. Many hosts will just try again,
@@ -16361,10 +16331,8 @@ local processes, you must create a host list with an empty item. For example:
 .code
 hosts_connection_nolog = :
 .endd
-.new
 The hosts affected by this option also do not log "no MAIL in SMTP connection"
 lines, as may commonly be produced by a monitoring system.
-.wen
 
 
 .option hosts_require_alpn main "host list&!!" unset
@@ -17036,7 +17004,6 @@ to be used in conjunction with &(oracle)& lookups (see section &<<SECID72>>&).
 The option is available only if Exim has been built with Oracle support.
 
 
-.new
 .option panic_coredump main boolean false
 This option is rarely needed but can help for some debugging investigations.
 If set, when an internal error is detected by Exim which is sufficient
@@ -17047,7 +17014,6 @@ then a coredump is requested.
 Note that most systems require additional administrative configuration
 to permit write a core file for a setuid program, which is Exim's
 common installed configuration.
-.wen
 
 .option percent_hack_domains main "domain list&!!" unset
 .cindex "&""percent hack""&"
@@ -17830,10 +17796,8 @@ positive response to an SMTP connection. The default setting is:
 smtp_banner = $smtp_active_hostname ESMTP Exim \
   $version_number $tod_full
 .endd
-.new
 Failure to expand the string causes a panic error;
 a forced fail just closes the connection.
-.wen
 If you want to create a
 multiline response to the initial SMTP connection, use &"\n"& in the string at
 appropriate points, but not at the end. Note that the 220 code is not included
@@ -18579,9 +18543,7 @@ It has no effect when Exim is used with GnuTLS
 &%tls_require_ciphers%& option).
 
 After expansion it must contain
-.new
 one or (only for OpenSSL versiona 1.1.1 onwards) more
-.wen
 EC curve names, such as &`prime256v1`&, &`secp384r1`&, or &`P-521`&.
 Consult your OpenSSL manual for valid curve names.
 
@@ -18589,9 +18551,7 @@ For OpenSSL versions before (and not including) 1.0.2, the string
 &`auto`& selects &`prime256v1`&. For more recent OpenSSL versions
 &`auto`& tells the library to choose.
 
-.new
 If the option expands to an empty string, the effect is undefined.
-.wen
 
 
 .option tls_ocsp_file main string&!! unset
@@ -25783,11 +25743,9 @@ Exim will request a Certificate Status on a
 TLS session for any host that matches this list.
 &%tls_verify_certificates%& should also be set for the transport.
 
-.new
 The default is &"**"& if DANE is not in use for the connection,
 or if DANE-TA us used.
 It is empty if DANE-EE is used.
-.wen
 
 .option hosts_require_alpn smtp "host list&!!" unset
 .cindex ALPN "require negotiation in client"
@@ -25933,16 +25891,12 @@ has advertised support for IGNOREQUOTA in its response to the LHLO command.
 .option max_rcpt smtp integer&!! 100
 .cindex "RCPT" "maximum number of outgoing"
 This option,
-.new
 after expansion,
-.wen
 limits the number of RCPT commands that are sent in a single
 SMTP message transaction.
 A value setting of zero disables the limit.
 
-.new
 If a constant is given,
-.wen
 each set of addresses is treated independently, and
 so can cause parallel connections to the same host if &%remote_max_parallel%&
 permits this.
@@ -27753,7 +27707,6 @@ no successful authentication.
 Successful authentication sets up information used by the
 &%authresults%& expansion item.
 
-.new
 .cindex authentication "failure event, server"
 If an authenticator is run and does not succeed,
 an event (see &<<CHAPevents>>&) of type "auth:fail" is raised.
@@ -27764,7 +27717,6 @@ will be valid.
 If the event is serviced and a string is returned then the string will be logged
 instead of the default log line.
 See <<CHAPevents>> for details on events.
-.wen
 
 
 .section "Testing server authentication" "SECID169"
@@ -27843,7 +27795,6 @@ Exim abandons trying to send the message to the host for the moment. It will
 try again later. If there are any backup hosts available, they are tried in the
 usual way.
 
-.new
 .next
 .cindex authentication "failure event, client"
 If the response to authentication is a permanent error (5&'xx'& code),
@@ -27853,7 +27804,6 @@ While the event is being processed the variable
 will be valid.
 If the event is serviced and a string is returned then the string will be logged.
 See <<CHAPevents>> for details on events.
-.wen
 
 .next
 If the response to authentication is a permanent error (5&'xx'& code), Exim
@@ -28433,11 +28383,9 @@ dovecot_ntlm:
   server_set_id = $auth1
 .endd
 
-.new
 &*Note*&: plaintext authentication methods such as PLAIN and LOGIN
 should not be advertised on cleartext SMTP connections.
 See the discussion in section &<<SECTplain_TLS>>&.
-.wen
 
 If the SMTP connection is encrypted, or if &$sender_host_address$& is equal to
 &$received_ip_address$& (that is, the connection is local), the &"secured"&
@@ -29246,8 +29194,8 @@ When using OpenSSL, this option is ignored.
 (If an API is found to let OpenSSL be configured in this way,
 let the Exim Maintainers know and we'll likely use it).
 .next
-With GnuTLS, if an explicit list is used for the &%tls_privatekey%& main option
-main option, it must be ordered to match the &%tls_certificate%& list.
+With GnuTLS, if an explicit list is used for the &%tls_privatekey%& main option,
+it must be ordered to match the &%tls_certificate%& list.
 .next
 Some other recently added features may only be available in one or the other.
 This should be documented with the feature.  If the documentation does not
@@ -30341,7 +30289,7 @@ DNSSEC.
 .next
 Add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
 .next
-Offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
+Offer a server certificate, or certificate chain, in TLS connections which is anchored by one of the TLSA records.
 .endlist
 
 There are no changes to Exim specific to server-side operation of DANE.
@@ -30670,11 +30618,9 @@ accepted by an &%accept%& verb that has a &%message%& modifier, the contents of
 the message override the banner message that is otherwise specified by the
 &%smtp_banner%& option.
 
-.new
 For tls-on-connect connections, the ACL is run before the TLS connection
 is accepted; if the ACL does not accept then the TCP connection is dropped without
 any TLS startup attempt and without any SMTP response being transmitted.
-.wen
 
 
 .subsection "The EHLO/HELO ACL" SECID192
@@ -32211,7 +32157,6 @@ DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
 
 More than one header can be removed at the same time by using a colon separated
 list of header specifiers.
-.new
 If a specifier does not start with a circumflex (^)
 then it is treated as a header name.
 The header name matching is case insensitive.
@@ -32225,7 +32170,6 @@ Example:
 .code
 remove_header = \N^(?i)Authentication-Results\s*::\s*example.org;\N
 .endd
-.wen
 
 List expansion is not performed, so you cannot use hostlists to
 create a list of headers, however both connection and message variable expansion
@@ -39187,12 +39131,10 @@ only way to log such cases is to interpose a script such as &_util/logargs.sh_&
 between the caller and Exim.
 .next
 .cindex "log" "connection identifier"
-.new
 &%connection_identifier%&: An identifier for the accepted connection is added to
 connection start and end lines and to message accept lines.
 The identifier is tagged by Ci=.
 The value is PID-based, so will reset on reboot and will wrap.
-.wen
 .next
 .cindex "log" "connection rejections"
 &%connection_reject%&: A log entry is written whenever an incoming SMTP
@@ -42335,11 +42277,9 @@ return false.
 If it is, the condition will return true and the variable
 &$srs_recipient$& will be set to the decoded (original) value.
 
-.new
 If the second argument is empty then the condition returns true if
 the first argument is in valid SRS formet, else false.
 The variable &$srs_recipient$& is not set for this case.
-.wen
 .endlist
 
 Example usage:
@@ -43038,8 +42978,8 @@ All other message types ignore the result string, and
 no other use is made of it.
 
 For a tcp:connect event, if the connection is being made to a proxy
-then the address and port variables will be that of the proxy and not
-the target system.
+then the &$host_address$& and &$host_port$& variables
+will be that of the proxy and not the target system.
 
 For tls:cert events, if GnuTLS is in use this will trigger only per
 chain element received on the connection.
index c840ac64f13da4643f95dde92614874f686fe84a..5916e91491f1c01d1f2e8bc0e9d56904892cffde 100755 (executable)
@@ -294,7 +294,7 @@ my($new_lastwasitem) = 0;
 
 # Chapter directives just require . => @; however, dequoting the
 # line thereafter will remove the first @, so just force it back
-# afterwards. If the chapter is is one describing a driver, set
+# afterwards. If the chapter is one describing a driver, set
 # the driver name.
 
 if (/\.chapter/)
index c1b577f6217fe84b00d7bc343837df9e3f45606d..990e72823a4b2b9465dd6aabe1631a8db95a11b2 100644 (file)
@@ -2,10 +2,13 @@ This document describes *changes* to previous versions, that might
 affect Exim's operation, with an unchanged configuration file.  For new
 options, and new features, see the NewStuff file next to this ChangeLog.
 
-Since 4.97
+Exim version 4.98
 -----------------
 
-JH/01 Handle error on close of the spool data file during reception.  Previously
+JH/01 Support list of dkim results in the dkim_status ACL condition, making
+      it more usable in the data ACL.
+
+JH/02 Handle error on close of the spool data file during reception.  Previously
       This was only logged, on the assumption that errors would be seen for
       a previous fflush().  However, a fuse filesystem has been reported as
       showing this an error for the fclose().  The spool is now in an uncertain
@@ -99,7 +102,7 @@ JH/18 Fix a fencepost error in logging.  Previously (since 4.92) when a log line
 
 JH/19 Bug 2911: Fix a recursion in DNS lookups.  Previously, if the main option
       dns_again_means_nonexist included an element causing a DNS lookup which
-      iteslf returned DNS_AGAIN, unbounded recursion occurred.  Possible results
+      itself returned DNS_AGAIN, unbounded recursion occurred.  Possible results
       included (though probably not limited to) a process crash from stack
       memory limit, or from excessive open files.  Replace this with a paniclog
       whine (as this is likely a configuration error), and returning
@@ -204,8 +207,26 @@ JH/38 Taint-track intermediate values from the peer in multi-stage authentation
 JH/39 Bug 3023: Fix crash induced by some combinations of zero-length strings
       and ${tr...}.  Found and diagnosed by Heiko Schlichting.
 
-JH/40 Support list of dkim results in the dkim_status ACL condition, making
-      it more usable in the data ACL.
+JH/40 Bug 2999: Fix a possible OOB write in the external authenticator, which
+      could be triggered by externally-supplied input.  Found by Trend Micro.
+      CVE-2023-42115
+
+JH/41 Bug 3000: Fix a possible OOB write in the SPA authenticator, which could
+      be triggered by externally-controlled input.  Found by Trend Micro.
+      CVE-2023-42116
+
+JH/42 Bug 3001: Fix a possible OOB read in the SPA authenticator, which could
+      be triggered by externally-controlled input.  Found by Trend Micro.
+      CVE-2023-42114
+
+JH/43 Bug 2903: avoid exit on an attempt to rewrite a malformed address.
+      Make the rewrite never match and keep the logging.  Trust the
+      admin to be using verify=header-syntax (to actually reject the message).
+
+JH/44 Bug 3033: Harden dnsdb lookups against crafted DNS responses.
+      CVE-2023-42219
+
+HS/02 Fix string_is_ip_address() CVE-2023-42117 (Bug 3031)
 
 
 Exim version 4.96
index beca9748c792914070d2e887243ba4271a6bf6ba..6aef41e50b53022180e0bdc9b1e4ce7aa8cfe2ef 100644 (file)
@@ -6,9 +6,9 @@ Before a formal release, there may be quite a lot of detail so that people can
 test from the snapshots or the Git before the documentation is updated. Once
 the documentation is updated, this file is reduced to a short list.
 
-Since 4.97
+Version 4.98
 ------------
- 1. The dkim_status ACL condition may not be used in data ACLs
+ 1. The dkim_status ACL condition may now be used in data ACLs
 
 Version 4.97
 ------------
@@ -1194,7 +1194,7 @@ Version 4.68
 
  9. There is a new ACL, specified by acl_smtp_notquit, which is run in most
     cases when an SMTP session ends without sending QUIT. However, when Exim
-    itself is is bad trouble, such as being unable to write to its log files,
+    itself is in bad trouble, such as being unable to write to its log files,
     this ACL is not run, because it might try to do things (such as write to
     log files) that make the situation even worse.
 
index 47051dff1f7b65b2522c72f6b4d1305c84a11ced..ed075b42bde4906c976af28a096862353b1bbcf5 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# Copyright (c) The Exim Maintainers 2016 - 2021
+# Copyright (c) The Exim Maintainers 2016 - 2023
 
 use strict;
 use warnings;
index b8d88054d4016e2583fc41675be27bd3d10e0c4f..7b1434a5929e28966d57ac8f5b0908b5b09af76c 100644 (file)
@@ -2,7 +2,7 @@
 # appropriate links, and then creating and running the main makefile in that
 # directory.
 
-# Copyright (c) The Exim Maintainers 2022
+# Copyright (c) The Exim Maintainers 2022 - 2023
 # Copyright (c) University of Cambridge, 1995 - 2018
 # SPDX-License-Identifier: GPL-2.0-or-later
 # See the file NOTICE for conditions of use and distribution.
index 6778331c7100c218d7c7fc7a92a4bd969b40b016..6dcf18b582fb5e56e9b41309eb6e62cdff39f584 100644 (file)
@@ -5,7 +5,7 @@
 # optional, Local/* files at the front of this file, to create Makefile in the
 # build directory.
 #
-# Copyright (c) The Exim Maintainers 1995 - 2022
+# Copyright (c) The Exim Maintainers 1995 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 SHELL      = $(MAKE_SHELL)
index f0fb8f2c962717f83c33ac022936f9a685a7b534..ca1073e11b75feb2980359c0e4a1ca3a527e8f55 100644 (file)
@@ -1,6 +1,6 @@
 # Exim: OS-specific make file for FreeBSD
 #
-# Copyright (c) The Exim Maintainers 2020
+# Copyright (c) The Exim Maintainers 2020 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 CHOWN_COMMAND=/usr/sbin/chown
index da648df43750d2ce20eb50d191f0dffcc0cbf79c..b6c374cec654bc9e480b388c07dfd24a43660019 100644 (file)
@@ -1,5 +1,5 @@
 # Exim: OS-specific make file for OpenBSD
-# Copyright (c) The Exim Maintainers 2022
+# Copyright (c) The Exim Maintainers 2022 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 CHOWN_COMMAND=/usr/sbin/chown
index e8b0d95063ffc7f508c985bf4928911bf195fd13..3e8523f4c345d0490afb5ce2adeba779b197eed0 100644 (file)
@@ -1,5 +1,5 @@
 # Exim: OS-specific make file for SunOS5
-# Copyright (c) The Exim Maintainers 2020
+# Copyright (c) The Exim Maintainers 2020 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 HAVE_ICONV=yes
index 50b8cd8bdfef391a4bd6a81be81d62b76fbc2388..973e4a52507642ab322346dc2f7262a1296046d9 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2021 - 2022 */
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index 926dbd95b75df8e21fcf644482284dd1413deea6..03f925f526946e7ce051945abe1867d03f92de17 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2021 */
+/* Copyright (c) The Exim Maintainers 2023 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index accc936528ca34ea2b4b988ce0c8cebd9bda819b..4c3d3fd1854cd92d85663195af912d01b16f75e3 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index 0694af4c087145413e6d7f43f97f80cd9929f738..352176fa4e65e3ae65ac0b98e242831d9898718f 100755 (executable)
@@ -3,7 +3,7 @@
 # Script to build links for all the exim source files from the system-
 # specific build directory. It should be run from within that directory.
 #
-# Copyright (c) The Exim Maintainers 1995 - 2022
+# Copyright (c) The Exim Maintainers 1995 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 test ! -d ../src && \
index 90eb096611b558f180902f86bf55fa327492f9f4..85e444377e80f98ce49d84237e77d322b2b39ec4 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Copyright (c) The Exim Maintainters 2022
+# Copyright (c) The Exim Maintainters 2022 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 # Script to install Exim binaries in BIN_DIRECTORY, which is defined in
index ac323fe1808cd6ac209439e409d01b3c6e13d4d4..f68b3f104d99dbc7f96c20ac3512861931f6c9d7 100644 (file)
@@ -1,7 +1,7 @@
 ##################################################
 #          The Exim mail transport agent         #
 ##################################################
-# Copyright (c) The Exim Maintainers 2022
+# Copyright (c) The Exim Maintainers 2022 - 2023
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 # This is the template for Exim's main build-time configuration file. It
index 8431efc84cb70a47c57871c72536c14bdbe0ebf6..cdf60bbb84084390a4a35b91e0e3f3d0512feca6 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
@@ -1441,6 +1441,7 @@ for (rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS);
 
   /* Extract the numerical SRV fields (p is incremented) */
 
+  if (rr_bad_size(rr, 3 * sizeof(uint16_t))) continue;
   GETSHORT(priority, p);
   GETSHORT(weight, p);
   GETSHORT(port, p);
index 611697021c102101f5431367cda84451c52a91ec..defe9b171bba5fc5a99a9187aaa9bc7a167e50b0 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 /* Experimental ARC support for Exim
    Copyright (c) Jeremy Harris 2018 - 2020
-   Copyright (c) The Exim Maintainers 2021 - 2022
+   Copyright (c) The Exim Maintainers 2021 - 2023
    License: GPL
    SPDX-License-Identifier: GPL-2.0-or-later
 */
index bcf88c84d0eafe84f5395bb496ec791b5b8904bf..fd30990343c600b99aec36545cb1288f478eb1e5 100644 (file)
@@ -9,7 +9,7 @@
  * All the original code used here was torn by Marc Prud'hommeaux out of the
  * Samba project (by Andrew Tridgell, Jeremy Allison, and others).
  *
- * Copyright (c) The Exim Maintainers 2021
+ * Copyright (c) The Exim Maintainers 2021 - 2023
  * SPDX-License-Identifier: GPL-2.0-or-later
 
  * Tom Kistner provided additional code, adding spa_build_auth_challenge() to
@@ -156,6 +156,9 @@ int main (int argc, char ** argv)
    up with a different answer to the one above)
 */
 
+#ifndef MACRO_PREDEF
+
+
 #define DEBUG_X(a,b) ;
 
 extern int DEBUGLEVEL;
@@ -1212,7 +1215,9 @@ char versionString[] = "libntlm version 0.21";
 
 #define spa_bytes_add(ptr, header, buf, count) \
 { \
-if (buf && (count) != 0) /* we hate -Wint-in-bool-contex */ \
+if (  buf && (count) != 0      /* we hate -Wint-in-bool-contex */ \
+   && ptr->bufIndex + count < sizeof(ptr->buffer)              \
+   ) \
   { \
   SSVAL(&ptr->header.len,0,count); \
   SSVAL(&ptr->header.maxlen,0,count); \
@@ -1230,35 +1235,30 @@ else \
 
 #define spa_string_add(ptr, header, string) \
 { \
-char *p = string; \
+uschar * p = string; \
 int len = 0; \
-if (p) len = strlen(p); \
-spa_bytes_add(ptr, header, (US p), len); \
+if (p) len = Ustrlen(p); \
+spa_bytes_add(ptr, header, p, len); \
 }
 
 #define spa_unicode_add_string(ptr, header, string) \
 { \
-char *p = string; \
-uschar *b = NULL; \
+uschar * p = string; \
+uschar * b = NULL; \
 int len = 0; \
 if (p) \
   { \
-  len = strlen(p); \
-  b = strToUnicode(p); \
+  len = Ustrlen(p); \
+  b = US strToUnicode(CS p); \
   } \
 spa_bytes_add(ptr, header, b, len*2); \
 }
 
 
-#define GetUnicodeString(structPtr, header) \
-unicodeToString(((char*)structPtr) + IVAL(&structPtr->header.offset,0) , SVAL(&structPtr->header.len,0)/2)
-#define GetString(structPtr, header) \
-toString(((CS structPtr) + IVAL(&structPtr->header.offset,0)), SVAL(&structPtr->header.len,0))
-
 #ifdef notdef
 
 #define DumpBuffer(fp, structPtr, header) \
-dumpRaw(fp,(US structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&structPtr->header.len,0))
+ dumpRaw(fp,(US structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&structPtr->header.len,0))
 
 
 static void
@@ -1322,8 +1322,33 @@ buf[len] = 0;
 return buf;
 }
 
+static inline uschar *
+get_challenge_unistr(SPAAuthChallenge * challenge, SPAStrHeader * hdr)
+{
+int off = IVAL(&hdr->offset, 0);
+int len = SVAL(&hdr->len, 0);
+return off + len < sizeof(SPAAuthChallenge)
+  ? US unicodeToString(CS challenge + off, len/2) : US"";
+}
+
+static inline uschar *
+get_challenge_str(SPAAuthChallenge * challenge, SPAStrHeader * hdr)
+{
+int off = IVAL(&hdr->offset, 0);
+int len = SVAL(&hdr->len, 0);
+return off + len < sizeof(SPAAuthChallenge)
+  ? US toString(CS challenge + off, len) : US"";
+}
+
 #ifdef notdef
 
+#define GetUnicodeString(structPtr, header) \
+ unicodeToString(((char*)structPtr) + IVAL(&structPtr->header.offset,0) , SVAL(&structPtr->header.len,0)/2)
+
+#define GetString(structPtr, header) \
+ toString(((CS structPtr) + IVAL(&structPtr->header.offset,0)), SVAL(&structPtr->header.len,0))
+
+
 void
 dumpSmbNtlmAuthRequest (FILE * fp, SPAAuthRequest * request)
 {
@@ -1367,15 +1392,15 @@ fprintf (fp, "      Flags = %08x\n", IVAL (&response->flags, 0));
 #endif
 
 void
-spa_build_auth_request (SPAAuthRequest * request, char *user, char *domain)
+spa_build_auth_request (SPAAuthRequest * request, uschar * user, uschar * domain)
 {
-char *u = strdup (user);
-char *p = strchr (u, '@');
+uschar * u = string_copy(user);
+uschar * p = Ustrchr(u, '@');
 
 if (p)
   {
   if (!domain)
-   domain = p + 1;
+    domain = p + 1;
   *p = '\0';
   }
 
@@ -1385,7 +1410,6 @@ SIVAL (&request->msgType, 0, 1);
 SIVAL (&request->flags, 0, 0x0000b207);      /* have to figure out what these mean */
 spa_string_add (request, user, u);
 spa_string_add (request, domain, domain);
-free (u);
 }
 
 
@@ -1476,16 +1500,16 @@ free (u);
 
 void
 spa_build_auth_response (SPAAuthChallenge * challenge,
-                        SPAAuthResponse * response, char *user,
-                        char *password)
+                        SPAAuthResponse * response, uschar * user,
+                        uschar * password)
 {
 uint8x lmRespData[24];
 uint8x ntRespData[24];
 uint32x cf = IVAL(&challenge->flags, 0);
-char *u = strdup (user);
-char *p = strchr (u, '@');
-char *d = NULL;
-char *domain;
+uschar * u = string_copy(user);
+uschar * p = Ustrchr(u, '@');
+uschar * d = NULL;
+uschar * domain;
 
 if (p)
   {
@@ -1493,33 +1517,33 @@ if (p)
   *p = '\0';
   }
 
-else domain = d = strdup((cf & 0x1)?
-  CCS GetUnicodeString(challenge, uDomain) :
-  CCS GetString(challenge, uDomain));
+else domain = d = string_copy(cf & 0x1
+  ? CUS get_challenge_unistr(challenge, &challenge->uDomain)
+  : CUS get_challenge_str(challenge, &challenge->uDomain));
 
-spa_smb_encrypt (US password, challenge->challengeData, lmRespData);
-spa_smb_nt_encrypt (US password, challenge->challengeData, ntRespData);
+spa_smb_encrypt(password, challenge->challengeData, lmRespData);
+spa_smb_nt_encrypt(password, challenge->challengeData, ntRespData);
 
 response->bufIndex = 0;
 memcpy (response->ident, "NTLMSSP\0\0\0", 8);
 SIVAL (&response->msgType, 0, 3);
 
-spa_bytes_add (response, lmResponse, lmRespData, (cf & 0x200) ? 24 : 0);
-spa_bytes_add (response, ntResponse, ntRespData, (cf & 0x8000) ? 24 : 0);
+spa_bytes_add(response, lmResponse, lmRespData, cf & 0x200 ? 24 : 0);
+spa_bytes_add(response, ntResponse, ntRespData, cf & 0x8000 ? 24 : 0);
 
 if (cf & 0x1) {      /* Unicode Text */
-     spa_unicode_add_string (response, uDomain, domain);
-     spa_unicode_add_string (response, uUser, u);
-     spa_unicode_add_string (response, uWks, u);
+     spa_unicode_add_string(response, uDomain, domain);
+     spa_unicode_add_string(response, uUser, u);
+     spa_unicode_add_string(response, uWks, u);
 } else {             /* OEM Text */
-     spa_string_add (response, uDomain, domain);
-     spa_string_add (response, uUser, u);
-     spa_string_add (response, uWks, u);
+     spa_string_add(response, uDomain, domain);
+     spa_string_add(response, uUser, u);
+     spa_string_add(response, uWks, u);
 }
 
-spa_string_add (response, sessionKey, NULL);
+spa_string_add(response, sessionKey, NULL);
 response->flags = challenge->flags;
-
-if (d != NULL) free (d);
-free (u);
 }
+
+
+#endif   /*!MACRO_PREDEF*/
index db93891ab2a5c3e9e2094caa999b8d098bdd5185..629f50af5c342710a5cd7989102065217a595675 100644 (file)
@@ -9,6 +9,7 @@
  * All the code used here was torn by Marc Prud'hommeaux out of the
  * Samba project (by Andrew Tridgell, Jeremy Allison, and others).
  */
+/* Copyright (c) The Exim Maintainers 2023 */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 /* December 2004: The spa_base64_to_bits() function has no length checking in
@@ -80,10 +81,10 @@ typedef struct
 
 void spa_bits_to_base64 (unsigned char *, const unsigned char *, int);
 int spa_base64_to_bits(char *, int, const char *);
-void spa_build_auth_response (SPAAuthChallenge *challenge,
-       SPAAuthResponse *response, char *user, char *password);
-void spa_build_auth_request (SPAAuthRequest *request, char *user,
-       char *domain);
+void spa_build_auth_response (SPAAuthChallenge * challenge,
+       SPAAuthResponse * response, uschar * user, uschar * password);
+void spa_build_auth_request (SPAAuthRequest * request, uschar * user,
+       uschar * domain);
 extern void spa_smb_encrypt (unsigned char * passwd, unsigned char * c8,
                              unsigned char * p24);
 extern void spa_smb_nt_encrypt (unsigned char * passwd, unsigned char * c8,
index 1b0430ab127a8ec038820c3b7946422afae07427..16aeebdcb51af806743922674dc31bbb47c6699c 100644 (file)
@@ -2,6 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2012 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index 583080211af0f30099836253cc265db0c3efa466..0761b7c6a7a6e9861391e5fdbeee446f8c07fcdf 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index a3d3906b885b4c7cbc66f75f40a7753141ed9df5..8488fba19c791c7bb038bd1d79f472403ec10988 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 85d029c9c6a8581e7de68f40d42ecf807c48ad3b..377c09205f4258e1aa68459a12d65e3bb16db4c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) The Exim Maintainers 2006 - 2022
+ * Copyright (c) The Exim Maintainers 2006 - 2023
  * Copyright (c) 2004 Andrey Panin <pazke@donpac.ru>
  * SPDX-License-Identifier: GPL-2.0-or-later
  *
index 078aad0faa9be77d09dca6bc283808f63f0f2247..a89a50486b59be3248bed2d354ce8ba78cdd45ff 100644 (file)
@@ -2,6 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2023 */
 /* Copyright (c) Jeremy Harris 2019-2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
@@ -104,7 +105,7 @@ if (expand_nmax == 0)       /* skip if rxd data */
 if (ob->server_param2)
   {
   uschar * s = expand_string(ob->server_param2);
-  auth_vars[expand_nmax] = s;
+  auth_vars[expand_nmax = 1] = s;
   expand_nstring[++expand_nmax] = s;
   expand_nlength[expand_nmax] = Ustrlen(s);
   if (ob->server_param3)
index b52de6aba266c8096755586dff0239b3cac34398..0c9fb37fe8455b86d7e3e17dc2f7d0f878730710 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index 2c39d0f210b64f81bf6c67728f925f0bf262b283..07b91e7904455f3b610f18977d95482f110018ac 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2019 - 2022 */
+/* Copyright (c) The Exim Maintainers 2019 - 2023 */
 /* 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 */
index 59884ef58e2c32d0f3c2f1567c5dff23f436efe1..686b2d98d774b8e813713e449785ca5e569255e4 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 1392b369fa7d5d6fa928e8db2a7ad46c13d09d96..391e629f9e230a52b42baa23a246e5ec9a1eddc2 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index 222ccea86fc6741fdf07027082ac1309fda75e6e..0d4262ec563423b11b0c4d9de36bb559c449ec8b 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
@@ -285,14 +285,13 @@ SPAAuthRequest   request;
 SPAAuthChallenge challenge;
 SPAAuthResponse  response;
 char msgbuf[2048];
-char *domain = NULL;
-char *username, *password;
+uschar * domain = NULL, * username, * password;
 
 /* Code added by PH to expand the options */
 
 *buffer = 0;    /* Default no message when cancelled */
 
-if (!(username = CS expand_string(ob->spa_username)))
+if (!(username = expand_string(ob->spa_username)))
   {
   if (f.expand_string_forcedfail) return CANCELLED;
   string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
@@ -301,7 +300,7 @@ if (!(username = CS expand_string(ob->spa_username)))
   return ERROR;
   }
 
-if (!(password = CS expand_string(ob->spa_password)))
+if (!(password = expand_string(ob->spa_password)))
   {
   if (f.expand_string_forcedfail) return CANCELLED;
   string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
@@ -311,7 +310,7 @@ if (!(password = CS expand_string(ob->spa_password)))
   }
 
 if (ob->spa_domain)
-  if (!(domain = CS expand_string(ob->spa_domain)))
+  if (!(domain = expand_string(ob->spa_domain)))
     {
     if (f.expand_string_forcedfail) return CANCELLED;
     string_format(buffer, buffsize, "expansion of \"%s\" failed in %s "
@@ -331,7 +330,7 @@ if (!smtp_read_response(sx, US buffer, buffsize, '3', timeout))
 
 DSPA("\n\n%s authenticator: using domain %s\n\n", ablock->name, domain);
 
-spa_build_auth_request(&request, CS username, domain);
+spa_build_auth_request(&request, username, domain);
 spa_bits_to_base64(US msgbuf, US &request, spa_request_length(&request));
 
 DSPA("\n\n%s authenticator: sending request (%s)\n\n", ablock->name, msgbuf);
@@ -348,7 +347,7 @@ if (!smtp_read_response(sx, US buffer, buffsize, '3', timeout))
 DSPA("\n\n%s authenticator: challenge (%s)\n\n", ablock->name, buffer + 4);
 spa_base64_to_bits(CS (&challenge), sizeof(challenge), CCS (buffer + 4));
 
-spa_build_auth_response(&challenge, &response, CS username, CS password);
+spa_build_auth_response(&challenge, &response, username, password);
 spa_bits_to_base64(US msgbuf, US &response, spa_request_length(&response));
 DSPA("\n\n%s authenticator: challenge response (%s)\n\n", ablock->name, msgbuf);
 
index edd2282d0a1acf14d338d21e021458654f0e271e..d261801ae52687051cb6996a6041a3ac73117117 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2022 */
+/* Copyright (c) The Exim Maintainers 2022 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2009 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index 591ea3d5b1b15221f126c9f4d103e4d8d2319a40..f14ecc30a0a0f48bd006b50a6d383422c1d005d8 100644 (file)
@@ -2,12 +2,12 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
 /* Copyright (c) Tom Kistner <tom@duncanthrax.net> 2004, 2015 */
 /* License: GPL */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
-/* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
index 8f37e508ab4da293a055cd9a806e3fffb9646380..8f53671a0fb684fd95b4bbf1b1479b010cc3b5d4 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2022 */
+/* Copyright (c) The Exim Maintainers 2022 - 2023 */
 /* 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 */
index fb5fe3603bcb268420c77252b763071953204e9c..28d4f13f7a141245f58735f9b90db3619501bd96 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2018 - 2022 */
+/* Copyright (c) The Exim Maintainers 2018 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 
index b0938cbaa37124933ffb3fe57a7117abb71d85da..f2183c735f6acb3f9813cb8c01844491230cb9c0 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
-/* Copyright (c) University of Cambridge 1995 - 2023 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
+/* 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 */
 
index e7a932426cae4df9f3eb10d4d320de37257cefb8..8939bbef6b9e412f7dc70ddd6d49c52be09aabfc 100644 (file)
@@ -2,12 +2,13 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) Wolfgang Breyha 2005 - 2019
+/*
+ * Copyright (c) The Exim Maintainers 2015 - 2023
+ * Copyright (c) Wolfgang Breyha 2005 - 2019
  * Vienna University Computer Center
  * wbreyha@gmx.net
  * See the file NOTICE for conditions of use and distribution.
  *
- * Copyright (c) The Exim Maintainers 2015 - 2022
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
index dac7384705497e1c21c1b51517fb2c80a6f2317b..1d48f13952b52b322265eb3ce9f4ed92a039ba22 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2015 - 2022 */
+/* Copyright (c) The Exim Maintainers 2015 - 2023 */
 /* 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 */
index a49c8d764b2749c59a0535c1dd587570a158ba3b..ea82f34eab673d3be03407449656426aed568d1f 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 5b79b4b76fffd0d2e79ce972f4dc37587921f453..fae2f4891c27f4a7f2d7f6cbce527c4005cf08fd 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2022 */
+/* Copyright (c) The Exim Maintainers 2022 - 2023 */
 /* 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 */
index d39b4b5904e469c2985b0746d39b05835d8b2c85..a652dcd31cd611aac62379c0e9002cf84fa93e73 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
@@ -299,13 +299,23 @@ return string_from_gstring(g);
 
 
 
+/* Check a pointer for being past the end of a dns answer.
+Exactly one past the end is defined as ok.
+Return TRUE iff bad.
+*/
+static BOOL
+dnsa_bad_ptr(const dns_answer * dnsa, const uschar * ptr)
+{
+return ptr > dnsa->answer + dnsa->answerlen;
+}
+
 /* Increment the aptr in dnss, checking against dnsa length.
 Return: TRUE for a bad result
 */
 static BOOL
 dnss_inc_aptr(const dns_answer * dnsa, dns_scan * dnss, unsigned delta)
 {
-return (dnss->aptr += delta) >= dnsa->answer + dnsa->answerlen;
+return dnsa_bad_ptr(dnsa, dnss->aptr += delta);
 }
 
 /*************************************************
@@ -385,11 +395,15 @@ if (reset != RESET_NEXT)
       namelen = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen,
         dnss->aptr, (DN_EXPAND_ARG4_TYPE) &dnss->srr.name, DNS_MAXNAME);
       if (namelen < 0) goto null_return;
+
       /* skip name, type, class & TTL */
       TRACE trace = "A-hdr";
       if (dnss_inc_aptr(dnsa, dnss, namelen+8)) goto null_return;
+
+      if (dnsa_bad_ptr(dnsa, dnss->aptr + sizeof(uint16_t))) goto null_return;
       GETSHORT(dnss->srr.size, dnss->aptr); /* size of data portion */
-      /* skip over it */
+
+      /* skip over it, checking for a bogus size */
       TRACE trace = "A-skip";
       if (dnss_inc_aptr(dnsa, dnss, dnss->srr.size)) goto null_return;
       }
@@ -422,17 +436,22 @@ from the following bytes. */
 TRACE trace = "R-name";
 if (dnss_inc_aptr(dnsa, dnss, namelen)) goto null_return;
 
-GETSHORT(dnss->srr.type, dnss->aptr);          /* Record type */
+/* Check space for type, class, TTL & data-size-word */
+if (dnsa_bad_ptr(dnsa, dnss->aptr + 3 * sizeof(uint16_t) + sizeof(uint32_t)))
+  goto null_return;
+
+GETSHORT(dnss->srr.type, dnss->aptr);                  /* Record type */
+
 TRACE trace = "R-class";
-if (dnss_inc_aptr(dnsa, dnss, 2)) goto null_return;    /* Don't want class */
-GETLONG(dnss->srr.ttl, dnss->aptr);            /* TTL */
-GETSHORT(dnss->srr.size, dnss->aptr);          /* Size of data portion */
-dnss->srr.data = dnss->aptr;                   /* The record's data follows */
+(void) dnss_inc_aptr(dnsa, dnss, sizeof(uint16_t));    /* skip class */
 
-/* Unchecked increment ok here since no further access on this iteration;
-will be checked on next at "R-name". */
+GETLONG(dnss->srr.ttl, dnss->aptr);                    /* TTL */
+GETSHORT(dnss->srr.size, dnss->aptr);                  /* Size of data portion */
+dnss->srr.data = dnss->aptr;                           /* The record's data follows */
 
-dnss->aptr += dnss->srr.size;                  /* Advance to next RR */
+/* skip over it, checking for a bogus size */
+if (dnss_inc_aptr(dnsa, dnss, dnss->srr.size))
+  goto null_return;
 
 /* Return a pointer to the dns_record structure within the dns_answer. This is
 for convenience so that the scans can use nice-looking for loops. */
@@ -744,17 +763,17 @@ if (fake_dnsa_len_for_fail(dnsa, type))
     /* Skip the mname & rname strings */
 
     if ((len = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen,
-       p, (DN_EXPAND_ARG4_TYPE)discard_buf, 256)) < 0)
+       p, (DN_EXPAND_ARG4_TYPE)discard_buf, sizeof(discard_buf))) < 0)
       break;
     p += len;
     if ((len = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen,
-       p, (DN_EXPAND_ARG4_TYPE)discard_buf, 256)) < 0)
+       p, (DN_EXPAND_ARG4_TYPE)discard_buf, sizeof(discard_buf))) < 0)
       break;
     p += len;
 
     /* Skip the SOA serial, refresh, retry & expire.  Grab the TTL */
 
-    if (p > dnsa->answer + dnsa->answerlen - 5 * INT32SZ)
+    if (dnsa_bad_ptr(dnsa, p + 5 * INT32SZ))
       break;
     p += 4 * INT32SZ;
     GETLONG(ttl, p);
@@ -1258,6 +1277,7 @@ switch (type)
        const uschar * p = rr->data;
 
        /* Extract the numerical SRV fields (p is incremented) */
+       if (rr_bad_size(rr, 3 * sizeof(uint16_t))) continue;
        GETSHORT(priority, p);
        GETSHORT(dummy_weight, p);
        GETSHORT(port, p);
index cf7c4e0b1b98602d319452decec6ef683113298d..1e3269f4a2628214bf3307da8ff16d72cd46d3ee 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index b05b1aefd7091a7f1333485f95a4b6b17fbc8b02..d96a4e1ddc217fe6e542000c0c3d8ef311af9681 100644 (file)
@@ -2,9 +2,10 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) Heiko Schlittermann 2016
+/*
+ * Copyright (c) The Exim Maintainers 2022 - 2023
+ * Copyright (c) Heiko Schlittermann 2016
  * hs@schlittermann.de
- * Copyright (c) The Exim Maintainers 2022
  * See the file NOTICE for conditions of use and distribution.
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
index ce43b80b0d733a2e965872572d6acb693192ac2b..e807099c1470e200f78f8f16189ccf14bd64b9c4 100644 (file)
@@ -1,7 +1,9 @@
 #! /bin/sh
 
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) University of Cambridge, 1995 - 2015
 # See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 # This script takes the following command line arguments:
 # -l dir       Log file directory
index 9eb9c454a2ae1bab00484a04bf8648c04f05917a..a425ad03bdd982624b52c0989eb94d0288f314c7 100644 (file)
@@ -1,5 +1,10 @@
 #! PERL_COMMAND
 
+# Copyright (c) The Exim Maintainers 2020 - 2023
+# Copyright (c) 2007-2017 University of Cambridge.
+# See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
 use warnings;
 use strict;
 BEGIN { pop @INC if $INC[-1] eq '.' };
@@ -8,10 +13,6 @@ use Pod::Usage;
 use Getopt::Long qw(:config no_ignore_case);
 use File::Basename;
 
-# Copyright (c) 2007-2017 University of Cambridge.
-# Copyright (c) The Exim Maintainers 2020 - 2021
-# See the file NOTICE for conditions of use and distribution.
-
 # Except when they appear in comments, the following placeholders in this
 # source are replaced when it is turned into a runnable script:
 #
index e200fc062641647366e5ec9c960accd1b2e68550..118fe5c7cede206c07ace57a57fe715e70b03ebb 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 159d9a47281f6ebd437d72f0f8bc4ba0297565fa..9615443db65274c12082b5ecb9754f40593eaffd 100755 (executable)
@@ -1,7 +1,9 @@
 #! /bin/sh
 
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) University of Cambridge, 1995 - 2007
 # See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 # Except when they appear in comments, the following placeholders in this
 # source are replaced when it is turned into a runnable script:
index 43628234dd7436877281628e216d97b855633945..9f5f2f042bc77b4e15aa9b13cdbaf477de25ccf0 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index b2f5f6028ab42a52654a2b2276fc4f106020d279..3f70c2fd51023c1c561c8ee5efc9ec137e63426b 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index d68aa392bd72e3d84ff44b75a175fff23dc78783..4efee04f8b22636659d20d3f6090377f53da1432 100755 (executable)
@@ -1,13 +1,13 @@
 #!PERL_COMMAND -T
 #
+# Copyright (c) The Exim Maintainers 2023
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
 # Utility to convert an exim message-id to a human readable form
 #
 # https://bugs.exim.org/show_bug.cgi?id=2956
 # Written by Andrew C Aitchison
 #
-# Copyright (c) 2023 The Exim Maintainers 2023
-# SPDX-License-Identifier: GPL-2.0-or-later
-#
 # Portions taken from exicyclog.src, which is
 #   Copyright (c) University of Cambridge, 1995 - 2015
 #   See the file NOTICE for conditions of use and distribution.
index 77bd88050816957592786d303c106a574c09a152..88d7948d774e915af94012e1620b6ae49d88f197 100644 (file)
@@ -4,8 +4,10 @@
 # The build process concatenates on the front of this various settings from
 # os-specific files and from the user's configuration file.
 
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) 2004 - 2015 University of Cambridge.
 # See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 # Except when they appear in comments, the following placeholders in this
 # source are replaced when it is turned into a runnable script:
index b961df8e1781e4043c4998c81c4abba1b93ee28c..232b3d13533b6d2549aca3daa121afbd4abdacc6 100644 (file)
@@ -1,7 +1,9 @@
 #!PERL_COMMAND
 
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) 2001-2017 University of Cambridge.
 # See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 # Perl script to generate statistics from one or more Exim log files.
 
index 30e08a5e2d7cd40b6ef14fc6933f77494d2b6600..1a1d88f6b77da757bb764ba152e1e63e6bca12ec 100644 (file)
@@ -1,5 +1,6 @@
 #! /bin/sh
 
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) University of Cambridge, 1995 - 2007
 # See the file NOTICE for conditions of use and distribution.
 
index c3830f4a53f6debcae7b1504b5e394388b1bc97e..991128c1db768d705fb14341a6cf42bd097872ed 100644 (file)
@@ -1,4 +1,6 @@
 #!PERL_COMMAND
+
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) 1995 - 2018 University of Cambridge.
 # SPDX-License-Identifier: GPL-2.0-or-later
 # See the file NOTICE for conditions of use and distribution.
@@ -434,10 +436,10 @@ sub get_all_msgs {
     if ($e =~ /^[a-zA-Z0-9]$/) {
       opendir(DD, "$d/$e") || next;
       foreach my $f (grep !/^\./, readdir(DD)) {
-        push(@m, { message => $1, path => "$d/$e" }) if ($f =~ /^(.{16})-H$/);
+        push(@m, { message => $1, path => "$d/$e" }) if ($f =~ /^(.{23}|.{16})-H$/);
       }
       closedir(DD);
-    } elsif ($e =~ /^(.{16})-H$/) {
+    } elsif ($e =~ /^(.{23}|.{16})-H$/) {
       push(@m, { message => $1, path => $d });
     }
   }
index 812f0b149e7dc0beda1ce04b780c15ff9b4dd8a6..425e789ad18be3ef6e13269e757f69b659ffbbd6 100644 (file)
@@ -1,7 +1,9 @@
 #! /bin/sh
 
+# Copyright (c) The Exim Maintainers 2023
 # Copyright (c) University of Cambridge, 1995 - 2007
 # See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 # Except when they appear in comments, the following placeholders in this
 # source are replaced when it is turned into a runnable script:
index bcfa60fb660e1246c048bd808a7bc13fa4f33b8e..40cc8d73a2afb4f1d37b72635e1844a2d846168f 100644 (file)
@@ -2763,9 +2763,17 @@ switch(cond_type = identify_operator(&s, &opname))
     case ECOND_ISIP:
     case ECOND_ISIP4:
     case ECOND_ISIP6:
-    rc = string_is_ip_address(sub[0], NULL);
-    *yield = ((cond_type == ECOND_ISIP)? (rc != 0) :
-             (cond_type == ECOND_ISIP4)? (rc == 4) : (rc == 6)) == testfor;
+    {
+      const uschar *errp;
+      const uschar **errpp;
+      DEBUG(D_expand) errpp = &errp; else errpp = 0;
+      if (0 == (rc = string_is_ip_addressX(sub[0], NULL, errpp)))
+        DEBUG(D_expand) debug_printf("failed: %s\n", errp);
+
+      *yield = ( cond_type == ECOND_ISIP  ? rc != 0 :
+                 cond_type == ECOND_ISIP4 ? rc == 4 : rc == 6) == testfor;
+    }
+
     break;
 
     /* Various authentication tests - all optionally compiled */
@@ -6564,6 +6572,7 @@ while (*s)
        goto EXPAND_FAILED_CURLY;                                       /*}*/
        }
 
+      DEBUG(D_expand) debug_printf_indent("%s: evaluate input list list\n", name);
       if (!(list = expand_string_internal(s,
              ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | flags, &s, &resetok, NULL)))
        goto EXPAND_FAILED;                                             /*{{*/
@@ -6583,6 +6592,7 @@ while (*s)
          expand_string_message = US"missing '{' for second arg of reduce";
          goto EXPAND_FAILED_CURLY;                                     /*}*/
          }
+       DEBUG(D_expand) debug_printf_indent("reduce: initial result list\n");
         t = expand_string_internal(s,
              ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | flags, &s, &resetok, NULL);
         if (!t) goto EXPAND_FAILED;
@@ -6610,6 +6620,7 @@ while (*s)
       condition for real. For EITEM_MAP and EITEM_REDUCE, do the same, using
       the normal internal expansion function. */
 
+      DEBUG(D_expand) debug_printf_indent("%s: find end of conditionn\n", name);
       if (item_type != EITEM_FILTER)
         temp = expand_string_internal(s,
          ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | ESI_SKIPPING, &s, &resetok, NULL);
index 7f02327e33c20ca071759ff091a4ecbe003aa222..b56b593b85656cf8df721772a961198f71bf3acd 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 4222c623a3f77e537fd21f2e2141390ec87780eb..39119ca093801e0957aad3b3d59c18b716251d25 100644 (file)
@@ -576,6 +576,7 @@ extern uschar *string_dequote(const uschar **);
 extern uschar *string_format_size(int, uschar *);
 extern int     string_interpret_escape(const uschar **);
 extern int     string_is_ip_address(const uschar *, int *);
+extern int     string_is_ip_addressX(const uschar *, int *, const uschar **);
 #ifdef SUPPORT_I18N
 extern BOOL    string_is_utf8(const uschar *);
 #endif
@@ -1109,6 +1110,22 @@ store_free_dns_answer_trc(dns_answer * dnsa, const uschar * func, unsigned line)
 store_free_3(dnsa, CCS func, line);
 }
 
+
+/* Check for an RR being large enough.  Return TRUE iff bad. */
+static inline BOOL
+rr_bad_size(const dns_record * rr, size_t minbytes)
+{
+return rr->size < minbytes;
+}
+
+/* Check for an RR having further data beyond a given pointer.
+Return TRUE iff bad. */
+static inline BOOL
+rr_bad_increment(const dns_record * rr, const uschar * ptr, size_t minbytes)
+{
+return rr_bad_size(rr, ptr - rr->data + minbytes);
+}
+
 /******************************************************************************/
 /* Routines with knowledge of spool layout */
 
index f945379a082ac9fb0ac46099c468d6ffde13cfbe..e94bef75ca182e51c506e2eeb17db96e0bf8de63 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index ff82bef6db0dce04932afd6210e3c21b68fe4994..6ec4e619de0700eb9bf43b6c7aeaa9ea76c1a0ae 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 95860fc505cf0a5bd1660ab6969bbcdfcb1ac856..17a52fe43effc6b5976546410d5d19e968c48fa7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Exim - an Internet mail transport agent
  *
- *  Copyright (c) The Exim Maintainers 2010 - 2022
+ *  Copyright (c) The Exim Maintainers 2010 - 2023
  *  Copyright (c) University of Cambridge 1995 - 2009
  *  SPDX-License-Identifier: GPL-2.0-or-later
  *
index 3e5a886603390c80e881071f4692af577f20dadd..08e946548c10d1f00161f8a79c16f4965441bb60 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
@@ -2725,6 +2725,7 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS);
   const uschar * s = rr->data; /* MUST be unsigned for GETSHORT */
   uschar data[256];
 
+  if (rr_bad_size(rr, sizeof(uint16_t))) continue;
   GETSHORT(precedence, s);      /* Pointer s is advanced */
 
   /* For MX records, we use a random "weight" which causes multiple records of
@@ -2737,6 +2738,8 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS);
     /* SRV records are specified with a port and a weight. The weight is used
     in a special algorithm. However, to start with, we just use it to order the
     records of equal priority (precedence). */
+
+    if (rr_bad_increment(rr, s, 2 * sizeof(uint16_t))) continue;
     GETSHORT(weight, s);
     GETSHORT(port, s);
     }
index 6c9b5c17926d65768c2e39f282228206f2ee7df4..9d7665971134cfa6f575f7c871ce0a835f090373 100644 (file)
@@ -1,3 +1,4 @@
+/* Copyright (c) The Exim Maintainers 2023 */
 /* 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 */
index 6ff8fe6261976fa343ad4884a3460841bdc057d7..d5343e005003aa7c403f4b06ab26d293f41cfacc 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index c276b882da5165060e56a1d1598ec03c30212812..153b4cb3cdd662ffc3bfde023c185152c93ebe5e 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index fac577d5a6ba57a13839d67e4a280a6088585f10..af6e8b01b4f25b4de046e0922a3c58a3203edd94 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 2e87edadd5bf61605311972f9147f2271264195f..614b349ec73794ed6ed5f7c186e35270936eb56f 100644 (file)
@@ -75,7 +75,7 @@ The arguments are:
   uschar **errmsg     where to put an error message if there is a problem
 
 The yield of xxx_open() is a void * value representing the open file or
-database. For real files is is normally the FILE or DBM value. For other
+database. For real files it is normally the FILE or DBM value. For other
 kinds of lookup, if there is no natural value to use, (-1) is recommended.
 The value should not be NULL (or 0) as that is taken to indicate failure of
 the xxx_open() function. For single-key lookups, the handle is cached along
index 1563eda56d0a73b2172f8a4d8cd6b22ccdb845ee..ff51dec23d59cd88a09b6537f628310683fd8011 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
@@ -394,38 +394,55 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
       if (type == T_TXT || type == T_SPF)
         {
         if (!outsep2)                  /* output only the first item of data */
-          yield = string_catn(yield, US (rr->data+1), (rr->data)[0]);
+         {
+         uschar n = (rr->data)[0];
+         /* size byte + data bytes must not excced the RRs length */
+         if (n + 1 <= rr->size)
+           yield = string_catn(yield, US (rr->data+1), n);
+         }
         else
           for (unsigned data_offset = 0; data_offset < rr->size; )
             {
             uschar chunk_len = (rr->data)[data_offset];
+           int remain = rr->size - data_offset;
+
+           /* Apparently there are resolvers that do not check RRs before passing
+           them on, and glibc fails to do so.  So every application must...
+           Check for chunk len exceeding RR */
+
+           if (chunk_len > remain)
+             chunk_len = remain;
+
             if (*outsep2  && data_offset != 0)
               yield = string_catn(yield, outsep2, 1);
-            yield = string_catn(yield, US ((rr->data) + ++data_offset), chunk_len);
+            yield = string_catn(yield, US ((rr->data) + ++data_offset), --chunk_len);
             data_offset += chunk_len;
             }
         }
       else if (type == T_TLSA)
-        {
-        uint8_t usage, selector, matching_type;
-        uint16_t payload_length;
-        uschar s[MAX_TLSA_EXPANDED_SIZE];
-       uschar * sp = s;
-        uschar * p = US rr->data;
+       if (rr->size < 3)
+         continue;
+       else
+         {
+         uint8_t usage, selector, matching_type;
+         uint16_t payload_length;
+         uschar s[MAX_TLSA_EXPANDED_SIZE];
+         uschar * sp = s;
+         uschar * p = US rr->data;
+
+         usage = *p++;
+         selector = *p++;
+         matching_type = *p++;
+         /* What's left after removing the first 3 bytes above */
+         payload_length = rr->size - 3;
+         sp += sprintf(CS s, "%d%c%d%c%d%c", usage, *outsep2,
+                 selector, *outsep2, matching_type, *outsep2);
+         /* Now append the cert/identifier, one hex char at a time */
+         while (payload_length-- > 0 && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4))
+           sp += sprintf(CS sp, "%02x", *p++);
 
-        usage = *p++;
-        selector = *p++;
-        matching_type = *p++;
-        /* What's left after removing the first 3 bytes above */
-        payload_length = rr->size - 3;
-        sp += sprintf(CS s, "%d%c%d%c%d%c", usage, *outsep2,
-               selector, *outsep2, matching_type, *outsep2);
-        /* Now append the cert/identifier, one hex char at a time */
-       while (payload_length-- > 0 && sp-s < (MAX_TLSA_EXPANDED_SIZE - 4))
-          sp += sprintf(CS sp, "%02x", *p++);
-
-        yield = string_cat(yield, s);
-        }
+         yield = string_cat(yield, s);
+         }
       else   /* T_CNAME, T_CSA, T_MX, T_MXH, T_NS, T_PTR, T_SOA, T_SRV */
         {
         int priority, weight, port;
@@ -435,17 +452,20 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
        switch (type)
          {
          case T_MXH:
+           if (rr_bad_size(rr, sizeof(u_int16_t))) continue;
            /* mxh ignores the priority number and includes only the hostnames */
            GETSHORT(priority, p);
            break;
 
          case T_MX:
+           if (rr_bad_size(rr, sizeof(u_int16_t))) continue;
            GETSHORT(priority, p);
            sprintf(CS s, "%d%c", priority, *outsep2);
            yield = string_cat(yield, s);
            break;
 
          case T_SRV:
+           if (rr_bad_size(rr, 3*sizeof(u_int16_t))) continue;
            GETSHORT(priority, p);
            GETSHORT(weight, p);
            GETSHORT(port, p);
@@ -455,6 +475,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
            break;
 
          case T_CSA:
+           if (rr_bad_size(rr, 3*sizeof(u_int16_t))) continue;
            /* See acl_verify_csa() for more comments about CSA. */
            GETSHORT(priority, p);
            GETSHORT(weight, p);
@@ -505,7 +526,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
 
        if (type == T_SOA && outsep2 != NULL)
          {
-         unsigned long serial, refresh, retry, expire, minimum;
+         unsigned long serial = 0, refresh = 0, retry = 0, expire = 0, minimum = 0;
 
          p += rc;
          yield = string_catn(yield, outsep2, 1);
@@ -521,8 +542,11 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
          else yield = string_cat(yield, s);
 
          p += rc;
-         GETLONG(serial, p); GETLONG(refresh, p);
-         GETLONG(retry,  p); GETLONG(expire,  p); GETLONG(minimum, p);
+         if (!rr_bad_increment(rr, p, 5 * sizeof(u_int32_t)))
+           {
+           GETLONG(serial, p); GETLONG(refresh, p);
+           GETLONG(retry,  p); GETLONG(expire,  p); GETLONG(minimum, p);
+           }
          sprintf(CS s, "%c%lu%c%lu%c%lu%c%lu%c%lu",
            *outsep2, serial, *outsep2, refresh,
            *outsep2, retry,  *outsep2, expire,  *outsep2, minimum);
index 82d6954ff09592620bc2443f72a0046e308996e0..b93782cc3c163bb4be476468a1cb65d58aababa2 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index c4c05e44def10e5cd4d8f391be512247faaf5cf4..5d6bc4bb7e24b4fe9f1f2ceaff60ee72a2617ec2 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2009 */
-/* Copyright (c) The Exim Maintainers 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index fcbd36952704d0860a0a819ef0b44f00d078cd7f..33e8c51571ffb14983da1000e6a9e8a4c8dd4672 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 5d52f28b1cc59a22ec2a2cebee6fe6ecc9fdc281..144663f39f758d98851cc102b3f5d21c68fed38a 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 73cc02813f1686b4ab73e47fe3147991e633633a..dca4a40b9ab3db5a8eb4ec9f971dbd4a181a0ebd 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2021 - 2022 */
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* Copyright (c) Jeremy Harris 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index 55df5775e391a17e948a4ecce1bac3872b7b15cf..77baa69a0e9568db4a17ac793ec26e2aa41b9a0c 100644 (file)
@@ -2,6 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index 1cf1a474225f516f37d4aacb231f1bfc694a06da..bdc5875020d615b503244d006920b9958a4912ac 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) Jeremy Harris 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index 94f68dfa3db4946fbb4d4c4afa7987f77e9aa531..4f105c6d6cbf00fba9db48a0ba0d7c49fe31b42e 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* Copyright (c) Jeremy Harris 2017 - 2018 */
-/* Copyright (c) The Exim Maintainers 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index 250858ab4e9c97f94154d3357a076ebf2eddd915..9693935614c26b59be6b791dc94b4f00690f8bd7 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index f36c46b0f545e684f6fcb01a20ee478de9b472ab..9455d4769586735d9c430145a3869210ef632e14 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /*
- * Copyright (c) The Exim Maintainers 2015 - 2022
+ * Copyright (c) The Exim Maintainers 2015 - 2023
  * Copyright (c) Tom Kistner <tom@duncanthrax.net> 2003 - 2015
  * License: GPL
  * SPDX-License-Identifier: GPL-2.0-or-later
index 07070362df3199f2956aceee614810c33b3bc831..df440108e01085c45d558e431d894418518b6846 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 7d30b546233918e894158ad08b22c214f0c07518..975ddca857b24256be218e5497e08ef0819b1013 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /*
- * Copyright (c) The Exim Maintainers 2015 - 2022
+ * Copyright (c) The Exim Maintainers 2015 - 2023
  * Copyright (c) Tom Kistner <tom@duncanthrax.net> 2004 - 2015
  * License: GPL
  * SPDX-License-Identifier: GPL-2.0-or-later
index 9c30c8edd0546738c216354dc857792dcc87796f..25595816c78628c446b82f581b0b426d7b4780a9 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 954f683c828bf0dbd7ac58f200eec2c618026b4a..c39083be8a4133785cb64ab10c1ef4b1f746e528 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 87a33693576904d9e7b523667600975108a3bbb7..5c52c6d4d44d509a4f223069f36d100506f2c36d 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2021 - 2022 */
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* 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 */
index ead8751ae3998c1ebfc7f7bad26a91230de943e9..29f98e1e2098267f1d02b0cf9ba60f388c76ed65 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 22b8502429a886cdaacc8eb8b26543975faf5176..c723ae6c876817b322f89b83c35d77d35cad919b 100644 (file)
@@ -1,9 +1,9 @@
 /*
  *  PDKIM - a RFC4871 (DKIM) implementation
  *
- *  Copyright (c) The Exim Maintainers 2021 - 2022
- *  Copyright (C) 2009 - 2016  Tom Kistner <tom@duncanthrax.net>
+ *  Copyright (c) The Exim Maintainers 2021 - 2023
  *  Copyright (C) 2016 - 2020  Jeremy Harris <jgh@exim.org>
+ *  Copyright (C) 2009 - 2016  Tom Kistner <tom@duncanthrax.net>
  *  SPDX-License-Identifier: GPL-2.0-or-later
  *
  *  http://duncanthrax.net/pdkim/
index 35ca79fc199b889426755d374905cc341305bf87..e72d4b53edefd8f10f098b3d452db6e36b303a55 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PDKIM - a RFC4871 (DKIM) implementation
- *  Copyright (c) The Exim Maintainers 1995 - 2022
+ *  Copyright (c) The Exim Maintainers 1995 - 2023
  *  SPDX-License-Identifier: GPL-2.0-or-later
  *
  *  signing/verification interface
index 9305f8b459ad1f066cd2fecf73ff39dc32e09791..66bd046af9b6e1cf8ce3594d75ad25f676076529 100644 (file)
@@ -1,4 +1,8 @@
-/* Copyright (c)  The Exim Maintainers 2022 */
+/*************************************************
+*     Exim - an Internet mail transport agent    *
+*************************************************/
+
+/* Copyright (c)  The Exim Maintainers 2022 - 2023 */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "exim.h"
index d6d6f53a52aa39a03f0209193f720fa410ea3466..e77458d683a9da89a48e2405a6d2e7546d70ae62 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index dbb43e7497e763d5497e60d1034db42390e2035d..8190c594130ab36f6735961fd119c8149648400f 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 757243e7f19207b07bb446ea67ff6c6f1c8a6fae..af425db2dea74825a069a7ccadeff5c94ca5a531 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /*
- * Copyright (c) The Exim Maintainers 2016 - 2022
+ * Copyright (c) The Exim Maintainers 2016 - 2023
  * Copyright (c) Tom Kistner <tom@duncanthrax.net> 2003-2015
  * License: GPL
  * SPDX-License-Identifier: GPL-2.0-or-later
index 91ca8ca0201bc51816cad886ee4abb50cb376893..3f02802d6461163b2048c7f6ba82bd2e27326489 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /*
- * Copyright (c) The Exim Maintainers 2022
+ * Copyright (c) The Exim Maintainers 2022 - 2023
  * License: GPL
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
index 1897c782f210d2d6697b1d07c4b8548ba2a08f59..42393d424b8987f35dca76736df8104fa3f8a547 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index c6a7b9fa579ffda5975094e0c6c278244484ec91..ec5c2cffc1a8779cc178629fd9157a3bc373a7ff 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2021 - 2022 */
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* 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 */
index 9d7a6e02324f039e81aec2355b988b373b97f553..18263f9ab69631588d31043921f01c905f5f555e 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 7faaea0cd06cddd71fabf9f79a8d7b3552763011..a6dc0fc87fac0649d55d11db78121711ae81c134 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index ae33682e2c6935250e14c15a7746e7024375d8ea..2a6a73eb66fbc0a8cff4aa14b67b3b236c20d233 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index e5da4cb91bba9e3b531c10c1aad5dafecb92ea72..d6542583e1c6a1af1806fb3db81f2ce1a29576ac 100644 (file)
@@ -2,6 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2009 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index b00bc9ab0eb5f502057e149ac057d2054e6b8100..52dcab2b77e46f3158e67b2b6482d33642ced7ff 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index dc90109361fd537e5df88fa00bc24245c8322bc5..798dac82748a9bcb4842548501868667a8af0e73 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /*
- * Copyright (c) The Exim Maintainers 2016 - 2022
+ * Copyright (c) The Exim Maintainers 2016 - 2023
  * Copyright (c) Michael Haardt 2003 - 2015
  * See the file NOTICE for conditions of use and distribution.
  * SPDX-License-Identifier: GPL-2.0-or-later
index ffc7779f80694c18ef71e2677e7dcef149126c22..c565d522d9a27779a85ae73695ee3937fc2b1d2d 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 7f477ed76504d870234e10f743abc200dd2fe78d..90a0eb23e9b9340559f248d750b8ca35d5a3bd44 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 3d83f07ba43a6d43482ce83203f4a9eaf991c0ec..e720517086a494cf4b8ccc1b6ed8f807081e05b9 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* SPF support.
-   Copyright (c) The Exim Maintainers 2015 - 2022
+   Copyright (c) The Exim Maintainers 2015 - 2023
    Copyright (c) Tom Kistner <tom@duncanthrax.net> 2004 - 2014
    License: GPL
    SPDX-License-Identifier: GPL-2.0-or-later
@@ -71,7 +71,6 @@ SPF_dns_rr_t srr = {
   .hook = NULL,                                /* misc information */
   .source = spf_dns_server
 };
-int dns_rc;
 
 DEBUG(D_receive) debug_printf("SPF_dns_exim_lookup '%s'\n", domain);
 
@@ -87,20 +86,22 @@ if (rr_type == T_SPF)
   return spfrr;
   }
 
-switch (dns_rc = dns_lookup(dnsa, US domain, rr_type, NULL))
+switch (dns_lookup(dnsa, US domain, rr_type, NULL))
   {
-  case DNS_SUCCEED:    srr.herrno = NETDB_SUCCESS;     break;
   case DNS_AGAIN:      srr.herrno = TRY_AGAIN;         break;
   case DNS_NOMATCH:    srr.herrno = HOST_NOT_FOUND;    break;
   case DNS_NODATA:     srr.herrno = NO_DATA;           break;
   case DNS_FAIL:
   default:             srr.herrno = NO_RECOVERY;       break;
+  case DNS_SUCCEED:
+    srr.herrno = NETDB_SUCCESS;
+    for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
+        rr = dns_next_rr(dnsa, &dnss, RESET_NEXT))
+      /* Need to alloc space for all records, so no early-out */
+      if (rr->type == rr_type) found++;
+    break;
   }
 
-for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
-     rr = dns_next_rr(dnsa, &dnss, RESET_NEXT))
-  if (rr->type == rr_type) found++;
-
 if (found == 0)
   {
   SPF_dns_rr_dup(&spfrr, &srr);
@@ -121,6 +122,7 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
     switch(rr_type)
       {
       case T_MX:
+       if (rr->size < 2) continue;
        s += 2; /* skip the MX precedence field */
       case T_PTR:
        {
@@ -136,6 +138,7 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
        gstring * g = NULL;
        uschar chunk_len;
 
+       if (rr->size < 1+6) continue;           /* min for version str */
        if (strncmpic(rr->data+1, US SPF_VER_STR, 6) != 0)
          {
          HDEBUG(D_host_lookup) debug_printf("not an spf record: %.*s\n",
@@ -143,9 +146,12 @@ for (dns_record * rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS); rr;
          continue;
          }
 
-       for (int off = 0; off < rr->size; off += chunk_len)
+       /* require 1 byte for the chunk_len */
+       for (int off = 0; off < rr->size - 1; off += chunk_len)
          {
-         if (!(chunk_len = s[off++])) break;
+         if (  !(chunk_len = s[off++])
+            || rr->size < off + chunk_len      /* ignore bogus size chunks */
+            ) break;
          g = string_catn(g, s+off, chunk_len);
          }
        if (!g)
index 1fcff954f76c53c23288b9e6fb9b8460e7310c9c..737a01cddd346194dab548ebcf6151b8b5b753cd 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 0a2a1d27d1eb79b187f9cebf1dfecbef3adaa556..fbd01c30e85f8abb91a5cf7bec610b077aede32a 100644 (file)
@@ -2,9 +2,10 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) Tom Kistner <tom@duncanthrax.net> 2003 - 2015
+/*
+ * Copyright (c) The Exim Maintainers 2016 - 2023
+ * Copyright (c) Tom Kistner <tom@duncanthrax.net> 2003 - 2015
  * License: GPL
- * Copyright (c) The Exim Maintainers 2016 - 2021
  * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
index e0650bb3687548fcca05842f7f707511b934374b..9c5a683e3cee118bb28a3284506d5e4d83df9b85 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 9e4536eaedf56b741ac5619a1cd8742a54924a18..684f83cf0c27557937aa058e1060211616b0bbeb 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim maintainers 2019 - 2022 */
+/* Copyright (c) The Exim maintainers 2019 - 2023 */
 /* 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 */
index 52b1d2fb5895ccda12006d34d0b38d71049bbd34..dfe0f24519f20d7cacf84971285e8c9d06c09e29 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
@@ -30,123 +30,139 @@ Arguments:
   maskptr   NULL if no mask is permitted to follow
             otherwise, points to an int where the offset of '/' is placed
             if there is no / followed by trailing digits, *maskptr is set 0
+  errp      NULL if no diagnostic information is required, and if the netmask
+            length should not be checked. Otherwise it is set pointing to a short
+            descriptive text.
 
 Returns:    0 if the string is not a textual representation of an IP address
             4 if it is an IPv4 address
             6 if it is an IPv6 address
+
+The legacy string_is_ip_address() function follows below.
 */
 
 int
-string_is_ip_address(const uschar *s, int *maskptr)
+string_is_ip_addressX(const uschar * ip_addr, int * maskptr, const uschar ** errp)
 {
-int yield = 4;
+uschar * slash, * percent, * endp = NULL;
+long int mask = 0;
+const uschar * addr = NULL;
+int af;
+union { /* we do not need this, but inet_pton() needs a place for storage */
+  struct in_addr sa4;
+  struct in6_addr sa6;
+} sa;
+
+/* If there is a slash, but we didn't request a (optional) netmask,
+we return failure, as we do if the mask isn't a pure numerical value,
+or if it is negative. The actual length is checked later, once we know
+the address family. */
+if (slash = Ustrchr(ip_addr, '/'))
+  {
+  uschar * rest;
 
-/* If an optional mask is permitted, check for it. If found, pass back the
-offset. */
+  if (!maskptr)
+    {
+    if (errp) *errp = US"netmask found, but not requested";
+    return 0;
+    }
 
-if (maskptr)
-  {
-  const uschar *ss = s + Ustrlen(s);
-  *maskptr = 0;
-  if (s != ss && isdigit(*(--ss)))
+  mask = Ustrtol(slash+1, &rest, 10);
+  if (*rest || mask < 0)
     {
-    while (ss > s && isdigit(ss[-1])) ss--;
-    if (ss > s && *(--ss) == '/') *maskptr = ss - s;
+    if (errp) *errp = US"netmask not numeric or <0";
+    return 0;
     }
+
+  *maskptr = slash - ip_addr;     /* offset of the slash */
+  endp = slash;
   }
+else if (maskptr) *maskptr = 0; /* no slash found */
 
-/* A colon anywhere in the string => IPv6 address */
+/* The interface-ID suffix (%<id>) is optional (for IPv6). If it
+exists, we check it syntactically. Later, if we know the address
+family is IPv4, we might reject it.
+The interface-ID is mutually exclusive with the netmask, to the
+best of my knowledge. */
 
-if (Ustrchr(s, ':') != NULL)
+if (percent = Ustrchr(ip_addr, '%'))
   {
-  BOOL had_double_colon = FALSE;
-  BOOL v4end = FALSE;
-
-  yield = 6;
-
-  /* An IPv6 address must start with hex digit or double colon. A single
-  colon is invalid. */
-
-  if (*s == ':' && *(++s) != ':') return 0;
-
-  /* Now read up to 8 components consisting of up to 4 hex digits each. There
-  may be one and only one appearance of double colon, which implies any number
-  of binary zero bits. The number of preceding components is held in count. */
-
-  for (int count = 0; count < 8; count++)
+  if (slash)
     {
-    /* If the end of the string is reached before reading 8 components, the
-    address is valid provided a double colon has been read. This also applies
-    if we hit the / that introduces a mask or the % that introduces the
-    interface specifier (scope id) of a link-local address. */
-
-    if (*s == 0 || *s == '%' || *s == '/') return had_double_colon ? yield : 0;
-
-    /* If a component starts with an additional colon, we have hit a double
-    colon. This is permitted to appear once only, and counts as at least
-    one component. The final component may be of this form. */
-
-    if (*s == ':')
-      {
-      if (had_double_colon) return 0;
-      had_double_colon = TRUE;
-      s++;
-      continue;
-      }
-
-    /* If the remainder of the string contains a dot but no colons, we
-    can expect a trailing IPv4 address. This is valid if either there has
-    been no double-colon and this is the 7th component (with the IPv4 address
-    being the 7th & 8th components), OR if there has been a double-colon
-    and fewer than 6 components. */
-
-    if (Ustrchr(s, ':') == NULL && Ustrchr(s, '.') != NULL)
+    if (errp) *errp = US"interface-ID and netmask are mutually exclusive";
+    return 0;
+    }
+  for (uschar *p = percent+1; *p; p++)
+    if (!isalnum(*p) && !ispunct(*p))
       {
-      if ((!had_double_colon && count != 6) ||
-          (had_double_colon && count > 6)) return 0;
-      v4end = TRUE;
-      yield = 6;
-      break;
+      if (errp) *errp = US"interface-ID must match [[:alnum:][:punct:]]";
+      return 0;
       }
+  endp = percent;
+  }
 
-    /* Check for at least one and not more than 4 hex digits for this
-    component. */
-
-    if (!isxdigit(*s++)) return 0;
-    if (isxdigit(*s) && isxdigit(*(++s)) && isxdigit(*(++s))) s++;
-
-    /* If the component is terminated by colon and there is more to
-    follow, skip over the colon. If there is no more to follow the address is
-    invalid. */
+/* inet_pton() can't parse netmasks and interface IDs, so work on a shortened copy
+allocated on the current stack */
 
-    if (*s == ':' && *(++s) == 0) return 0;
+if (endp)
+  {
+  ptrdiff_t l = endp - ip_addr;
+  if (l > 255)
+    {
+    if (errp) *errp = US"rudiculous long ip address string";
+    return 0;
     }
+  addr = string_copyn(ip_addr, l);
+  }
+else
+  addr = ip_addr;
 
-  /* If about to handle a trailing IPv4 address, drop through. Otherwise
-  all is well if we are at the end of the string or at the mask or at a percent
-  sign, which introduces the interface specifier (scope id) of a link local
-  address. */
-
-  if (!v4end)
-    return (*s == 0 || *s == '%' ||
-           (*s == '/' && maskptr != NULL && *maskptr != 0))? yield : 0;
+af = Ustrchr(addr, ':') ? AF_INET6 : AF_INET;
+if (!inet_pton(af, CCS addr, &sa))
+  {
+  if (errp) *errp = af == AF_INET6 ? US"IP address string not parsable as IPv6"
+                                  : US"IP address string not parsable IPv4";
+  return 0;
   }
 
-/* Test for IPv4 address, which may be the tail-end of an IPv6 address. */
+/* we do not check the values of the mask here, as
+this is done on the callers side (but I don't understand why), so
+actually I'd like to do it here, but it breaks at least testcase 0002 */
 
-for (int i = 0; i < 4; i++)
+switch (af)
   {
-  long n;
-  uschar * end;
-
-  if (i != 0 && *s++ != '.') return 0;
-  n = strtol(CCS s, CSS &end, 10);
-  if (n > 255 || n < 0 || end <= s || end > s+3) return 0;
-  s = end;
+  case AF_INET6:
+      if (errp && mask > 128)
+       {
+       *errp = US"IPv6 netmask value must not be >128";
+       return 0;
+       }
+      return 6;
+  case AF_INET:
+      if (percent)
+       {
+       if (errp) *errp = US"IPv4 address string must not have an interface-ID";
+       return 0;
+       }
+      if (errp && mask > 32)
+       {
+       *errp = US"IPv4 netmask value must not be >32";
+       return 0;
+       }
+      return 4;
+  default:
+      if (errp) *errp = US"unknown address family (should not happen)";
+      return 0;
   }
+}
+
 
-return !*s || (*s == '/' && maskptr && *maskptr != 0) ? yield : 0;
+int
+string_is_ip_address(const uschar * ip_addr, int * maskptr)
+{
+return string_is_ip_addressX(ip_addr, maskptr, 0);
 }
+
 #endif  /* COMPILE_UTILITY */
 
 
index 9d2a76ef2985ea3d684ca271fbf40ee6d119a56f..214819482ff8fc99e96f1281d4a33b8a0f1c494e 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index afb59c33f6f5e53853b1f00c7a7f780a0710eabc..a17597e8bf3a68ab8eed83754bd364f0104f7fc9 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* Copyright (c) Phil Pennock 2012 */
 /* See the file NOTICE for conditions of use and distribution. */
index a5e782ef73d5296eddf4634416844a2823fedeec..ef11de593590b313eb581537693b64650085feff 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2019 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
@@ -1438,7 +1438,7 @@ SNI handling.
 
 Separately we might try to replace using OCSP_basic_verify() - which seems to not
 be a public interface into the OpenSSL library (there's no manual entry) -
-(in 3.0.0 + is is public)
+(in 3.0.0 + it is public)
 But what with?  We also use OCSP_basic_verify in the client stapling callback.
 And there we NEED it; we must verify that status... unless the
 library does it for us anyway?  */
index 8f4344c6c56b4ca45bb2624853d023e0e132cee1..b6c5d70e123009e08e0abdac05556b98fb30cb82 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 32177ea815e4e70c98d6d8db58937d04264e2d4f..343f3d3fc5944ba7374d4a8fd73d4d4489d9079d 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2022 */
+/* Copyright (c) The Exim Maintainers 2022 - 2023 */
 /* Copyright (c) Jeremy Harris 2014 - 2019 */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index ba86d8f46b6d27b6266df067b8023d9963135a11..1343f89d43c10b34173bdc13dd0dc6e1797aa861 100644 (file)
@@ -1,5 +1,10 @@
 #! PERL_COMMAND
 
+# Copyright (c) The Exim Maintainers 2023
+# See the file NOTICE for conditions of use and distribution.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+
 # This is a Perl script to demonstrate the possibilities of on-the-fly
 # delivery filtering in Exim. It is presented with a message on its standard
 # input, and must copy it to the standard output, transforming it as it
index 1e8bb4aa70b5d5377d3f4a1bd5e3941c94928c7c..b3b05c0a3053f771cf31c462aa925739e9fe5e06 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index e49f46be4bc2c8269451519e93788994d8784044..2c7bea11d1213197997b1ba7e67cbb65f6b99101 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim maintainers 2020 - 2022 */
+/* Copyright (c) The Exim maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index 2dd0f328b3afe731c22c0297f40d38e28ad54cd3..f3f9088363141d18142b546776a863a4834a272a 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index 18f9fd84e852b2dc839c38a6ff67c484ac05e6a2..b9cc32df1abce9ad31191fba594d811c1d3b63b0 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim maintainers 2020 - 2022 */
+/* Copyright (c) The Exim maintainers 2020 - 2023 */
 /* 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 */
index df94eebde581f3526b6fb4379d18115020ec4df1..af2e1f2dd4679716a1b0ddd150fb56d8f219ff01 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* 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 */
index df932b13eefe4204d50680edca4dad7f0bea6c69..21d7273a2c9b27ca7dc708038b79376c2ad1b787 100644 (file)
@@ -2,8 +2,8 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
index 13fc28cc2414df21d1f1c80128b5c14b08641433..eb54829db58ada1b0ad095a6384b5990d7973840 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2021 - 2022 */
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
@@ -48,7 +48,7 @@ if (!tree_insertnode(&tree_nonrecipients, node)) store_reset(rpoint);
 
 Argument:
   s       string to add
-  addr    the address is is a duplicate of
+  addr    the address it is a duplicate of
 
 Returns:  nothing
 */
index c420fcac1ded07c28337c83d4f515f45264e7938..d8ebf5925f28254f1b30be68ff68e9cd0c708317 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2023 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
index ef202985abefd5d212cec6b1633b7ed0eeb6f912..24f80d3a42f708a57921dd020d73034d2f97ef5d 100755 (executable)
@@ -18,7 +18,6 @@
 #use strict;
 use v5.10.1;
 use warnings;
-use if $^V >= v5.19.11, experimental => 'smartmatch';
 
 use Errno;
 use FileHandle;
@@ -3400,6 +3399,7 @@ GetOptions(
 print "Exim binary is `$parm_exim'\n" if defined $parm_exim;
 
 
+my %wanted;
 my @wanted = sort numerically uniq
   @tests_wanted ? @tests_wanted : (),
   @range_wanted ? $range_wanted[0] .. $range_wanted[1] : (),
@@ -3408,6 +3408,7 @@ my @wanted = sort numerically uniq
           0+$ARGV[0]..0+$ARGV[1]    # add 0 to cope with test numbers starting with zero
         : ();
 @wanted = 1..TEST_TOP if not @wanted;
+map { $wanted{sprintf("%04d",$_)}= $_; } @wanted;
 
 ##################################################
 #        Check for sudo access to root           #
@@ -4220,7 +4221,8 @@ DIR: for (my $i = 0; $i < @test_dirs; $i++)
   # We want the tests from this subdirectory, provided they are in the
   # range that was selected.
 
-  @testlist = grep { $_ ~~ @wanted } grep { /^\d+(?:\.\d+)?$/ } map { basename $_ } glob "scripts/$testdir/*";
+  undef @testlist;
+  map { push @testlist, $_ if exists $wanted{$_} } grep { /^\d+(?:\.\d+)?$/ } map { basename $_ } glob "scripts/$testdir/*";
 
   tests_exit(-1, "Failed to read test scripts from `scripts/$testdir/*': $!")
     if not @testlist;
index b4f2341bb5e21283a10acf092b3da98dca40d9ea..c1fa1bdb514a48ad185d3485edae79f03bb6a8a3 100644 (file)
@@ -458,6 +458,7 @@ ge:     ${if ge{ABC}{abc}{y}{n}}
 gei:    ${if gei{ABC}{abc}{y}{n}}
 
 isip:   ${if isip {1.2.3.4}{y}{n}}  1.2.3.4
+isip:   ${if isip {1.2.3}{y}{n}}  1.2.3
 isip4:  ${if isip4{1.2.3.4}{y}{n}}  1.2.3.4
 isip6:  ${if isip6{1.2.3.4}{y}{n}}  1.2.3.4
 isip:   ${if isip {::1.2.3.256}{y}{n}}  ::1.2.3.256
@@ -475,6 +476,9 @@ isip:   ${if isip {fe80::1.2.3.4}{y}{n}}  fe80::1.2.3.4
 isip:   ${if isip {rhubarb}{y}{n}}  rhubarb
 isip4:  ${if isip4{rhubarb}{y}{n}}  rhubarb
 isip6:  ${if isip6{rhubarb}{y}{n}}  rhubarb
+isip6:  ${if isip6{::/100}{y}{n}}  ::/100
+isip6:  ${if isip6{::/foo}{y}{n}}  ::/foo
+isip6:  ${if isip6{::/f o}{y}{n}}  ::/f o
 
 match:  ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
 match:  ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
index 2d7c828381f81a7c86380e6890989430c6fe51ae..d5bb0605c5fac58628816137f1b82047fb21a368 100644 (file)
@@ -452,6 +452,7 @@ newline     tab\134backslash ~tilde\177DEL\200\201.
 > gei:    y
 > 
 > isip:   y  1.2.3.4
+> isip:   n  1.2.3
 > isip4:  y  1.2.3.4
 > isip6:  n  1.2.3.4
 > isip:   n  ::1.2.3.256
@@ -469,6 +470,9 @@ newline     tab\134backslash ~tilde\177DEL\200\201.
 > isip:   n  rhubarb
 > isip4:  n  rhubarb
 > isip6:  n  rhubarb
+> isip6:  n  ::/100
+> isip6:  n  ::/foo
+> isip6:  n  ::/f o
 > 
 > match:  cdab
 > match:  cdab