From: Wietse Z Venema Date: Thu, 16 Jul 2026 05:00:00 +0000 (-0500) Subject: postfix-3.12-20260716 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=989b7944bd490573ded8bb0e365ec4b4545c9852;p=thirdparty%2Fpostfix.git postfix-3.12-20260716 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 7318d3cfc..a044aa606 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -31724,6 +31724,28 @@ Apologies for any names omitted. added proper unit tests. Files: myflock.[hc], myflock_test.c, wrap_fcntl.[hc], mock_fcntl.[hc]. +20260716 + + Feature: support for the "tls_sni" attribute in the SMTP + server policy delegation protocol, and for the "{tls_sni}" + macro in the Milter protocol. This also corrects a MILTER_README + table with macro availability (TLS-related macros are not + available in the EOH and EOM Milter protocol stages). + Contributed by Steve Short (fortra.com). Files: + MILTER_README.html, SMTPD_POLICY_README.html, mail_proto.h, + milter.h, test-milter.c, smtpd_check.c, smtpd_milter.c. + + Cleanup: removed unused variables. Viktor Dukhovni. Files: + posttls-finger.c, tls_server.c. + + Typofixes. Files: proto/stop, nbbio.c, dict_nisplus.c. + + Feature: socketmap_max_query_size (default: 10000) limits + the length in bytes for a socketmap search key. A request + that exceeds the limit produces a warning and a 'not found' + result. Files: postlink, socketmap_table, dict_sockmap.[hc], + global/mail_params.[hc]. + TODO Reorganize PTEST_LIB, PMOCK_LIB, TESTLIB, TESTLIBS, etc. diff --git a/postfix/README_FILES/MILTER_README b/postfix/README_FILES/MILTER_README index aafc69396..b2ad8efe8 100644 --- a/postfix/README_FILES/MILTER_README +++ b/postfix/README_FILES/MILTER_README @@ -456,17 +456,15 @@ Sendmail. See the workarounds section below for solutions. | | |When address -> name | | | |lookup fails: "unknown" | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | - |{cert_issuer} |HELO, MAIL, DATA, EOH, |TLS client certificate | - | |EOM |issuer | + |{cert_issuer} |HELO, MAIL, DATA |TLS client certificate | + | | |issuer | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | - |{cert_subject} |HELO, MAIL, DATA, EOH, |TLS client certificate | - | |EOM |subject | + |{cert_subject} |HELO, MAIL, DATA |TLS client certificate | + | | |subject | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | - |{cipher_bits} |HELO, MAIL, DATA, EOH, |TLS session key size | - | |EOM | | + |{cipher_bits} |HELO, MAIL, DATA |TLS session key size | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | - |{cipher} |HELO, MAIL, DATA, EOH, |TLS cipher | - | |EOM | | + |{cipher} |HELO, MAIL, DATA |TLS cipher | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |{daemon_addr} |Always (Postfix >=3.2) |Local server IP address | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | @@ -497,8 +495,10 @@ Sendmail. See the workarounds section below for solutions. | |only with smtpd_milters) |With rejected recipient: | | | |"error" | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | - |{tls_version} |HELO, MAIL, DATA, EOH, |TLS protocol version | - | |EOM | | + |{tls_sni} |HELO, MAIL, DATA (Postfix|TLS server name indication| + | |>=3.12) | | + |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | + |{tls_version} |HELO, MAIL, DATA |TLS protocol version | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |v |Always |value of milter_macro_v | |_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | diff --git a/postfix/README_FILES/SMTPD_POLICY_README b/postfix/README_FILES/SMTPD_POLICY_README index 63f6cb74c..57c074a11 100644 --- a/postfix/README_FILES/SMTPD_POLICY_README +++ b/postfix/README_FILES/SMTPD_POLICY_README @@ -88,6 +88,8 @@ a delegated SMTPD access policy request: PPoossttffiixx vveerrssiioonn 33..88 aanndd llaatteerr:: compatibility_level=major.minor.patch mail_version=3.8.0 + PPoossttffiixx vveerrssiioonn 33..1122 aanndd llaatteerr:: + tls_sni=mail.example.com [empty line] Notes: @@ -158,6 +160,11 @@ Notes: about how the connection is encrypted. With plaintext connections the protocol and cipher attributes are empty and the keysize is zero. + * The "tls_sni" attribute (Postfix 3.12 and later) specifies the server name + indication that the remote SMTP client sent in the TLS handshake. This + attribute is empty for plaintext connections and when the remote SMTP + client sends no SNI. + * The "etrn_domain" attribute is defined only in the context of the ETRN command, and specifies the ETRN command parameter. diff --git a/postfix/html/MILTER_README.html b/postfix/html/MILTER_README.html index 841584026..4aa9cb31e 100644 --- a/postfix/html/MILTER_README.html +++ b/postfix/html/MILTER_README.html @@ -704,16 +704,16 @@ verification fails: "unknown" Client name from address → name lookup
When address → name lookup fails: "unknown" - {cert_issuer} HELO, MAIL, DATA, EOH, EOM + {cert_issuer} HELO, MAIL, DATA TLS client certificate issuer - {cert_subject} HELO, MAIL, DATA, EOH, EOM + {cert_subject} HELO, MAIL, DATA TLS client certificate subject - {cipher_bits} HELO, MAIL, DATA, EOH, EOM + {cipher_bits} HELO, MAIL, DATA TLS session key size - {cipher} HELO, MAIL, DATA, EOH, EOM TLS + {cipher} HELO, MAIL, DATA TLS cipher {daemon_addr} Always (Postfix ≥3.2) @@ -745,7 +745,10 @@ rejected recipient: enhanced status code smtpd_milters) Recipient mail delivery transport
With rejected recipient: "error" - {tls_version} HELO, MAIL, DATA, EOH, EOM + {tls_sni} HELO, MAIL, DATA (Postfix ≥3.12) + TLS server name indication + + {tls_version} HELO, MAIL, DATA TLS protocol version v Always value of milter_macro_v diff --git a/postfix/html/SMTPD_POLICY_README.html b/postfix/html/SMTPD_POLICY_README.html index 1202b1dec..39abee123 100644 --- a/postfix/html/SMTPD_POLICY_README.html +++ b/postfix/html/SMTPD_POLICY_README.html @@ -120,6 +120,8 @@ server_port=54321 Postfix version 3.8 and later: compatibility_level=major.minor.patch mail_version=3.8.0 +Postfix version 3.12 and later: +tls_sni=mail.example.com [empty line] @@ -206,6 +208,11 @@ server_port=54321 plaintext connections the protocol and cipher attributes are empty and the keysize is zero.

