From 3d123ac94a9005e87403c83b1f169b595547ece2 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Thu, 22 Apr 2021 00:00:00 -0500 Subject: [PATCH] postfix-3.6-20210422 --- postfix/HISTORY | 16 +++ postfix/README_FILES/DB_README | 3 + postfix/README_FILES/LDAP_README | 3 + postfix/README_FILES/LMDB_README | 3 + postfix/README_FILES/MYSQL_README | 3 + postfix/README_FILES/PGSQL_README | 3 + postfix/README_FILES/SASL_README | 4 + postfix/README_FILES/SQLITE_README | 3 + postfix/README_FILES/TLS_README | 4 + postfix/RELEASE_NOTES | 8 +- postfix/WISHLIST | 2 + postfix/conf/master.cf | 4 + postfix/html/DB_README.html | 4 + postfix/html/LDAP_README.html | 4 + postfix/html/LMDB_README.html | 4 + postfix/html/MYSQL_README.html | 4 + postfix/html/PGSQL_README.html | 4 + postfix/html/SASL_README.html | 4 + postfix/html/SQLITE_README.html | 4 + postfix/html/TLS_README.html | 4 + postfix/proto/DB_README.html | 4 + postfix/proto/LDAP_README.html | 4 + postfix/proto/LMDB_README.html | 4 + postfix/proto/MYSQL_README.html | 4 + postfix/proto/PGSQL_README.html | 4 + postfix/proto/SASL_README.html | 4 + postfix/proto/SQLITE_README.html | 4 + postfix/proto/TLS_README.html | 4 + postfix/src/global/config_known_tcp_ports.c | 9 +- postfix/src/global/config_known_tcp_ports.ref | 3 +- postfix/src/global/mail_version.h | 2 +- postfix/src/util/Makefile.in | 16 ++- postfix/src/util/argv.h | 4 + postfix/src/util/argv_split_at.c | 124 ++++++++++++++++++ 34 files changed, 269 insertions(+), 9 deletions(-) create mode 100644 postfix/src/util/argv_split_at.c diff --git a/postfix/HISTORY b/postfix/HISTORY index 581235eac..803e2851b 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -25531,3 +25531,19 @@ Apologies for any names omitted. Bugfix (bug introduced 20210102): panic in some postconf commands due to duplicate initialization of compatibility level comparison operators. File: global/compat_level.c. + + Cleanup: stricter parsing of known_tcp_port settings. Files: + util/argv_split_at.c, util/argv.h, global/config_known_tcp_ports.c. + +20210420 + + Documentation: typofixes by Paul Menzel. File: RELEASE_NOTES. + + Documentation: numeric IP address examples. File: conf/master.cf. + + Documentation: added "-Wl,-R,/path/to/directory" hints to + optional build instructions. Files: proto/DB_README.html, + proto/LDAP_README.html, proto/LMDB_README.html, + proto/MYSQL_README.html, proto/PGSQL_README.html, + proto/SASL_README.html, proto/SQLITE_README.html, + proto/TLS_README.html. diff --git a/postfix/README_FILES/DB_README b/postfix/README_FILES/DB_README index 869218e4e..2d0ac9347 100644 --- a/postfix/README_FILES/DB_README +++ b/postfix/README_FILES/DB_README @@ -65,6 +65,9 @@ something like: AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb" % make +If your Berkeley DB shared library is in a directory that the RUN-TIME linker +does not know about, add a "-Wl,-R,/path/to/directory" option after "-ldb". + Solaris needs this: % make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \ diff --git a/postfix/README_FILES/LDAP_README b/postfix/README_FILES/LDAP_README index 672335636..a6cb84e5e 100644 --- a/postfix/README_FILES/LDAP_README +++ b/postfix/README_FILES/LDAP_README @@ -54,6 +54,9 @@ this in the top level of your Postfix source tree should work: % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \ AUXLIBS_LDAP="-L/usr/local/lib -lldap -L/usr/local/lib -llber" +If your LDAP shared library is in a directory that the RUN-TIME linker does not +know about, add a "-Wl,-R,/path/to/directory" option after "-lldap". + Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LDAP. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically- loaded LDAP database client, but only the new AUXLIBS_LDAP variable supports diff --git a/postfix/README_FILES/LMDB_README b/postfix/README_FILES/LMDB_README index e63640f51..193880b51 100644 --- a/postfix/README_FILES/LMDB_README +++ b/postfix/README_FILES/LMDB_README @@ -31,6 +31,9 @@ support, use something like: AUXLIBS_LMDB="-L/usr/local/lib -llmdb" % make +If your LMDB shared library is in a directory that the RUN-TIME linker does not +know about, add a "-Wl,-R,/path/to/directory" option after "-llmdb". + Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LMDB. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically- loaded LMDB database client, but only the new AUXLIBS_LMDB variable supports diff --git a/postfix/README_FILES/MYSQL_README b/postfix/README_FILES/MYSQL_README index b8304c221..c6633a918 100644 --- a/postfix/README_FILES/MYSQL_README +++ b/postfix/README_FILES/MYSQL_README @@ -39,6 +39,9 @@ mysqlclient library (and libm) to AUXLIBS_MYSQL, for example: 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \ 'AUXLIBS_MYSQL=-L/usr/local/mysql/lib -lmysqlclient -lz -lm' +If your MySQL shared library is in a directory that the RUN-TIME linker does +not know about, add a "-Wl,-R,/path/to/directory" option after "-lmysqlclient". + Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_MYSQL. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically- loaded MySQL database client, but only the new AUXLIBS_MYSQL variable supports diff --git a/postfix/README_FILES/PGSQL_README b/postfix/README_FILES/PGSQL_README index 7f6323a54..ae9c3bff5 100644 --- a/postfix/README_FILES/PGSQL_README +++ b/postfix/README_FILES/PGSQL_README @@ -36,6 +36,9 @@ For example: 'CCARGS=-DHAS_PGSQL -I/usr/local/include/pgsql' \ 'AUXLIBS_PGSQL=-L/usr/local/lib -lpq' +If your PostgreSQL shared library is in a directory that the RUN-TIME linker +does not know about, add a "-Wl,-R,/path/to/directory" option after "-lpq". + Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_PGSQL. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically- loaded PostgreSQL database client, but only the new AUXLIBS_PGSQL variable diff --git a/postfix/README_FILES/SASL_README b/postfix/README_FILES/SASL_README index d9561d7f3..c0e42ad67 100644 --- a/postfix/README_FILES/SASL_README +++ b/postfix/README_FILES/SASL_README @@ -1344,6 +1344,10 @@ Cyrus SASL version 2.1.x % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==""--DDUUSSEE__SSAASSLL__AAUUTTHH --DDUUSSEE__CCYYRRUUSS__SSAASSLL \\ --II//uussrr//llooccaall//iinncclluuddee//ssaassll"" AAUUXXLLIIBBSS==""--LL//uussrr//llooccaall//lliibb --llssaassll22"" + If your Cyrus SASL shared library is in a directory that the RUN-TIME + linker does not know about, add a "-Wl,-R,/path/to/directory" option after + "-lsasl2". + Cyrus SASL version 1.5.x % mmaakkee ttiiddyy # if you have left-over files from a previous build diff --git a/postfix/README_FILES/SQLITE_README b/postfix/README_FILES/SQLITE_README index 324b30588..3fb9757c5 100644 --- a/postfix/README_FILES/SQLITE_README +++ b/postfix/README_FILES/SQLITE_README @@ -26,6 +26,9 @@ For example: 'CCARGS=-DHAS_SQLITE -I/usr/local/include' \ 'AUXLIBS_SQLITE=-L/usr/local/lib -lsqlite3 -lpthread' +If your SQLite shared library is in a directory that the RUN-TIME linker does +not know about, add a "-Wl,-R,/path/to/directory" option after "-lsqlite3". + Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_SQLITE. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically- loaded SQLite database client, but only the new AUXLIBS_SQLITE variable diff --git a/postfix/README_FILES/TLS_README b/postfix/README_FILES/TLS_README index 2926079c6..315d9fbf6 100644 --- a/postfix/README_FILES/TLS_README +++ b/postfix/README_FILES/TLS_README @@ -2440,6 +2440,10 @@ aapppprroopprriiaattee.. % mmaakkee mmaakkeeffiilleess CCCCAARRGGSS==""--DDUUSSEE__TTLLSS --II//uussrr//llooccaall//iinncclluuddee"" \\ AAUUXXLLIIBBSS==""--LL//uussrr//llooccaall//lliibb --llssssll --llccrryyppttoo"" + If your OpenSSL shared library is in a directory that the RUN-TIME linker + does not know about, add a "-Wl,-R,/path/to/directory" option after "- + lcrypto". + On Solaris, specify the -R option as shown below: % mmaakkee ttiiddyy # if you have left-over files from a previous build diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 4f09c16e2..d96997d68 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -30,7 +30,7 @@ Major changes with snapshot 20210220 Postfix version 3.6 deprecates terminology that implies white is better than black. Instead, Postfix prefers 'allowlist', 'denylist', -and variations on those words. +and variations on those words. Set "respectful_logging = no" in main.cf to keep using the old behavior (parameter names and logging). @@ -89,7 +89,7 @@ no" permanent in main.cf, for example: To stop the reminder, configure the respectful_logging parameter to "yes" or "no", or configure "compatibility_level = 3.6". -Major changes with snapshot 20220109 +Major changes with snapshot 20210109 ==================================== Starting with Postfix version 3.6, the "latest" compatibility level @@ -218,7 +218,7 @@ Incompatible change with snapshot 20200705 ========================================== The minimum OpenSSL version is 1.1.1, which will reach the end -of life by 20203-09-11. +of life by 2023-09-11. The default digest has changed from md5 to sha256 (Postfix 3.6 with compatibility_level >= 3). With a lower compatibility_level setting, @@ -232,7 +232,7 @@ Incompatible change with snapshot 20200531 ========================================== Postfix delivery agents now log an explicit record when delegating -delivery to a different Postfix delivery agent. +delivery to a different Postfix delivery agent. For example, with "best_mx_transport = local", an SMTP delivery agent will now log when a recipient will be delivered locally. This diff --git a/postfix/WISHLIST b/postfix/WISHLIST index 757bb9802..30b15c962 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -1,5 +1,7 @@ Wish list: + Add verp=+= to the qmgr "from=" logging. + Make smtpd_relay_before_recipient_restrictions settable in smtpd_checks tests. diff --git a/postfix/conf/master.cf b/postfix/conf/master.cf index 30c3458e6..68543440f 100644 --- a/postfix/conf/master.cf +++ b/postfix/conf/master.cf @@ -14,6 +14,8 @@ smtp inet n - n - - smtpd #smtpd pass - - n - - smtpd #dnsblog unix - - n - 0 dnsblog #tlsproxy unix - - n - 0 tlsproxy +# Choose one: enable submission for loopback clients only, or for any client. +#127.0.0.1:submission inet n - n - - smtpd #submission inet n - n - - smtpd # -o syslog_name=postfix/submission # -o smtpd_tls_security_level=encrypt @@ -26,6 +28,8 @@ smtp inet n - n - - smtpd # -o smtpd_recipient_restrictions= # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING +# Choose one: enable smtps for loopback clients only, or for any client. +#127.0.0.1:smtps inet n - n - - smtpd #smtps inet n - n - - smtpd # -o syslog_name=postfix/smtps # -o smtpd_tls_wrappermode=yes diff --git a/postfix/html/DB_README.html b/postfix/html/DB_README.html index f1ba9d30b..6cfd24f94 100644 --- a/postfix/html/DB_README.html +++ b/postfix/html/DB_README.html @@ -100,6 +100,10 @@ source code, use something like:

