From df5802491a6b5ad31dba3cafa17bb10da4bc7591 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Thu, 23 Jun 2005 00:00:00 -0500 Subject: [PATCH] postfix-2.3-20050623 --- postfix/HISTORY | 8 ++++++++ postfix/RELEASE_NOTES | 13 +++++++++++++ postfix/src/bounce/Makefile.in | 6 ++++++ postfix/src/global/Makefile.in | 1 + postfix/src/global/deliver_pass.c | 26 ++++++++----------------- postfix/src/global/dsb_scan.c | 26 +++++++++++++------------ postfix/src/global/dsb_scan.h | 3 ++- postfix/src/global/dsn_print.c | 26 +++++++++++++------------ postfix/src/global/dsn_print.h | 3 ++- postfix/src/global/mail_version.h | 2 +- postfix/src/global/rcpt_buf.c | 27 +++++++++++++------------- postfix/src/global/rcpt_buf.h | 3 ++- postfix/src/global/rcpt_print.c | 32 ++++++++++++++++--------------- postfix/src/global/rcpt_print.h | 3 ++- postfix/src/tls/tls_session.c | 9 +++++++-- postfix/src/util/attr.h | 9 ++++++--- postfix/src/util/attr_print0.c | 8 ++++---- postfix/src/util/attr_scan0.c | 8 ++++---- 18 files changed, 125 insertions(+), 88 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index 3e2285b59..fc09adcf0 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -10923,6 +10923,14 @@ Apologies for any names omitted. smtp_mx_session_limit = 2). Files: smtp/smtp_connect.c, smtp/smtp_proto.c. +20050623 + + Cleanup: generalized the delegated attribute scan/print + interfaces, and updated the deliver_pass module with delegated + attribute scan/print support. Files: util/attr_scan0.c, + util/attr_print0.c, global/dsb_scan.c, global/dsn_print.c, + global/rcpt_buf,c global/rcpt_print.c, global/deliver_pass.c. + Open problems: Laptop friendliness: make the qmgr remember when the next diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 90dfe6ff3..a1ac3b2e7 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -17,6 +17,19 @@ Incompatibility with Postfix 2.1 and earlier If you upgrade from Postfix 2.1 or earlier, read RELEASE_NOTES-2.2 before proceeding. +Incompatibility with snapshot 20050622 +====================================== + +The Postfix SMTP client by default limits the number of MX server +addresses to smtp_mx_address_limit=5. Previously this limit was +disabled by default. The new limit prevents Postfix from spending +lots of time trying to connect to lots of bogus MX servers. + +The Postfix SMTP error handling of [45]XX server greetings was +cleaned up. The server reply is now properly reported. As a side +effect, the failed session now counts towards the limit on the total +number of sessions per domain name (default: smtp_mx_session_limit=2). + Incompatibility with snapshot 20050615 ====================================== diff --git a/postfix/src/bounce/Makefile.in b/postfix/src/bounce/Makefile.in index 47b1ebb6c..66a6a9fa3 100644 --- a/postfix/src/bounce/Makefile.in +++ b/postfix/src/bounce/Makefile.in @@ -106,6 +106,7 @@ bounce_append_service.o: ../../include/vstream.h bounce_append_service.o: ../../include/vstring.h bounce_append_service.o: bounce_append_service.c bounce_append_service.o: bounce_service.h +bounce_cleanup.o: ../../include/attr.h bounce_cleanup.o: ../../include/bounce_log.h bounce_cleanup.o: ../../include/dsn.h bounce_cleanup.o: ../../include/dsn_buf.h @@ -120,6 +121,7 @@ bounce_cleanup.o: ../../include/vstream.h bounce_cleanup.o: ../../include/vstring.h bounce_cleanup.o: bounce_cleanup.c bounce_cleanup.o: bounce_service.h +bounce_notify_service.o: ../../include/attr.h bounce_notify_service.o: ../../include/bounce.h bounce_notify_service.o: ../../include/bounce_log.h bounce_notify_service.o: ../../include/cleanup_user.h @@ -178,6 +180,7 @@ bounce_notify_util.o: ../../include/vstream.h bounce_notify_util.o: ../../include/vstring.h bounce_notify_util.o: bounce_notify_util.c bounce_notify_util.o: bounce_service.h +bounce_notify_verp.o: ../../include/attr.h bounce_notify_verp.o: ../../include/bounce.h bounce_notify_verp.o: ../../include/bounce_log.h bounce_notify_verp.o: ../../include/cleanup_user.h @@ -201,6 +204,7 @@ bounce_notify_verp.o: ../../include/vstream.h bounce_notify_verp.o: ../../include/vstring.h bounce_notify_verp.o: bounce_notify_verp.c bounce_notify_verp.o: bounce_service.h +bounce_one_service.o: ../../include/attr.h bounce_one_service.o: ../../include/bounce.h bounce_one_service.o: ../../include/bounce_log.h bounce_one_service.o: ../../include/cleanup_user.h @@ -222,6 +226,7 @@ bounce_one_service.o: ../../include/vstream.h bounce_one_service.o: ../../include/vstring.h bounce_one_service.o: bounce_one_service.c bounce_one_service.o: bounce_service.h +bounce_trace_service.o: ../../include/attr.h bounce_trace_service.o: ../../include/bounce_log.h bounce_trace_service.o: ../../include/cleanup_user.h bounce_trace_service.o: ../../include/deliver_request.h @@ -243,6 +248,7 @@ bounce_trace_service.o: ../../include/vstream.h bounce_trace_service.o: ../../include/vstring.h bounce_trace_service.o: bounce_service.h bounce_trace_service.o: bounce_trace_service.c +bounce_warn_service.o: ../../include/attr.h bounce_warn_service.o: ../../include/bounce_log.h bounce_warn_service.o: ../../include/cleanup_user.h bounce_warn_service.o: ../../include/dsn.h diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index 787e682ff..cdb30dae0 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -625,6 +625,7 @@ deliver_pass.o: ../../include/vstring.h deliver_pass.o: deliver_pass.c deliver_pass.o: deliver_pass.h deliver_pass.o: deliver_request.h +deliver_pass.o: dsb_scan.h deliver_pass.o: dsn.h deliver_pass.o: dsn_buf.h deliver_pass.o: mail_params.h diff --git a/postfix/src/global/deliver_pass.c b/postfix/src/global/deliver_pass.c index 255e57314..1922db714 100644 --- a/postfix/src/global/deliver_pass.c +++ b/postfix/src/global/deliver_pass.c @@ -67,6 +67,7 @@ #include #include +#include /* deliver_pass_initial_reply - retrieve initial delivery process response */ @@ -130,24 +131,14 @@ static int deliver_pass_send_request(VSTREAM *stream, DELIVER_REQUEST *request, /* deliver_pass_final_reply - retrieve final delivery status response */ -static int deliver_pass_final_reply(VSTREAM *stream, VSTRING *dsn_status, - VSTRING *reason, - VSTRING *dsn_dtype, - VSTRING *dsn_dtext, - VSTRING *dsn_mtype, - VSTRING *dsn_mname) +static int deliver_pass_final_reply(VSTREAM *stream, DSN_BUF *dsb) { int stat; if (attr_scan(stream, ATTR_FLAG_STRICT, - ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsn_status, - ATTR_TYPE_STR, MAIL_ATTR_WHY, reason, - ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, dsn_dtype, - ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, dsn_dtext, - ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, dsn_mtype, - ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, dsn_mname, + ATTR_TYPE_FUNC, dsb_scan, (void *) dsb, ATTR_TYPE_NUM, MAIL_ATTR_STATUS, &stat, - ATTR_TYPE_END) != 7) { + ATTR_TYPE_END) != 2) { msg_warn("%s: malformed response", VSTREAM_PATH(stream)); stat = -1; } @@ -161,7 +152,7 @@ int deliver_pass(const char *class, const char *service, RECIPIENT *rcpt) { VSTREAM *stream; - VSTRING *junk; + DSN_BUF *dsb; int status; char *saved_service; char *transport; @@ -181,7 +172,7 @@ int deliver_pass(const char *class, const char *service, * Initialize. */ stream = mail_connect_wait(class, transport); - junk = vstring_alloc(1); + dsb = dsb_create(); /* * Get the delivery process initial response. Send the queue file info @@ -196,14 +187,13 @@ int deliver_pass(const char *class, const char *service, if ((status = deliver_pass_initial_reply(stream)) == 0 && (status = deliver_pass_send_request(stream, request, nexthop, rcpt)) == 0) - status = deliver_pass_final_reply(stream, junk, junk, junk, - junk, junk, junk); + status = deliver_pass_final_reply(stream, dsb); /* * Clean up. */ vstream_fclose(stream); - vstring_free(junk); + dsb_free(dsb); myfree(saved_service); return (status); diff --git a/postfix/src/global/dsb_scan.c b/postfix/src/global/dsb_scan.c index 9ddb568b6..0693d5887 100644 --- a/postfix/src/global/dsb_scan.c +++ b/postfix/src/global/dsb_scan.c @@ -6,13 +6,14 @@ /* SYNOPSIS /* #include /* -/* int dsb_scan(stream, flags, ptr) +/* int dsb_scan(scan_fn, stream, flags, ptr) +/* ATTR_SCAN_MASTER_FN scan_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* DESCRIPTION /* dsb_scan() reads a DSN_BUF from the named stream using the -/* default attribute scan routines. This function is meant +/* specified attribute scan routine. dsb_scan() is meant /* to be passed as a call-back to attr_scan(), thusly: /* /* ... ATTR_SCAN_FUNC, dsb_scan, (void *) &dsbuf, ... @@ -44,7 +45,8 @@ /* dsb_scan - read DSN_BUF from stream */ -int dsb_scan(VSTREAM *fp, int flags, void *ptr) +int dsb_scan(ATTR_SCAN_MASTER_FN scan_fn, VSTREAM *fp, + int flags, void *ptr) { DSN_BUF *dsb = (DSN_BUF *) ptr; int ret; @@ -53,14 +55,14 @@ int dsb_scan(VSTREAM *fp, int flags, void *ptr) * The attribute order is determined by backwards compatibility. It can * be sanitized after all the ad-hoc DSN read/write code is replaced. */ - ret = attr_scan(fp, flags | ATTR_FLAG_MORE, - ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsb->status, - ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, dsb->dtype, - ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, dsb->dtext, - ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, dsb->mtype, - ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, dsb->mname, - ATTR_TYPE_STR, MAIL_ATTR_DSN_ACTION, dsb->action, - ATTR_TYPE_STR, MAIL_ATTR_WHY, dsb->reason, - ATTR_TYPE_END); + ret = scan_fn(fp, flags | ATTR_FLAG_MORE, + ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsb->status, + ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, dsb->dtype, + ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, dsb->dtext, + ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, dsb->mtype, + ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, dsb->mname, + ATTR_TYPE_STR, MAIL_ATTR_DSN_ACTION, dsb->action, + ATTR_TYPE_STR, MAIL_ATTR_WHY, dsb->reason, + ATTR_TYPE_END); return (ret == 7 ? 1 : -1); } diff --git a/postfix/src/global/dsb_scan.h b/postfix/src/global/dsb_scan.h index 4859b7661..397f86bc3 100644 --- a/postfix/src/global/dsb_scan.h +++ b/postfix/src/global/dsb_scan.h @@ -15,6 +15,7 @@ * Utility library. */ #include +#include /* * Global library. @@ -24,7 +25,7 @@ /* * External interface. */ -extern int dsb_scan(VSTREAM *, int, void *); +extern int dsb_scan(ATTR_SCAN_MASTER_FN, VSTREAM *, int, void *); /* LICENSE /* .ad diff --git a/postfix/src/global/dsn_print.c b/postfix/src/global/dsn_print.c index 15c31ea72..ea1dc4924 100644 --- a/postfix/src/global/dsn_print.c +++ b/postfix/src/global/dsn_print.c @@ -6,13 +6,14 @@ /* SYNOPSIS /* #include /* -/* int dsn_print(stream, flags, ptr) +/* int dsn_print(print_fn, stream, flags, ptr) +/* ATTR_PRINT_MASTER_FN print_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* DESCRIPTION /* dsn_print() writes a DSN structure to the named stream using -/* the default attribute print routines. This function is meant +/* the specified attribute print routine. dsn_print() is meant /* to be passed as a call-back to attr_print(), thusly: /* /* ... ATTR_PRINT_FUNC, dsn_print, (void *) dsn, ... @@ -44,7 +45,8 @@ /* dsn_print - write DSN to stream */ -int dsn_print(VSTREAM *fp, int flags, void *ptr) +int dsn_print(ATTR_PRINT_MASTER_FN print_fn, VSTREAM *fp, + int flags, void *ptr) { DSN *dsn = (DSN *) ptr; int ret; @@ -55,14 +57,14 @@ int dsn_print(VSTREAM *fp, int flags, void *ptr) * The attribute order is determined by backwards compatibility. It can * be sanitized after all the ad-hoc DSN read/write code is replaced. */ - ret = attr_print(fp, flags | ATTR_FLAG_MORE, - ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsn->status, - ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, S(dsn->dtype), - ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, S(dsn->dtext), - ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, S(dsn->mtype), - ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, S(dsn->mname), - ATTR_TYPE_STR, MAIL_ATTR_DSN_ACTION, S(dsn->action), - ATTR_TYPE_STR, MAIL_ATTR_WHY, dsn->reason, - ATTR_TYPE_END); + ret = print_fn(fp, flags | ATTR_FLAG_MORE, + ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsn->status, + ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, S(dsn->dtype), + ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, S(dsn->dtext), + ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, S(dsn->mtype), + ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, S(dsn->mname), + ATTR_TYPE_STR, MAIL_ATTR_DSN_ACTION, S(dsn->action), + ATTR_TYPE_STR, MAIL_ATTR_WHY, dsn->reason, + ATTR_TYPE_END); return (ret); } diff --git a/postfix/src/global/dsn_print.h b/postfix/src/global/dsn_print.h index a78d3f13f..4b2c9fa84 100644 --- a/postfix/src/global/dsn_print.h +++ b/postfix/src/global/dsn_print.h @@ -15,6 +15,7 @@ * Utility library. */ #include +#include /* * Global library. @@ -24,7 +25,7 @@ /* * External interface. */ -extern int dsn_print(VSTREAM *, int, void *); +extern int dsn_print(ATTR_PRINT_MASTER_FN, VSTREAM *, int, void *); /* LICENSE /* .ad diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 43c5fdafd..0993eae72 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 "20050622" +#define MAIL_RELEASE_DATE "20050623" #define MAIL_VERSION_NUMBER "2.3" #define VAR_MAIL_VERSION "mail_version" diff --git a/postfix/src/global/rcpt_buf.c b/postfix/src/global/rcpt_buf.c index 19bdf8721..2417a5cb1 100644 --- a/postfix/src/global/rcpt_buf.c +++ b/postfix/src/global/rcpt_buf.c @@ -21,13 +21,14 @@ /* void rcpb_free(rcpt) /* RCPT_BUF *rcpt; /* -/* int rcpb_scan(stream, flags, ptr) +/* int rcpb_scan(scan_fn, stream, flags, ptr) +/* ATTR_SCAN_MASTER_FN scan_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* DESCRIPTION /* rcpb_scan() reads a recipient buffer from the named stream -/* using the default attribute scan routines. This function +/* using the specified attribute scan routine. rcpb_scan() /* is meant to be passed as a call-back to attr_scan(), thusly: /* /* ... ATTR_SCAN_FUNC, rcpb_scan, (void *) rcpt_buf, ... @@ -91,22 +92,22 @@ void rcpb_free(RCPT_BUF *rcpt) /* rcpb_scan - receive recipient buffer */ -int rcpb_scan(VSTREAM *fp, int flags, void *ptr) +int rcpb_scan(ATTR_SCAN_MASTER_FN scan_fn, VSTREAM *fp, + int flags, void *ptr) { RCPT_BUF *rcpt = (RCPT_BUF *) ptr; int ret; /* - * As with DSN, the order of attributes is determined by historical - * compatibility and can be fixed after all the ad-hoc read/write code is - * replaced. + * The order of attributes is determined by historical compatibility and + * can be fixed after all the ad-hoc read/write code is replaced. */ - ret = attr_scan(fp, flags | ATTR_FLAG_MORE, - ATTR_TYPE_STR, MAIL_ATTR_ORCPT, rcpt->orig_addr, - ATTR_TYPE_STR, MAIL_ATTR_RECIP, rcpt->address, - ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, &rcpt->offset, - ATTR_TYPE_STR, MAIL_ATTR_DSN_ORCPT, rcpt->dsn_orcpt, - ATTR_TYPE_NUM, MAIL_ATTR_DSN_NOTIFY, &rcpt->dsn_notify, - ATTR_TYPE_END); + ret = scan_fn(fp, flags | ATTR_FLAG_MORE, + ATTR_TYPE_STR, MAIL_ATTR_ORCPT, rcpt->orig_addr, + ATTR_TYPE_STR, MAIL_ATTR_RECIP, rcpt->address, + ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, &rcpt->offset, + ATTR_TYPE_STR, MAIL_ATTR_DSN_ORCPT, rcpt->dsn_orcpt, + ATTR_TYPE_NUM, MAIL_ATTR_DSN_NOTIFY, &rcpt->dsn_notify, + ATTR_TYPE_END); return (ret == 5 ? 1 : -1); } diff --git a/postfix/src/global/rcpt_buf.h b/postfix/src/global/rcpt_buf.h index b5da802a3..0dbee35c8 100644 --- a/postfix/src/global/rcpt_buf.h +++ b/postfix/src/global/rcpt_buf.h @@ -16,6 +16,7 @@ */ #include #include +#include /* * External interface. @@ -30,7 +31,7 @@ typedef struct { extern RCPT_BUF *rcpb_create(void); extern void rcpb_free(RCPT_BUF *); -extern int rcpb_scan(VSTREAM *, int, void *); +extern int rcpb_scan(ATTR_SCAN_MASTER_FN, VSTREAM *, int, void *); #define RECIPIENT_FROM_RCPT_BUF(rcpt, buf) \ ((rcpt)->address = vstring_str((buf)->address), \ diff --git a/postfix/src/global/rcpt_print.c b/postfix/src/global/rcpt_print.c index cb56940ec..b923e6f04 100644 --- a/postfix/src/global/rcpt_print.c +++ b/postfix/src/global/rcpt_print.c @@ -6,16 +6,16 @@ /* SYNOPSIS /* #include /* -/* int rcpt_print(stream, flags, ptr) +/* int rcpt_print(print_fn, stream, flags, ptr) +/* ATTR_PRINT_MASTER_FN print_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* DESCRIPTION /* rcpt_print() writes the contents of a RECIPIENT structure -/* to the named stream using the default attribute print -/* routines. This function is meant to be passed as a call-back -/* to attr_print(), -/* thusly: +/* to the named stream using the specified attribute print +/* routine. rcpt_print() is meant to be passed as a call-back +/* to attr_print(), thusly: /* /* ... ATTR_PRINT_FUNC, rcpt_print, (void *) recipient, ... /* DIAGNOSTICS @@ -44,7 +44,8 @@ /* rcpt_print - write recipient to stream */ -int rcpt_print(VSTREAM *fp, int flags, void *ptr) +int rcpt_print(ATTR_PRINT_MASTER_FN print_fn, VSTREAM *fp, + int flags, void *ptr) { RECIPIENT *rcpt = (RECIPIENT *) ptr; int ret; @@ -52,16 +53,17 @@ int rcpt_print(VSTREAM *fp, int flags, void *ptr) #define S(s) ((s) ? (s) : "") /* - * The attribute order is determined by backwards compatibility. It can - * be sanitized after all the ad-hoc recipient read/write code is replaced. + * The attribute order is determined by backwards compatibility. It can + * be sanitized after all the ad-hoc recipient read/write code is + * replaced. */ ret = - attr_print(fp, flags | ATTR_FLAG_MORE, - ATTR_TYPE_STR, MAIL_ATTR_ORCPT, S(rcpt->orig_addr), - ATTR_TYPE_STR, MAIL_ATTR_RECIP, rcpt->address, - ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, rcpt->offset, - ATTR_TYPE_STR, MAIL_ATTR_DSN_ORCPT, S(rcpt->dsn_orcpt), - ATTR_TYPE_NUM, MAIL_ATTR_DSN_NOTIFY, rcpt->dsn_notify, - ATTR_TYPE_END); + print_fn(fp, flags | ATTR_FLAG_MORE, + ATTR_TYPE_STR, MAIL_ATTR_ORCPT, S(rcpt->orig_addr), + ATTR_TYPE_STR, MAIL_ATTR_RECIP, rcpt->address, + ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, rcpt->offset, + ATTR_TYPE_STR, MAIL_ATTR_DSN_ORCPT, S(rcpt->dsn_orcpt), + ATTR_TYPE_NUM, MAIL_ATTR_DSN_NOTIFY, rcpt->dsn_notify, + ATTR_TYPE_END); return (ret); } diff --git a/postfix/src/global/rcpt_print.h b/postfix/src/global/rcpt_print.h index fd6789444..ef46ad1a9 100644 --- a/postfix/src/global/rcpt_print.h +++ b/postfix/src/global/rcpt_print.h @@ -15,6 +15,7 @@ * Utility library. */ #include +#include /* * Global library. @@ -24,7 +25,7 @@ /* * External interface. */ -extern int rcpt_print(VSTREAM *, int, void *); +extern int rcpt_print(ATTR_SCAN_MASTER_FN, VSTREAM *, int, void *); /* LICENSE /* .ad diff --git a/postfix/src/tls/tls_session.c b/postfix/src/tls/tls_session.c index 4c809232f..21d939ee0 100644 --- a/postfix/src/tls/tls_session.c +++ b/postfix/src/tls/tls_session.c @@ -147,13 +147,18 @@ VSTRING *tls_session_passivate(SSL_SESSION *session) SSL_SESSION *tls_session_activate(const char *session_data, int session_data_len) { +#if (OPENSSL_VERSION_NUMBER < 0x0090707fL) +#define BOGUS_CONST +#else +#define BOGUS_CONST const +#endif SSL_SESSION *session; - const unsigned char *ptr; + BOGUS_CONST unsigned char *ptr; /* * Activate the SSL_SESSION object. */ - ptr = (const unsigned char *) session_data; + ptr = (BOGUS_CONST unsigned char *) session_data; session = d2i_SSL_SESSION((SSL_SESSION **) 0, &ptr, session_data_len); if (!session) tls_print_errors(); diff --git a/postfix/src/util/attr.h b/postfix/src/util/attr.h index 65e703af9..47f757635 100644 --- a/postfix/src/util/attr.h +++ b/postfix/src/util/attr.h @@ -47,9 +47,12 @@ #define ATTR_FLAG_ALL (07) /* -Delegation for better data abstraction. */ -typedef int (*ATTR_SCAN_FN)(VSTREAM *, int, void *); -typedef int (*ATTR_PRINT_FN)(VSTREAM *, int, void *); + * Delegation for better data abstraction. + */ +typedef int (*ATTR_SCAN_MASTER_FN) (VSTREAM *, int, ...); +typedef int (*ATTR_SCAN_SLAVE_FN) (ATTR_SCAN_MASTER_FN, VSTREAM *, int, void *); +typedef int (*ATTR_PRINT_MASTER_FN) (VSTREAM *, int,...); +typedef int (*ATTR_PRINT_SLAVE_FN) (ATTR_PRINT_MASTER_FN, VSTREAM *, int, void *); /* * Default to null-terminated, as opposed to base64-encoded. diff --git a/postfix/src/util/attr_print0.c b/postfix/src/util/attr_print0.c index 1c2b4de57..4d9c4e97e 100644 --- a/postfix/src/util/attr_print0.c +++ b/postfix/src/util/attr_print0.c @@ -54,7 +54,7 @@ /* .IP "ATTR_TYPE_DATA (char *, int, char *)" /* This argument is followed by an attribute name, an attribute value /* length, and an attribute value pointer. -/* .IP "ATTR_TYPE_FUNC (ATTR_PRINT_FN, void *)" +/* .IP "ATTR_TYPE_FUNC (ATTR_PRINT_SLAVE_FN, void *)" /* This argument is followed by a function pointer and generic data /* pointer. /* .IP "ATTR_TYPE_HASH (HTABLE *)" @@ -114,7 +114,7 @@ int attr_vprint0(VSTREAM *fp, int flags, va_list ap) HTABLE_INFO **ht; int len_val; static VSTRING *base64_buf; - ATTR_PRINT_FN print_fn; + ATTR_PRINT_SLAVE_FN print_fn; void *print_arg; /* @@ -168,9 +168,9 @@ int attr_vprint0(VSTREAM *fp, int flags, va_list ap) msg_info("send attr %s = [data %d bytes]", attr_name, len_val); break; case ATTR_TYPE_FUNC: - print_fn = va_arg(ap, ATTR_PRINT_FN); + print_fn = va_arg(ap, ATTR_PRINT_SLAVE_FN); print_arg = va_arg(ap, void *); - print_fn(fp, flags | ATTR_FLAG_MORE, print_arg); + print_fn(attr_print0, fp, flags | ATTR_FLAG_MORE, print_arg); break; case ATTR_TYPE_HASH: ht_info_list = htable_list(va_arg(ap, HTABLE *)); diff --git a/postfix/src/util/attr_scan0.c b/postfix/src/util/attr_scan0.c index 66a889419..bf00c64c9 100644 --- a/postfix/src/util/attr_scan0.c +++ b/postfix/src/util/attr_scan0.c @@ -93,7 +93,7 @@ /* This argument is followed by an attribute name and a VSTRING pointer. /* .IP "ATTR_TYPE_DATA (char *, VSTRING *)" /* This argument is followed by an attribute name and a VSTRING pointer. -/* .IP "ATTR_TYPE_FUNC (ATTR_SCAN_FN, void *)" +/* .IP "ATTR_TYPE_FUNC (ATTR_SCAN_SLAVE_FN, void *)" /* This argument is followed by a function pointer and a generic data /* pointer. /* .IP "ATTR_TYPE_HASH (HTABLE *)" @@ -256,7 +256,7 @@ int attr_vscan0(VSTREAM *fp, int flags, va_list ap) HTABLE *hash_table; int ch; int conversions; - ATTR_SCAN_FN scan_fn; + ATTR_SCAN_SLAVE_FN scan_fn; void *scan_arg; /* @@ -378,9 +378,9 @@ int attr_vscan0(VSTREAM *fp, int flags, va_list ap) return (-1); break; case ATTR_TYPE_FUNC: - scan_fn = va_arg(ap, ATTR_SCAN_FN); + scan_fn = va_arg(ap, ATTR_SCAN_SLAVE_FN); scan_arg = va_arg(ap, void *); - if (scan_fn(fp, flags | ATTR_FLAG_MORE, scan_arg) < 0) + if (scan_fn(attr_scan0, fp, flags | ATTR_FLAG_MORE, scan_arg) < 0) return (-1); break; case ATTR_TYPE_HASH: