diff --git a/postfix/HISTORY b/postfix/HISTORY index d4768ac2e..1a2130d48 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -21876,3 +21876,48 @@ Apologies for any names omitted. TLS session tickets are supported as of OpenSSL 0.9.8h (May 2008). Files: mantools/postlink, proto/TLS_README.html, proto/postconf.proto. + +20150831 + + Cleanup: obsolete comments in Makefile.init. + +20150903 + + Workaround: disable DNSSEC support for AIX 7x and earlier. + The AIX 6/7 resolver(5) API defines RES_USE_DNSSEC without + defining the "ad" bit. Viktor Dukhovni. Files: makedefs, + proto/INSTALL.html, dns/dns.h. + +20150912 + + Future-proofing and code cleanup: exploit GCC and Clang + "warn_unused_result" feature to flag missing error checks. + Files: util/sys_defs.h, util/attr.h, util/edit_file.h, + util/listen.h, util/lstat_as.h, util/mac_expand.h, + util/mac_parse.h, util/myaddrinfo.h, util/myflock.h, + util/sane_fsops.h, util/sane_socketpair.h, util/stat_as.h, + util/base32_code.h, util/base64_code.h, util/hex_code.h, + util/timed_wait.h, util/vstream.h, src/util/vstring_vstream.h. + + Cleanup: incomplete error check. Found with WARN_UNUSED_RESULT + check. File: util/recv_pass_attr.c. + + Future-proofing: added type mis-match detection for + ATTR_TYPE_FUNC function-pointer arguments. File: util/attr.h. + + Cleanup: don't ignore seek-to-end-of-file errors. File: + global/record.c. + + Cleanup: use vstream_fpurge() to purge VSTREAM buffers, + instead of calling vstream_fseek() and ignoring ESPIPE + errors. File: smtpstone/qmqp-sink.c. + +20150913 + + Feature: SMTPD policy service "policy_context" attribute + and smtpd_policy_service_policy_context main.cf parameter. + Originally, to share the same SMTPD service endpoint among + multiple check_policy_service clients. Markus Benning. + Files: mantools/postlink, proto/SMTPD_POLICY_README.html, + proto/postconf.proto, global/mail_params.h, global/mail_proto.h, + smtpd/smtpd.c, smtpd/smtpd_check.c. diff --git a/postfix/INSTALL b/postfix/INSTALL index 5e5fa4e90..a17459181 100644 --- a/postfix/INSTALL +++ b/postfix/INSTALL @@ -539,6 +539,9 @@ The following is an extensive list of names and values. || |probably should also override DEF_DB_TYPE as | || |described in section 4.6. | ||_____________________________|______________________________________________| +||-DNO_DNSSEC |Do not build with DNSSEC support, even if the | +|| |resolver library appears to support it. | +||_____________________________|______________________________________________| || |Do not build with Solaris /dev/poll support. | ||-DNO_DEVPOLL |By default, /dev/poll support is compiled in | || |on Solaris versions that are known to support | diff --git a/postfix/Makefile.init b/postfix/Makefile.init index e93de9fbf..bf0bad878 100644 --- a/postfix/Makefile.init +++ b/postfix/Makefile.init @@ -1,7 +1,8 @@ # Usage: -# make makefiles [CC=compiler] [OPT=compiler-flags] [DEBUG=debug-flags] +# make makefiles [name=value]... # -# The defaults are: CC=gcc, OPT=-O, and DEBUG=-g. Examples: +# See makedefs for a descripton of available options. +# Examples: # # make makefiles # make makefiles CC="purify cc" diff --git a/postfix/README_FILES/INSTALL b/postfix/README_FILES/INSTALL index 401152db5..dac8e8e89 100644 --- a/postfix/README_FILES/INSTALL +++ b/postfix/README_FILES/INSTALL @@ -539,6 +539,9 @@ The following is an extensive list of names and values. || |probably should also override DEF_DB_TYPE as | || |described in section 4.6. | |_|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | +||-DNO_DNSSEC |Do not build with DNSSEC support, even if the | +|| |resolver library appears to support it. | +|_|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | || |Do not build with Solaris /dev/poll support. | ||-DNO_DEVPOLL |By default, /dev/poll support is compiled in | || |on Solaris versions that are known to support | diff --git a/postfix/README_FILES/SMTPD_POLICY_README b/postfix/README_FILES/SMTPD_POLICY_README index 6f2ed97f0..51c1df2c4 100644 --- a/postfix/README_FILES/SMTPD_POLICY_README +++ b/postfix/README_FILES/SMTPD_POLICY_README @@ -76,6 +76,8 @@ a delegated SMTPD access policy request: ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40 PPoossttffiixx vveerrssiioonn 33..00 aanndd llaatteerr:: client_port=1234 + PPoossttffiixx vveerrssiioonn 33..11 aanndd llaatteerr:: + policy_context=submission [empty line] Notes: @@ -145,6 +147,9 @@ Notes: * The "stress" attribute is either empty or "yes". See the STRESS_README document for further information. + * The "policy_context" attribute provides a way to pass information that is + not available via other attributes (Postfix version 3.1 and later). + The following is specific to SMTPD delegated policy requests: * Protocol names are ESMTP or SMTP. @@ -276,6 +281,12 @@ protocol: to resend a failed SMTPD policy service request. Available with Postfix 3.0 and later. + * smtpd_policy_service_policy_context (default: empty): Optional information + that is passed in the "policy_context" attribute of an SMTPD policy service + request (originally, to share the same SMTPD service endpoint among + multiple check_policy_service clients). Available with Postfix 3.1 and + later. + Configuration parameters that control the server side of the policy delegation protocol: diff --git a/postfix/WISHLIST b/postfix/WISHLIST index f5d3d0f7a..e2815adcf 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -13,6 +13,12 @@ Wish list: Postfix 3.0: In the DNS client, save/restore h_errno in the multi-query functions. + Specify WARN_UNUSED_RESULT for all library functions that + pass, deliver, bounce or defer a delivery request. + + Specify WARN_UNUSED_RESULT for mac_expand(), after making + smtp_reply_footer() undoable. + Type-checking wrappers for htable(3), ctable(3) and other modules that take and return a void* pointer. @@ -22,9 +28,6 @@ Wish list: relevant only for fingerprint-based authentication including DANE, and affects logging, SMTPD policy, and Milters. - Exploit GCC 3.4+ __attribute__((warn_unused_result)) to - warn about unused function result values. - Generalize the daemon '-S' stand-alone mode, so that it can be used with custom configuration files for request/reply regression testing. diff --git a/postfix/html/INSTALL.html b/postfix/html/INSTALL.html index 1c5f33b03..3154d17f7 100644 --- a/postfix/html/INSTALL.html +++ b/postfix/html/INSTALL.html @@ -810,6 +810,10 @@ platforms that are known to support this feature. If you override this, then you probably should also override DEF_DB_TYPE as described in section 4.6. +
The "stress" attribute is either empty or "yes". See the STRESS_README document for further information.
+The "policy_context" attribute provides a way to pass + information that is not available via other attributes (Postfix + version 3.1 and later).
+The following is specific to SMTPD delegated policy requests: @@ -367,6 +373,12 @@ giving up. Available with Postfix 3.0 and later.
between attempts to resend a failed SMTPD policy service request. Available with Postfix 3.0 and later. +smtpd_policy_service_policy_context (default: empty): +Optional information that is passed in the "policy_context" attribute +of an SMTPD policy service request (originally, to share the same +SMTPD service endpoint among multiple check_policy_service clients). +Available with Postfix 3.1 and later.
+Configuration parameters that control the server side of the diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index f11ad42d0..911c03c61 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -2956,6 +2956,10 @@ returns the server response in an application buffer even if the requested record does not exist. If this promise is broken, specify "yes" to enable a workaround for DNS reputation lookups.
++This feature is available in Postfix 3.1 and later. +
+ @@ -14633,6 +14637,21 @@ This feature is available in Postfix 2.1 and later. + + +Optional information that the Postfix SMTP server specifies in +the "policy_context" attribute of a policy service request (originally, +to share the same service endpoint among multiple check_policy_service +clients).
+ ++This feature is available in Postfix 3.1 and later. +
+ +The "stress" attribute is either empty or "yes". See the STRESS_README document for further information.
+The "policy_context" attribute provides a way to pass + information that is not available via other attributes (Postfix + version 3.1 and later).
+The following is specific to SMTPD delegated policy requests: @@ -367,6 +373,12 @@ giving up. Available with Postfix 3.0 and later.
between attempts to resend a failed SMTPD policy service request. Available with Postfix 3.0 and later. +smtpd_policy_service_policy_context (default: empty): +Optional information that is passed in the "policy_context" attribute +of an SMTPD policy service request (originally, to share the same +SMTPD service endpoint among multiple check_policy_service clients). +Available with Postfix 3.1 and later.
+Configuration parameters that control the server side of the diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index bb29626f2..e3e519731 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -16550,3 +16550,18 @@ promise that res_query() and res_search() invoke res_send(), which returns the server response in an application buffer even if the requested record does not exist. If this promise is broken, specify "yes" to enable a workaround for DNS reputation lookups.
+ ++This feature is available in Postfix 3.1 and later. +
+ +%PARAM smtpd_policy_service_policy_context + +Optional information that the Postfix SMTP server specifies in +the "policy_context" attribute of a policy service request (originally, +to share the same service endpoint among multiple check_policy_service +clients).
+ ++This feature is available in Postfix 3.1 and later. +
diff --git a/postfix/src/dns/dns.h b/postfix/src/dns/dns.h index 2938ac3d6..e2b8701ac 100644 --- a/postfix/src/dns/dns.h +++ b/postfix/src/dns/dns.h @@ -52,6 +52,13 @@ (cp) += 4; \ } +#endif + +/* + * Disable DNSSEC at compile-time even if RES_USE_DNSSEC is available + */ +#ifdef DISABLE_DNSSEC +#undef RES_USE_DNSSEC #endif /* diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 9abc4fa9d..b4dbc21bb 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -2967,6 +2967,10 @@ extern int var_smtpd_policy_try_delay; #define DEF_SMTPD_POLICY_DEF_ACTION "451 4.3.5 Server configuration problem" extern char *var_smtpd_policy_def_action; +#define VAR_SMTPD_POLICY_CONTEXT "smtpd_policy_service_policy_context" +#define DEF_SMTPD_POLICY_CONTEXT "" +extern char *var_smtpd_policy_context; + #define CHECK_POLICY_SERVICE "check_policy_service" /* diff --git a/postfix/src/global/mail_proto.h b/postfix/src/global/mail_proto.h index c36090602..1e427975a 100644 --- a/postfix/src/global/mail_proto.h +++ b/postfix/src/global/mail_proto.h @@ -161,6 +161,7 @@ extern char *mail_pathname(const char *, const char *); #define MAIL_ATTR_STRESS "stress" #define MAIL_ATTR_LOG_IDENT "log_ident" #define MAIL_ATTR_RWR_CONTEXT "rewrite_context" +#define MAIL_ATTR_POL_CONTEXT "policy_context" #define MAIL_ATTR_RWR_LOCAL "local" #define MAIL_ATTR_RWR_REMOTE "remote" diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 2e5e4b8e8..a06cec645 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 "20150829" +#define MAIL_RELEASE_DATE "20150913" #define MAIL_VERSION_NUMBER "3.1" #ifdef SNAPSHOT diff --git a/postfix/src/global/record.c b/postfix/src/global/record.c index faa58f445..54ef62822 100644 --- a/postfix/src/global/record.c +++ b/postfix/src/global/record.c @@ -177,6 +177,7 @@ int rec_put_type(VSTREAM *stream, int type, off_t offset) if (vstream_fseek(stream, offset, SEEK_SET) < 0 || VSTREAM_PUTC(type, stream) != type) { + msg_warn("%s: seek or write error", VSTREAM_PATH(stream)); return (REC_TYPE_ERROR); } else { return (type); @@ -304,8 +305,12 @@ int rec_get_raw(VSTREAM *stream, VSTRING *buf, ssize_t maxsize, int flags) continue; if (type == REC_TYPE_DTXT && (flags & REC_FLAG_SKIP_DTXT) != 0) continue; - if (type == REC_TYPE_END && (flags & REC_FLAG_SEEK_END) != 0) - (void) vstream_fseek(stream, (off_t) 0, SEEK_END); + if (type == REC_TYPE_END && (flags & REC_FLAG_SEEK_END) != 0 + && vstream_fseek(stream, (off_t) 0, SEEK_END) < 0) { + msg_warn("%s: seek error after reading END record: %m", + VSTREAM_PATH(stream)); + return (REC_TYPE_ERROR); + } break; } return (type); diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index c0c6e3e08..14bdc693c 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -757,6 +757,13 @@ /* .IP "\fBsmtpd_policy_service_retry_delay (1s)\fR" /* The delay between attempts to resend a failed SMTPD policy /* service request. +/* .PP +/* Available in Postfix version 3.1 and later: +/* .IP "\fBsmtpd_policy_service_policy_context (empty)\fR" +/* Optional information that the Postfix SMTP server specifies in +/* the "policy_context" attribute of a policy service request (originally, +/* to share the same service endpoint among multiple check_policy_service +/* clients). /* ACCESS CONTROLS /* .ad /* .fi @@ -1272,6 +1279,7 @@ int var_smtpd_policy_req_limit; int var_smtpd_policy_try_limit; int var_smtpd_policy_try_delay; char *var_smtpd_policy_def_action; +char *var_smtpd_policy_context; int var_smtpd_policy_idle; int var_smtpd_policy_ttl; char *var_xclient_hosts; @@ -5774,6 +5782,7 @@ int main(int argc, char **argv) VAR_SMTPD_ACL_PERM_LOG, DEF_SMTPD_ACL_PERM_LOG, &var_smtpd_acl_perm_log, 0, 0, VAR_SMTPD_UPROXY_PROTO, DEF_SMTPD_UPROXY_PROTO, &var_smtpd_uproxy_proto, 0, 0, VAR_SMTPD_POLICY_DEF_ACTION, DEF_SMTPD_POLICY_DEF_ACTION, &var_smtpd_policy_def_action, 1, 0, + VAR_SMTPD_POLICY_CONTEXT, DEF_SMTPD_POLICY_CONTEXT, &var_smtpd_policy_context, 0, 0, VAR_SMTPD_DNS_RE_FILTER, DEF_SMTPD_DNS_RE_FILTER, &var_smtpd_dns_re_filter, 0, 0, 0, }; diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 9a3249082..b04120f59 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -462,6 +462,7 @@ double smtpd_space_multf = 1.5; typedef struct { ATTR_CLNT *client; /* client handle */ char *def_action; /* default action */ + char *policy_context; /* context of policy request */ } SMTPD_POLICY_CLNT; /* @@ -483,6 +484,7 @@ static ATTR_OVER_INT int_table[] = { }; static ATTR_OVER_STR str_table[] = { 21 + VAR_SMTPD_POLICY_DEF_ACTION, 0, 1, 0, + 21 + VAR_SMTPD_POLICY_CONTEXT, 0, 1, 0, 0, }; @@ -498,6 +500,7 @@ static ATTR_OVER_STR str_table[] = { #define smtpd_policy_try_limit_offset 1 #define smtpd_policy_def_action_offset 0 +#define smtpd_policy_context_offset 1 /* policy_client_register - register policy service endpoint */ @@ -527,6 +530,7 @@ static void policy_client_register(const char *name) int smtpd_policy_req_limit = var_smtpd_policy_req_limit; int smtpd_policy_try_limit = var_smtpd_policy_try_limit; const char *smtpd_policy_def_action = var_smtpd_policy_def_action; + const char *smtpd_policy_context = var_smtpd_policy_context; link_override_table_to_variable(time_table, smtpd_policy_tmout); link_override_table_to_variable(time_table, smtpd_policy_idle); @@ -535,6 +539,7 @@ static void policy_client_register(const char *name) link_override_table_to_variable(int_table, smtpd_policy_req_limit); link_override_table_to_variable(int_table, smtpd_policy_try_limit); link_override_table_to_variable(str_table, smtpd_policy_def_action); + link_override_table_to_variable(str_table, smtpd_policy_context); if (*name == parens[0]) { cp = saved_name = mystrdup(name); @@ -553,11 +558,12 @@ static void policy_client_register(const char *name) if (msg_verbose) msg_info("%s: name=\"%s\" default_action=\"%s\" max_idle=%d " "max_ttl=%d request_limit=%d retry_delay=%d " - "timeout=%d try_limit=%d", + "timeout=%d try_limit=%d policy_context=\"%s\"", myname, policy_name, smtpd_policy_def_action, smtpd_policy_idle, smtpd_policy_ttl, smtpd_policy_req_limit, smtpd_policy_try_delay, - smtpd_policy_tmout, smtpd_policy_try_limit); + smtpd_policy_tmout, smtpd_policy_try_limit, + smtpd_policy_context); /* * Create the client. @@ -574,6 +580,7 @@ static void policy_client_register(const char *name) ATTR_CLNT_CTL_TRY_DELAY, smtpd_policy_try_delay, ATTR_CLNT_CTL_END); policy_client->def_action = mystrdup(smtpd_policy_def_action); + policy_client->policy_context = mystrdup(smtpd_policy_context); htable_enter(policy_clnt_table, name, (void *) policy_client); if (saved_name) myfree(saved_name); @@ -3950,6 +3957,8 @@ static int check_policy_service(SMTPD_STATE *state, const char *server, SEND_ATTR_INT(MAIL_ATTR_CRYPTO_KEYSIZE, IF_ENCRYPTED(state->tls_context->cipher_usebits, 0)), #endif + SEND_ATTR_STR(MAIL_ATTR_POL_CONTEXT, + policy_clnt->policy_context), ATTR_TYPE_END, ATTR_FLAG_MISSING, /* Reply attributes. */ RECV_ATTR_STR(MAIL_ATTR_ACTION, action), @@ -5447,6 +5456,7 @@ char *var_relay_ccerts = ""; char *var_mynetworks = ""; char *var_notify_classes = ""; char *var_smtpd_policy_def_action = ""; +char *var_smtpd_policy_context = ""; /* * String-valued configuration parameters. diff --git a/postfix/src/smtpstone/qmqp-sink.c b/postfix/src/smtpstone/qmqp-sink.c index 34d22e4ca..f07bf1043 100644 --- a/postfix/src/smtpstone/qmqp-sink.c +++ b/postfix/src/smtpstone/qmqp-sink.c @@ -135,7 +135,7 @@ static void read_data(int unused_event, void *context) send_reply(state); return; } - vstream_fseek(state->stream, 0L, 0); + vstream_fpurge(state->stream, VSTREAM_PURGE_BOTH); } /* diff --git a/postfix/src/util/attr.h b/postfix/src/util/attr.h index a08e6774f..21e14e254 100644 --- a/postfix/src/util/attr.h +++ b/postfix/src/util/attr.h @@ -25,6 +25,14 @@ #include