+
  • The "tls_sni" attribute (Postfix 3.12 and later) + specifies the server name indication that the remote SMTP client + sent in the TLS handshake. This attribute is empty for plaintext + connections and when the remote SMTP client sends no SNI.

    +
  • The "etrn_domain" attribute is defined only in the context of the ETRN command, and specifies the ETRN command parameter.

    diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index c71d03260..7fc52ce1c 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -21217,6 +21217,19 @@ built to support these protocols.

    This feature is available in Postfix 3.0 and later.

    + + +
    socketmap_max_query_size +(default: 10000)
    + +

    The maximum allowed query size for a socketmap client, not +including the socketmap and netstring encapsulation. A request that +exceeds the limit generates a warning and a 'not found' result. +

    + +

    This feature is available in Postfix ≥ 3.12.

    + +
    socketmap_max_reply_size diff --git a/postfix/html/socketmap_table.5.html b/postfix/html/socketmap_table.5.html index d38de3640..b4e431971 100644 --- a/postfix/html/socketmap_table.5.html +++ b/postfix/html/socketmap_table.5.html @@ -68,18 +68,23 @@ SOCKETMAP_TABLE(5) SOCKETMAP_TABLE(5) can be changed with the socketmap_max_reply_size configuration parame- ter (Postfix 3.10 and later). + The Postfix socketmap client requires that queries are no longer than + 10000 bytes (not including the netstring encapsulation). This limit can + be changed with the socketmap_max_query_size configuration parameter + (Postfix 3.12 and later). + The Postfix socketmap client enforces a 100s time limit to connect to a - socketmap server, to send a request, and to receive a reply. It closes - an idle connection after 10s, and closes an active connection after + socketmap server, to send a request, and to receive a reply. It closes + an idle connection after 10s, and closes an active connection after 100s. These limits are not (yet) configurable. SECURITY - This map cannot be used for security-sensitive information, because + This map cannot be used for security-sensitive information, because neither the connection nor the server are authenticated. CONFIGURATION PARAMETERS socketmap_max_reply_size (100000) - The maximum allowed reply size from a socketmap server, not + The maximum allowed reply size from a socketmap server, not including the netstring encapsulation. SEE ALSO diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index a5a7a28a4..6ccde017c 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -14931,6 +14931,12 @@ in RFC 6531, RFC 6532, and RFC 6533. This requires that Postfix is built to support these protocols. .PP This feature is available in Postfix 3.0 and later. +.SH socketmap_max_query_size (default: 10000) +The maximum allowed query size for a socketmap client, not +including the socketmap and netstring encapsulation. A request that +exceeds the limit generates a warning and a 'not found' result. +.PP +This feature is available in Postfix >= 3.12. .SH socketmap_max_reply_size (default: 100000) The maximum allowed reply size from a socketmap server, not including the netstring encapsulation. diff --git a/postfix/man/man5/socketmap_table.5 b/postfix/man/man5/socketmap_table.5 index 620d20f53..0e065b200 100644 --- a/postfix/man/man5/socketmap_table.5 +++ b/postfix/man/man5/socketmap_table.5 @@ -78,6 +78,11 @@ encapsulation). This limit can be changed with the socketmap_max_reply_size configuration parameter (Postfix 3.10 and later). +The Postfix socketmap client requires that queries are no longer +than 10000 bytes (not including the netstring encapsulation). This +limit can be changed with the socketmap_max_query_size +configuration parameter (Postfix 3.12 and later). + The Postfix socketmap client enforces a 100s time limit to connect to a socketmap server, to send a request, and to receive a reply. It closes an idle connection after 10s, and closes diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index 064684fa6..12979a79e 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -409,6 +409,7 @@ while (<>) { s;\bservice_name\b;$&;g; s;\bsocket[-]*\n* *[]*map_max_reply_size\b;$&;g; + s;\bsocket[-]*\n* *[]*map_max_query_size\b;$&;g; s;\bdefault_desti[-]*\n* *[]*na[-]*\n* *[]*tion_con[-]*\n* *[]*cur[-]*\n* *[]*rency_negative_feedback\b;$&;g; s;\bdefault_desti[-]*\n* *[]*na[-]*\n* *[]*tion_con[-]*\n* *[]*cur[-]*\n* *[]*rency_positive_feedback\b;$&;g; s;\bdefault_desti[-]*\n* *[]*na[-]*\n* *[]*tion_con[-]*\n* *[]*cur[-]*\n* *[]*rency_failed_cohort_limit\b;$&;g; diff --git a/postfix/proto/MILTER_README.html b/postfix/proto/MILTER_README.html index c8a557767..c9c139082 100644 --- a/postfix/proto/MILTER_README.html +++ b/postfix/proto/MILTER_README.html @@ -704,16 +704,16 @@ verification fails: "unknown" Client name from address → name lookup
    When address → name lookup fails: "unknown" - {cert_issuer} HELO, MAIL, DATA, EOH, EOM + {cert_issuer} HELO, MAIL, DATA TLS client certificate issuer - {cert_subject} HELO, MAIL, DATA, EOH, EOM + {cert_subject} HELO, MAIL, DATA TLS client certificate subject - {cipher_bits} HELO, MAIL, DATA, EOH, EOM + {cipher_bits} HELO, MAIL, DATA TLS session key size - {cipher} HELO, MAIL, DATA, EOH, EOM TLS + {cipher} HELO, MAIL, DATA TLS cipher {daemon_addr} Always (Postfix ≥3.2) @@ -745,7 +745,10 @@ rejected recipient: enhanced status code smtpd_milters) Recipient mail delivery transport
    With rejected recipient: "error" - {tls_version} HELO, MAIL, DATA, EOH, EOM + {tls_sni} HELO, MAIL, DATA (Postfix ≥3.12) + TLS server name indication + + {tls_version} HELO, MAIL, DATA TLS protocol version v Always value of milter_macro_v diff --git a/postfix/proto/SMTPD_POLICY_README.html b/postfix/proto/SMTPD_POLICY_README.html index fae35e141..fa0d39c9c 100644 --- a/postfix/proto/SMTPD_POLICY_README.html +++ b/postfix/proto/SMTPD_POLICY_README.html @@ -120,6 +120,8 @@ server_port=54321 Postfix version 3.8 and later: compatibility_level=major.minor.patch mail_version=3.8.0 +Postfix version 3.12 and later: +tls_sni=mail.example.com [empty line] @@ -206,6 +208,11 @@ mail_version=3.8.0 plaintext connections the protocol and cipher attributes are empty and the keysize is zero.

    +
  • The "tls_sni" attribute (Postfix 3.12 and later) + specifies the server name indication that the remote SMTP client + sent in the TLS handshake. This attribute is empty for plaintext + connections and when the remote SMTP client sends no SNI.

    +
  • The "etrn_domain" attribute is defined only in the context of the ETRN command, and specifies the ETRN command parameter.

    diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 7dfaf4845..bdb60a923 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -19947,6 +19947,15 @@ including the netstring encapsulation.

    This feature is available in Postfix ≥ 3.10.

    +%PARAM socketmap_max_query_size 10000 + +

    The maximum allowed query size for a socketmap client, not +including the socketmap and netstring encapsulation. A request that +exceeds the limit generates a warning and a 'not found' result. +

    + +

    This feature is available in Postfix ≥ 3.12.

    + %PARAM tls_required_enable yes

    Enable support for the "TLS-Required: no" message header, defined diff --git a/postfix/proto/socketmap_table b/postfix/proto/socketmap_table index b9e46b0c0..3cbc187a2 100644 --- a/postfix/proto/socketmap_table +++ b/postfix/proto/socketmap_table @@ -64,6 +64,11 @@ # socketmap_max_reply_size configuration parameter (Postfix 3.10 # and later). # +# The Postfix socketmap client requires that queries are no longer +# than 10000 bytes (not including the netstring encapsulation). This +# limit can be changed with the socketmap_max_query_size +# configuration parameter (Postfix 3.12 and later). +# # The Postfix socketmap client enforces a 100s time limit to # connect to a socketmap server, to send a request, and to receive # a reply. It closes an idle connection after 10s, and closes diff --git a/postfix/proto/stop b/postfix/proto/stop index 937f37ec6..510fdbe0c 100644 --- a/postfix/proto/stop +++ b/postfix/proto/stop @@ -1722,3 +1722,13 @@ tlstrace yyyymmddhhmmss ASAN TristanInSec +Mythos +Qualys +linkers +strncmp +DEV +jitter +msgfree +optimizers +resloop +tokenized diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index d7079dd2a..01c7bc345 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -368,6 +368,7 @@ bool var_verify_neg_cache; bool var_oldlog_compat; int var_delay_max_res; int var_sockmap_max_reply; +int var_sockmap_max_query; char *var_int_filt_classes; bool var_cyrus_sasl_authzid; @@ -903,6 +904,7 @@ void mail_params_init() VAR_DELAY_MAX_RES, DEF_DELAY_MAX_RES, &var_delay_max_res, MIN_DELAY_MAX_RES, MAX_DELAY_MAX_RES, VAR_INET_WINDOW, DEF_INET_WINDOW, &var_inet_windowsize, 0, 0, VAR_SOCKMAP_MAX_REPLY, DEF_SOCKMAP_MAX_REPLY, &var_sockmap_max_reply, 1, 0, + VAR_SOCKMAP_MAX_QUERY, DEF_SOCKMAP_MAX_QUERY, &var_sockmap_max_query, 1, 0, 0, }; static const CONFIG_LONG_TABLE long_defaults[] = { @@ -1057,6 +1059,7 @@ void mail_params_init() dict_db_cache_size = var_db_read_buf; dict_lmdb_map_size = var_lmdb_map_size; dict_sockmap_max_reply = var_sockmap_max_reply; + dict_sockmap_max_query = var_sockmap_max_query; inet_windowsize = var_inet_windowsize; if (set_logwriter_create_perms(var_maillog_file_perms) < 0) msg_warn("ignoring bad permissions: %s = %s", diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index ec934d4a1..f95d9b724 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -4634,6 +4634,10 @@ extern char *var_full_name_encoding_charset; #define DEF_SOCKMAP_MAX_REPLY 100000 /* reply size limit */ extern int var_sockmap_max_reply; +#define VAR_SOCKMAP_MAX_QUERY "socketmap_max_query_size" +#define DEF_SOCKMAP_MAX_QUERY 10000 /* query size limit */ +extern int var_sockmap_max_query; + /* * Client privacy. */ diff --git a/postfix/src/global/mail_proto.h b/postfix/src/global/mail_proto.h index 4c3f33966..447853dc7 100644 --- a/postfix/src/global/mail_proto.h +++ b/postfix/src/global/mail_proto.h @@ -207,6 +207,7 @@ extern char *mail_pathname(const char *, const char *); #define MAIL_ATTR_CRYPTO_PROTOCOL "encryption_protocol" #define MAIL_ATTR_CRYPTO_CIPHER "encryption_cipher" #define MAIL_ATTR_CRYPTO_KEYSIZE "encryption_keysize" +#define MAIL_ATTR_TLS_SNI "tls_sni" #define MAIL_ATTR_COMPAT_LEVEL "compatibility_level" #define MAIL_ATTR_MAIL_VERSION "mail_version" diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index e553abe85..e9db761b6 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 "20260715" +#define MAIL_RELEASE_DATE "20260716" #define MAIL_VERSION_NUMBER "3.12" #ifdef SNAPSHOT diff --git a/postfix/src/milter/milter.h b/postfix/src/milter/milter.h index 3a1e3f945..8b34652e1 100644 --- a/postfix/src/milter/milter.h +++ b/postfix/src/milter/milter.h @@ -186,6 +186,7 @@ extern void milter_free(MILTERS *); #define S8_MAC_TLS_VERSION "{tls_version}" #define S8_MAC_CIPHER "{cipher}" #define S8_MAC_CIPHER_BITS "{cipher_bits}" +#define S8_MAC_TLS_SNI "{tls_sni}" #define S8_MAC_CERT_SUBJECT "{cert_subject}" #define S8_MAC_CERT_ISSUER "{cert_issuer}" diff --git a/postfix/src/milter/test-milter.c b/postfix/src/milter/test-milter.c index 06324edf0..29c6ad0bc 100644 --- a/postfix/src/milter/test-milter.c +++ b/postfix/src/milter/test-milter.c @@ -208,6 +208,7 @@ static const char *macro_names[] = { "{rcpt_host}", "{rcpt_mailer}", "{tls_version}", + "{tls_sni}", 0, }; diff --git a/postfix/src/posttls-finger/posttls-finger.c b/postfix/src/posttls-finger/posttls-finger.c index 5c943632d..a3b1d372f 100644 --- a/postfix/src/posttls-finger/posttls-finger.c +++ b/postfix/src/posttls-finger/posttls-finger.c @@ -1913,7 +1913,6 @@ static void usage(void) static BIO *posttls_trace_open(void *arg, const char *trace_peer) { STATE *state = (STATE *) arg; - struct timeval tv; FILE *fp; BIO *bio; diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 6f48e4e69..50fd0c147 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -4138,6 +4138,8 @@ static int check_policy_service(SMTPD_STATE *state, const char *server, IF_ENCRYPTED(state->tls_context->cipher_name, "")), SEND_ATTR_INT(MAIL_ATTR_CRYPTO_KEYSIZE, IF_ENCRYPTED(state->tls_context->cipher_usebits, 0)), + SEND_ATTR_STR(MAIL_ATTR_TLS_SNI, + IF_ENCRYPTED(state->tls_context->peer_sni, "")), #endif SEND_ATTR_STR(MAIL_ATTR_POL_CONTEXT, policy_clnt->policy_context), diff --git a/postfix/src/smtpd/smtpd_milter.c b/postfix/src/smtpd/smtpd_milter.c index 5deba6798..c98526bf4 100644 --- a/postfix/src/smtpd/smtpd_milter.c +++ b/postfix/src/smtpd/smtpd_milter.c @@ -136,6 +136,8 @@ const char *smtpd_milter_eval(const char *name, void *ptr) IF_ENCRYPTED(state->tls_context->cipher_usebits)); return (STR(state->expand_buf)); } + if (strcmp(name, S8_MAC_TLS_SNI) == 0) + return (IF_ENCRYPTED(state->tls_context->peer_sni)); if (strcmp(name, S8_MAC_CERT_SUBJECT) == 0) return (IF_TRUSTED(state->tls_context->peer_CN)); if (strcmp(name, S8_MAC_CERT_ISSUER) == 0) diff --git a/postfix/src/tls/tls_server.c b/postfix/src/tls/tls_server.c index 04066142c..30b7ddfb0 100644 --- a/postfix/src/tls/tls_server.c +++ b/postfix/src/tls/tls_server.c @@ -425,7 +425,6 @@ static int trust_server_ccerts(X509_STORE_CTX *ctx, void *unused) TLS_APPL_STATE *tls_server_init(const TLS_SERVER_INIT_PROPS *props) { SSL_CTX *server_ctx; - X509_STORE *cert_store; long off = 0; int verify_flags = SSL_VERIFY_NONE; int cachable; diff --git a/postfix/src/util/dict_nisplus.c b/postfix/src/util/dict_nisplus.c index d83a6253c..b4d587980 100644 --- a/postfix/src/util/dict_nisplus.c +++ b/postfix/src/util/dict_nisplus.c @@ -286,7 +286,7 @@ DICT *dict_nisplus_open(const char *map, int open_flags, int dict_flags) * is that the comma character is special in main.cf. When no column * number is given at the end of the map name, we use a default column. * - * 2026506 Qualys+Mythos: enforce template substution syntax. + * 2026506 Qualys+Mythos: enforce template substitution syntax. */ if ((cp = strchr(map, '%')) == 0 || strncmp(cp, "%s", 2) != 0 || strchr(cp + 2, '%') != 0) diff --git a/postfix/src/util/dict_sockmap.c b/postfix/src/util/dict_sockmap.c index b96b26cff..11ff36e4d 100644 --- a/postfix/src/util/dict_sockmap.c +++ b/postfix/src/util/dict_sockmap.c @@ -112,6 +112,7 @@ typedef struct { */ #define DICT_SOCKMAP_DEF_TIMEOUT 100 /* connect/read/write timeout */ #define DICT_SOCKMAP_DEF_MAX_REPLY 100000 /* reply size limit */ +#define DICT_SOCKMAP_DEF_MAX_QUERY 10000 /* query size limit */ #define DICT_SOCKMAP_DEF_MAX_IDLE 10 /* close idle socket */ #define DICT_SOCKMAP_DEF_MAX_TTL 100 /* close old socket */ @@ -120,6 +121,7 @@ typedef struct { */ static int dict_sockmap_timeout = DICT_SOCKMAP_DEF_TIMEOUT; int dict_sockmap_max_reply = DICT_SOCKMAP_DEF_MAX_REPLY; +int dict_sockmap_max_query = DICT_SOCKMAP_DEF_MAX_QUERY; static int dict_sockmap_max_idle = DICT_SOCKMAP_DEF_MAX_IDLE; static int dict_sockmap_max_ttl = DICT_SOCKMAP_DEF_MAX_TTL; @@ -172,6 +174,17 @@ static const char *dict_sockmap_lookup(DICT *dict, const char *key) if (msg_verbose) msg_info("%s: key %s", myname, key); + /* + * Enforce the query size limit. As with UTF-8, an invalid key "does not + * exist". + */ + if (dict_sockmap_max_query > 0 && strlen(key) > dict_sockmap_max_query) { + msg_warn("table %s:%s query too large: '%.100s', returning 'not found'", + dict->type, dict->name, key); + dict->error = 0; + return (0); + } + /* * Optionally fold the key. */ diff --git a/postfix/src/util/dict_sockmap.h b/postfix/src/util/dict_sockmap.h index 160dfca10..15703206a 100644 --- a/postfix/src/util/dict_sockmap.h +++ b/postfix/src/util/dict_sockmap.h @@ -23,6 +23,7 @@ extern DICT *dict_sockmap_open(const char *, int, int); extern int dict_sockmap_max_reply; +extern int dict_sockmap_max_query; /* LICENSE /* .ad diff --git a/postfix/src/util/nbbio.c b/postfix/src/util/nbbio.c index f3666baf3..2be5d27b4 100644 --- a/postfix/src/util/nbbio.c +++ b/postfix/src/util/nbbio.c @@ -379,7 +379,7 @@ NBBIO *nbbio_create(int fd, ssize_t bufsize, const char *label, void nbbio_free(NBBIO *np) { nbbio_disable_readwrite(np); - /* 202606 Qualys+Mythos: close decriptor only if owner. */ + /* 202606 Qualys+Mythos: close descriptor only if owner. */ if (np->flags & NBBIO_FLAG_OWN_FD) (void) close(np->fd); myfree(np->label);