+

If your Berkeley DB shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-ldb".

+

Solaris needs this:

diff --git a/postfix/html/LDAP_README.html b/postfix/html/LDAP_README.html index e2f1bd23f..fae15b914 100644 --- a/postfix/html/LDAP_README.html +++ b/postfix/html/LDAP_README.html @@ -96,6 +96,10 @@ your Postfix source tree should work:

+

If your LDAP shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lldap".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LDAP. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded LDAP database client, but only the new diff --git a/postfix/html/LMDB_README.html b/postfix/html/LMDB_README.html index 3ac031cc5..caf554304 100644 --- a/postfix/html/LMDB_README.html +++ b/postfix/html/LMDB_README.html @@ -55,6 +55,10 @@ build Postfix with LMDB support, use something like:

+

If your LMDB shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-llmdb".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LMDB. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded LMDB database client, but only the new diff --git a/postfix/html/MYSQL_README.html b/postfix/html/MYSQL_README.html index 48622cfd3..8ac3826e4 100644 --- a/postfix/html/MYSQL_README.html +++ b/postfix/html/MYSQL_README.html @@ -62,6 +62,10 @@ make -f Makefile.init makefiles \ +

If your MySQL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lmysqlclient".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_MYSQL. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded MySQL database client, but only the new diff --git a/postfix/html/PGSQL_README.html b/postfix/html/PGSQL_README.html index cb9c8a5cc..98741395a 100644 --- a/postfix/html/PGSQL_README.html +++ b/postfix/html/PGSQL_README.html @@ -57,6 +57,10 @@ the location of the libpq library file.

+

If your PostgreSQL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lpq".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_PGSQL. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded PostgreSQL database client, but only diff --git a/postfix/html/SASL_README.html b/postfix/html/SASL_README.html index 1f4bfdf4a..8fe305110 100644 --- a/postfix/html/SASL_README.html +++ b/postfix/html/SASL_README.html @@ -2127,6 +2127,10 @@ definitions:

-I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2" +

If your Cyrus SASL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lsasl2".

+
Cyrus SASL version 1.5.x
diff --git a/postfix/html/SQLITE_README.html b/postfix/html/SQLITE_README.html index fe721358c..f850d50a7 100644 --- a/postfix/html/SQLITE_README.html +++ b/postfix/html/SQLITE_README.html @@ -48,6 +48,10 @@ make -f Makefile.init makefiles \ +

If your SQLite shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lsqlite3".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_SQLITE. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded SQLite database client, but only the new diff --git a/postfix/html/TLS_README.html b/postfix/html/TLS_README.html index 4c8762f80..248b5e2e4 100644 --- a/postfix/html/TLS_README.html +++ b/postfix/html/TLS_README.html @@ -3182,6 +3182,10 @@ are in directory /usr/local/lib:

+

If your OpenSSL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lcrypto".

+

On Solaris, specify the -R option as shown below:

diff --git a/postfix/proto/DB_README.html b/postfix/proto/DB_README.html index 79c04a5e2..cca3e2b62 100644 --- a/postfix/proto/DB_README.html +++ b/postfix/proto/DB_README.html @@ -100,6 +100,10 @@ source code, use something like:

+

If your Berkeley DB shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-ldb".

+

Solaris needs this:

diff --git a/postfix/proto/LDAP_README.html b/postfix/proto/LDAP_README.html index 5dc205bd8..a105ff6d5 100644 --- a/postfix/proto/LDAP_README.html +++ b/postfix/proto/LDAP_README.html @@ -96,6 +96,10 @@ your Postfix source tree should work:

+

If your LDAP shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lldap".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LDAP. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded LDAP database client, but only the new diff --git a/postfix/proto/LMDB_README.html b/postfix/proto/LMDB_README.html index 726e415f7..a9794cca6 100644 --- a/postfix/proto/LMDB_README.html +++ b/postfix/proto/LMDB_README.html @@ -55,6 +55,10 @@ build Postfix with LMDB support, use something like:

+

If your LMDB shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-llmdb".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LMDB. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded LMDB database client, but only the new diff --git a/postfix/proto/MYSQL_README.html b/postfix/proto/MYSQL_README.html index 0a1221e50..fc7bdc997 100644 --- a/postfix/proto/MYSQL_README.html +++ b/postfix/proto/MYSQL_README.html @@ -62,6 +62,10 @@ make -f Makefile.init makefiles \ +

If your MySQL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lmysqlclient".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_MYSQL. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded MySQL database client, but only the new diff --git a/postfix/proto/PGSQL_README.html b/postfix/proto/PGSQL_README.html index 7658a9b5c..61445ba4e 100644 --- a/postfix/proto/PGSQL_README.html +++ b/postfix/proto/PGSQL_README.html @@ -57,6 +57,10 @@ the location of the libpq library file.

+

If your PostgreSQL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lpq".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_PGSQL. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded PostgreSQL database client, but only diff --git a/postfix/proto/SASL_README.html b/postfix/proto/SASL_README.html index 404c2c978..89a9162a6 100644 --- a/postfix/proto/SASL_README.html +++ b/postfix/proto/SASL_README.html @@ -2127,6 +2127,10 @@ definitions:

-I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2" +

If your Cyrus SASL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lsasl2".

+
Cyrus SASL version 1.5.x
diff --git a/postfix/proto/SQLITE_README.html b/postfix/proto/SQLITE_README.html index 3c21579af..97f14d8e2 100644 --- a/postfix/proto/SQLITE_README.html +++ b/postfix/proto/SQLITE_README.html @@ -48,6 +48,10 @@ make -f Makefile.init makefiles \ +

If your SQLite shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lsqlite3".

+

Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_SQLITE. With Postfix 3.0 and later, the old AUXLIBS variable still supports building a statically-loaded SQLite database client, but only the new diff --git a/postfix/proto/TLS_README.html b/postfix/proto/TLS_README.html index e86caad20..a58595768 100644 --- a/postfix/proto/TLS_README.html +++ b/postfix/proto/TLS_README.html @@ -3182,6 +3182,10 @@ are in directory /usr/local/lib:

+

If your OpenSSL shared library is in a directory that the RUN-TIME +linker does not know about, add a "-Wl,-R,/path/to/directory" option after +"-lcrypto".

+

On Solaris, specify the -R option as shown below:

diff --git a/postfix/src/global/config_known_tcp_ports.c b/postfix/src/global/config_known_tcp_ports.c index 070a5e8ea..84f66e810 100644 --- a/postfix/src/global/config_known_tcp_ports.c +++ b/postfix/src/global/config_known_tcp_ports.c @@ -77,7 +77,7 @@ void config_known_tcp_ports(const char *source, const char *settings) for (cpp = associations->argv; *cpp != 0; cpp++) { char *temp = concatenate(" ", *cpp, " ", (char *) 0); - association = argv_split(temp, "="); + association = argv_split_at(temp, '='); myfree(temp); if (association->argc == 0) { @@ -156,6 +156,13 @@ static struct test_case test_cases[] = { /* warning */ "", /* export */ "lmtp=24 smtp=25 smtps=465 submissions=465" }, + {"equal-equal", + /* config */ "smtp = 25, smtps == submissions = 465, lmtp = 24", + /* warning */ "config_known_tcp_ports: warning: equal-equal: " + "in \" smtps == submissions = 465\": missing service name before " + "\"=\"\n", + /* export */ "lmtp=24 smtp=25 smtps=465 submissions=465" + }, {"port test 1", /* config */ "smtps = submission =", /* warning */ "config_known_tcp_ports: warning: port test 1: " diff --git a/postfix/src/global/config_known_tcp_ports.ref b/postfix/src/global/config_known_tcp_ports.ref index d2bc8339d..5a35677f0 100644 --- a/postfix/src/global/config_known_tcp_ports.ref +++ b/postfix/src/global/config_known_tcp_ports.ref @@ -1,7 +1,8 @@ config_known_tcp_ports: good: PASS +config_known_tcp_ports: equal-equal: PASS config_known_tcp_ports: port test 1: PASS config_known_tcp_ports: port test 2: PASS config_known_tcp_ports: port test 3: PASS config_known_tcp_ports: service name test 1: PASS config_known_tcp_ports: service name test 2: PASS -config_known_tcp_ports: PASS=6 FAIL=0 +config_known_tcp_ports: PASS=7 FAIL=0 diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index dbf6fa769..f5967bf12 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20210419" +#define MAIL_RELEASE_DATE "20210422" #define MAIL_VERSION_NUMBER "3.6" #ifdef SNAPSHOT diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in index c18796978..449eae460 100644 --- a/postfix/src/util/Makefile.in +++ b/postfix/src/util/Makefile.in @@ -42,7 +42,7 @@ SRCS = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \ extpar.c dict_inline.c casefold.c dict_utf8.c strcasecmp_utf8.c \ split_qnameval.c argv_attr_print.c argv_attr_scan.c dict_file.c \ msg_logger.c logwriter.c unix_dgram_connect.c unix_dgram_listen.c \ - byte_mask.c known_tcp_ports.c + byte_mask.c known_tcp_ports.c argv_split_at.c OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \ attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \ attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \ @@ -86,7 +86,7 @@ OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \ extpar.o dict_inline.o casefold.o dict_utf8.o strcasecmp_utf8.o \ split_qnameval.o argv_attr_print.o argv_attr_scan.o dict_file.o \ msg_logger.o logwriter.o unix_dgram_connect.o unix_dgram_listen.o \ - byte_mask.o known_tcp_ports.o + byte_mask.o known_tcp_ports.o argv_split_at.o # MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf. # When hard-linking these, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ), # otherwise it sets the PLUGIN_* macros. @@ -1049,6 +1049,16 @@ argv_split.o: stringops.h argv_split.o: sys_defs.h argv_split.o: vbuf.h argv_split.o: vstring.h +argv_split_at.o: argv.h +argv_split_at.o: argv_split_at.c +argv_split_at.o: check_arg.h +argv_split_at.o: msg.h +argv_split_at.o: mymalloc.h +argv_split_at.o: split_at.h +argv_split_at.o: stringops.h +argv_split_at.o: sys_defs.h +argv_split_at.o: vbuf.h +argv_split_at.o: vstring.h argv_splitq.o: argv.h argv_splitq.o: argv_splitq.c argv_splitq.o: check_arg.h @@ -1977,6 +1987,8 @@ load_file.o: vbuf.h load_file.o: vstream.h load_file.o: warn_stat.h load_lib.o: load_lib.c +load_lib.o: load_lib.h +load_lib.o: msg.h load_lib.o: sys_defs.h logwriter.o: check_arg.h logwriter.o: iostuff.h diff --git a/postfix/src/util/argv.h b/postfix/src/util/argv.h index f7ce69956..1e3b46705 100644 --- a/postfix/src/util/argv.h +++ b/postfix/src/util/argv.h @@ -39,6 +39,10 @@ extern ARGV *argv_splitq(const char *, const char *, const char *); extern ARGV *argv_splitq_count(const char *, const char *, const char *, ssize_t); extern ARGV *argv_splitq_append(ARGV *, const char *, const char *, const char *); +extern ARGV *argv_split_at(const char *, int); +extern ARGV *argv_split_at_count(const char *, int, ssize_t); +extern ARGV *argv_split_at_append(ARGV *, const char *, int); + #define ARGV_FAKE_BEGIN(fake_argv, arg) { \ ARGV fake_argv; \ char *__fake_argv_args__[2]; \ diff --git a/postfix/src/util/argv_split_at.c b/postfix/src/util/argv_split_at.c new file mode 100644 index 000000000..fcdb4ff27 --- /dev/null +++ b/postfix/src/util/argv_split_at.c @@ -0,0 +1,124 @@ +/*++ +/* NAME +/* argv_split_at 3 +/* SUMMARY +/* string array utilities +/* SYNOPSIS +/* #include +/* +/* ARGV *argv_split_at(string, sep) +/* const char *string; +/* int sep; +/* +/* ARGV *argv_split_at_count(string, sep, count) +/* const char *string; +/* int sep; +/* ssize_t count; +/* +/* ARGV *argv_split_at_append(argv, string, sep) +/* ARGV *argv; +/* const char *string; +/* int sep; +/* DESCRIPTION +/* argv_split_at() splits \fIstring\fR into fields using a +/* single separator specified in \fIsep\fR. The result is a +/* null-terminated string array. +/* +/* argv_split_at_count() is like argv_split_at() but stops +/* splitting input after at most \fIcount\fR -1 times and +/* leaves the remainder, if any, in the last array element. +/* It is an error to specify a count < 1. +/* +/* argv_split_at_append() performs the same operation as +/* argv_split_at(), but appends the result to an existing +/* string array. +/* SEE ALSO +/* split_at(), trivial string splitter. +/* DIAGNOSTICS +/* Fatal errors: memory allocation problem. +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Wietse Venema +/* IBM T.J. Watson Research +/* P.O. Box 704 +/* Yorktown Heights, NY 10598, USA +/* +/* Wietse Venema +/* Google, Inc. +/* 111 8th Avenue +/* New York, NY 10011, USA +/*--*/ + +/* System libraries. */ + +#include +#include + +/* Application-specific. */ + +#include +#include +#include +#include +#include + +/* argv_split_at - split string into field array */ + +ARGV *argv_split_at(const char *string, int sep) +{ + ARGV *argvp = argv_alloc(1); + char *saved_string = mystrdup(string); + char *bp = saved_string; + char *arg; + + while ((arg = split_at(bp, sep)) != 0) { + argv_add(argvp, bp, (char *) 0); + bp = arg; + } + argv_add(argvp, bp, (char *) 0); + argv_terminate(argvp); + myfree(saved_string); + return (argvp); +} + +/* argv_split_at_count - split string into field array */ + +ARGV *argv_split_at_count(const char *string, int sep, ssize_t count) +{ + ARGV *argvp = argv_alloc(1); + char *saved_string = mystrdup(string); + char *bp = saved_string; + char *arg; + + if (count < 1) + msg_panic("argv_split_at_count: bad count: %ld", (long) count); + while (count-- > 1 && (arg = split_at(bp, sep)) != 0) { + argv_add(argvp, bp, (char *) 0); + bp = arg; + } + argv_add(argvp, bp, (char *) 0); + argv_terminate(argvp); + myfree(saved_string); + return (argvp); +} + +/* argv_split_at_append - split string into field array, append to array */ + +ARGV *argv_split_at_append(ARGV *argvp, const char *string, int sep) +{ + char *saved_string = mystrdup(string); + char *bp = saved_string; + char *arg; + + while ((arg = split_at(bp, sep)) != 0) { + argv_add(argvp, bp, (char *) 0); + bp = arg; + } + argv_add(argvp, bp, (char *) 0); + argv_terminate(argvp); + myfree(saved_string); + return (argvp); +}