From: Wietse Venema Date: Tue, 18 Jul 2000 05:00:00 +0000 (-0500) Subject: snapshot-20000718 X-Git-Tag: v20010228~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7878e0b4bbeae2537996c12e2fc31484289686cd;p=thirdparty%2Fpostfix.git snapshot-20000718 --- diff --git a/postfix/DEBUG_README b/postfix/DEBUG_README index 78d0b6dd5..3ad762120 100644 --- a/postfix/DEBUG_README +++ b/postfix/DEBUG_README @@ -104,6 +104,10 @@ by its author? There are two possibilities. In both cases, the program being executed is not the program that was supposed to be executed, so anything can happen. +There is a third possibility: + +3 - Bugs in system software (kernel or libraries). + Hardware-related failures happen erratically, and they usually do not reproduce after power cycling and rebooting the system. There's little I can do about bad hardware. Be sure to use hardware that diff --git a/postfix/HISTORY b/postfix/HISTORY index 7a478e983..c7e387e87 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -4095,3 +4095,22 @@ Apologies for any names omitted. delivery agent no longer appends a blank line to mail that is delivered to external command. Files: pipe/pipe.c, global/mail_copy.[hc]. + +20000708 + + Portability: support for NEXT/OPENSTEP requires extra + include file in util/watchdog.c (Masaki Murase). + +20000715 + + Added macros to turn on vstream/vstring/etc. format string + checking by gcc, in addition to the checking that was + already implemented with printfck. File: util/sys_defs.h, + the macros for PRINTFLIKE and SCANFLIKE. Problem - unlike + the printfck tool, this gcc finds mismatches only in code + that isn't #ifdef-ed out. + +20000718 + + Robustness: make_dirs() now continues when a missing + directory is created by another process. diff --git a/postfix/INSTALL b/postfix/INSTALL index b383ed897..d44582673 100644 --- a/postfix/INSTALL +++ b/postfix/INSTALL @@ -82,7 +82,7 @@ If your system is supported, it is one of Reliant UNIX 5.x Rhapsody 5.x SunOS 4.1.x - SunOS 5.4..5.7 (Solaris 2.4..7) + SunOS 5.4..5.8 (Solaris 2.4..8) Ultrix 4.x or something closely resemblant. diff --git a/postfix/Makefile.in b/postfix/Makefile.in index 37d18300b..4fa822d0f 100644 --- a/postfix/Makefile.in +++ b/postfix/Makefile.in @@ -1,5 +1,5 @@ SHELL = /bin/sh -WARN = -Wmissing-prototypes +WARN = -Wmissing-prototypes -Wformat OPTS = "CC=$(CC)" DIRS = util global dns master postfix smtpstone sendmail error \ pickup cleanup smtpd local lmtp trivial-rewrite qmgr smtp bounce pipe \ diff --git a/postfix/cleanup/cleanup.h b/postfix/cleanup/cleanup.h index 4bba6ada5..13809b382 100644 --- a/postfix/cleanup/cleanup.h +++ b/postfix/cleanup/cleanup.h @@ -108,7 +108,7 @@ extern CONFIG_STR_TABLE cleanup_str_table[]; */ extern void cleanup_out(CLEANUP_STATE *, int, char *, int); extern void cleanup_out_string(CLEANUP_STATE *, int, char *); -extern void cleanup_out_format(CLEANUP_STATE *, int, char *,...); +extern void PRINTFLIKE(3, 4) cleanup_out_format(CLEANUP_STATE *, int, char *,...); #define CLEANUP_OUT_BUF(s, t, b) \ cleanup_out((s), (t), vstring_str((b)), VSTRING_LEN((b))) diff --git a/postfix/cleanup/cleanup_message.c b/postfix/cleanup/cleanup_message.c index 3b6efc245..ed43a5929 100644 --- a/postfix/cleanup/cleanup_message.c +++ b/postfix/cleanup/cleanup_message.c @@ -354,10 +354,11 @@ static void cleanup_missing_headers(CLEANUP_STATE *state) if ((state->headers_seen & (1 << (state->resent[0] ? HDR_RESENT_FROM : HDR_FROM))) == 0) { - quote_822_local(state->temp1, state->sender); + quote_822_local(state->temp1, *state->sender ? + state->sender : MAIL_ADDR_MAIL_DAEMON); vstring_sprintf(state->temp2, "%sFrom: %s", state->resent, vstring_str(state->temp1)); - if (state->fullname && *state->fullname) { + if (*state->sender && state->fullname && *state->fullname) { vstring_sprintf(state->temp1, "(%s)", state->fullname); token = tok822_parse(vstring_str(state->temp1)); vstring_strcat(state->temp2, " "); diff --git a/postfix/conf/sample-smtpd.cf b/postfix/conf/sample-smtpd.cf index f662bfa2c..0539cc551 100644 --- a/postfix/conf/sample-smtpd.cf +++ b/postfix/conf/sample-smtpd.cf @@ -41,7 +41,8 @@ smtpd_banner = $myhostname ESMTP $mail_name # or networks obtained by stripping octets. # Reject if result is REJECT or "[45]xx text" # Permit otherwise. -# reject_maps_rbl: reject if the client is listed under $maps_rbl_domains. +# reject_maps_rbl: reject if the reverse client network address +# is listed under $maps_rbl_domains. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. smtpd_etrn_restrictions = diff --git a/postfix/global/Makefile.in b/postfix/global/Makefile.in index 673dc8819..544b29919 100644 --- a/postfix/global/Makefile.in +++ b/postfix/global/Makefile.in @@ -62,7 +62,7 @@ INCL = LIB = libglobal.a TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \ mail_addr_map mail_date maps mynetworks mypwd namadr_list \ - off_cvt quote_822_local rec2stream recdump resolve_clnt \ + off_cvt peer_name quote_822_local rec2stream recdump resolve_clnt \ resolve_local rewrite_clnt stream2rec string_list tok822_parse \ quote_821_local @@ -197,6 +197,11 @@ local_transport: $(LIB) $(LIBS) quote_821_local: quote_821_local.c $(LIBS) $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIBS) $(SYSLIBS) +peer_name: $(LIB) + mv $@.o junk + $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS) + mv junk $@.o + tests: tok822_test tok822_test: tok822_parse tok822_parse.in tok822_parse.ref diff --git a/postfix/global/been_here.h b/postfix/global/been_here.h index 12d878487..855001d61 100644 --- a/postfix/global/been_here.h +++ b/postfix/global/been_here.h @@ -31,9 +31,9 @@ typedef struct { extern BH_TABLE *been_here_init(int, int); extern void been_here_free(BH_TABLE *); extern int been_here_fixed(BH_TABLE *, const char *); -extern int been_here(BH_TABLE *, const char *,...); +extern int PRINTFLIKE(2, 3) been_here(BH_TABLE *, const char *,...); extern int been_here_check_fixed(BH_TABLE *, const char *); -extern int been_here_check(BH_TABLE *, const char *,...); +extern int PRINTFLIKE(2, 3) been_here_check(BH_TABLE *, const char *,...); /* LICENSE /* .ad diff --git a/postfix/global/bounce.h b/postfix/global/bounce.h index ccee874ef..fd3623e98 100644 --- a/postfix/global/bounce.h +++ b/postfix/global/bounce.h @@ -20,15 +20,17 @@ /* * Client interface. */ -extern int bounce_append(int, const char *, const char *, const char *, - time_t, const char *,...); +extern int PRINTFLIKE(6, 7) bounce_append(int, const char *, const char *, + const char *, time_t, + const char *,...); extern int vbounce_append(int, const char *, const char *, const char *, time_t, const char *, va_list); extern int bounce_flush(int, const char *, const char *, const char *); -extern int bounce_recip(int, const char *, const char *, const char *, - const char *, const char *, time_t, - const char *,...); +extern int PRINTFLIKE(8, 9) bounce_recip(int, const char *, const char *, + const char *, const char *, + const char *, time_t, + const char *,...); extern int vbounce_recip(int, const char *, const char *, const char *, const char *, const char *, time_t, const char *, va_list); @@ -38,7 +40,8 @@ extern int vbounce_recip(int, const char *, const char *, const char *, */ #define BOUNCE_CMD_APPEND 0 /* append log */ #define BOUNCE_CMD_FLUSH 1 /* send log */ -#define BOUNCE_CMD_WARN 2 /* send warning bounce, don't delete log */ +#define BOUNCE_CMD_WARN 2 /* send warning bounce, don't delete + * log */ #define BOUNCE_CMD_RECIP 3 /* immediate bounce, no logfile */ /* diff --git a/postfix/global/defer.h b/postfix/global/defer.h index ae6385cfc..d23e2d664 100644 --- a/postfix/global/defer.h +++ b/postfix/global/defer.h @@ -25,8 +25,8 @@ /* * External interface. */ -extern int defer_append(int, const char *, const char *, const char *, - time_t, const char *,...); +extern int PRINTFLIKE(6, 7) defer_append(int, const char *, const char *, + const char *, time_t, const char *,...); extern int vdefer_append(int, const char *, const char *, const char *, time_t, const char *, va_list); extern int defer_flush(int, const char *, const char *, const char *); diff --git a/postfix/global/deliver_request.c b/postfix/global/deliver_request.c index a38f0368d..fee68b991 100644 --- a/postfix/global/deliver_request.c +++ b/postfix/global/deliver_request.c @@ -190,7 +190,7 @@ static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request) &request->flags, queue_name, queue_id, &request->data_offset, &request->data_size, nexthop, address, - errors_to, return_receipt, &request->arrival_time) != 9) + errors_to, return_receipt, &request->arrival_time) != 10) return (-1); if (mail_open_ok(vstring_str(queue_name), vstring_str(queue_id), &st, &path) == 0) diff --git a/postfix/global/mail_params.h b/postfix/global/mail_params.h index 64e092926..e3bb7d6e0 100644 --- a/postfix/global/mail_params.h +++ b/postfix/global/mail_params.h @@ -23,6 +23,14 @@ typedef int bool; #define DEF_MAIL_NAME "Postfix" extern char *var_mail_name; + /* + * Logging facility. Configurable so you can distinguish a limited number of + * Postfix instances. + */ +#define VAR_LOG_FACILITY "logging_facility" +#define DEF_LOG_FACILITY "mail" +extern char *var_log_facility; + /* * What problem classes should be reported to the postmaster via email. * Default is bad problems only. See mail_error(3). Even when mail notices diff --git a/postfix/global/mail_proto.h b/postfix/global/mail_proto.h index 977df5604..275680c51 100644 --- a/postfix/global/mail_proto.h +++ b/postfix/global/mail_proto.h @@ -81,8 +81,8 @@ extern VSTREAM *mail_connect_wait(const char *, const char *); extern int mail_scan(VSTREAM *, const char *,...); extern void mail_scan_register(int, const char *, MAIL_SCAN_FN); extern void mail_print_register(int, const char *, MAIL_PRINT_FN); -extern int mail_print(VSTREAM *, const char *,...); -extern int mail_command_write(const char *, const char *, const char *,...); +extern int PRINTFLIKE(2, 3) mail_print(VSTREAM *, const char *,...); +extern int PRINTFLIKE(3, 4) mail_command_write(const char *, const char *, const char *,...); extern int mail_command_read(VSTREAM *, char *,...); extern int mail_trigger(const char *, const char *, const char *, int); extern char *mail_pathname(const char *, const char *); diff --git a/postfix/global/mail_version.h b/postfix/global/mail_version.h index 9d9f8ac88..67b1245e8 100644 --- a/postfix/global/mail_version.h +++ b/postfix/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-20000625" +#define DEF_MAIL_VERSION "Snapshot-20000718" extern char *var_mail_version; /* LICENSE diff --git a/postfix/global/opened.h b/postfix/global/opened.h index d365b0c00..618dd4221 100644 --- a/postfix/global/opened.h +++ b/postfix/global/opened.h @@ -19,7 +19,8 @@ /* * External interface. */ -extern void opened(const char *, const char *, long, const char *,...); +extern void PRINTFLIKE(4, 5) opened(const char *, const char *, long, + const char *,...); extern void vopened(const char *, const char *, long, const char *, va_list); /* LICENSE diff --git a/postfix/global/post_mail.h b/postfix/global/post_mail.h index 4786876ba..8fa5a80bf 100644 --- a/postfix/global/post_mail.h +++ b/postfix/global/post_mail.h @@ -27,7 +27,7 @@ extern VSTREAM *post_mail_fopen(const char *, const char *, int, const char *); extern VSTREAM *post_mail_fopen_nowait(const char *, const char *, int, const char *); -extern int post_mail_fprintf(VSTREAM *, const char *,...); +extern int PRINTFLIKE(2, 3) post_mail_fprintf(VSTREAM *, const char *,...); extern int post_mail_fputs(VSTREAM *, const char *); extern int post_mail_buffer(VSTREAM *, const char *, int); extern int post_mail_fclose(VSTREAM *); diff --git a/postfix/global/record.h b/postfix/global/record.h index 872868948..da91dc3e1 100644 --- a/postfix/global/record.h +++ b/postfix/global/record.h @@ -35,7 +35,7 @@ extern int rec_get(VSTREAM *, VSTRING *, int); extern int rec_put(VSTREAM *, int, const char *, int); extern int rec_put_type(VSTREAM *, int, long); -extern int rec_fprintf(VSTREAM *, int, const char *,...); +extern int PRINTFLIKE(3, 4) rec_fprintf(VSTREAM *, int, const char *,...); extern int rec_fputs(VSTREAM *, int, const char *); #define REC_PUT_BUF(v, t, b) rec_put((v), (t), vstring_str(b), VSTRING_LEN(b)) diff --git a/postfix/global/sent.h b/postfix/global/sent.h index 82eaac188..cc5178fd0 100644 --- a/postfix/global/sent.h +++ b/postfix/global/sent.h @@ -20,8 +20,8 @@ /* * External interface. */ -extern int sent(const char *, const char *, const char *, - time_t, const char *,...); +extern int PRINTFLIKE(5, 6) sent(const char *, const char *, const char *, + time_t, const char *,...); extern int vsent(const char *, const char *, const char *, time_t, const char *, va_list); diff --git a/postfix/global/smtp_stream.h b/postfix/global/smtp_stream.h index f1f087b49..09f53e7bc 100644 --- a/postfix/global/smtp_stream.h +++ b/postfix/global/smtp_stream.h @@ -30,7 +30,7 @@ #define SMTP_ERR_TIME 2 /* time out */ extern void smtp_timeout_setup(VSTREAM *, int); -extern void smtp_printf(VSTREAM *, const char *,...); +extern void PRINTFLIKE(2, 3) smtp_printf(VSTREAM *, const char *,...); extern int smtp_get(VSTRING *, VSTREAM *, int); extern void smtp_fputs(const char *, int len, VSTREAM *); extern void smtp_fwrite(const char *, int len, VSTREAM *); diff --git a/postfix/html/faq.html b/postfix/html/faq.html index 691b64e0f..f53e7d25b 100644 --- a/postfix/html/faq.html +++ b/postfix/html/faq.html @@ -26,6 +26,8 @@
  • Sendmail incompatibility +
  • Postfix performance +
  • Receiving mail via the network
  • Mail relaying @@ -95,6 +97,14 @@ distribution list +

    Postfix performance

    + +
    +

    Receiving mail via the network

    + +
    + + + +

    IRIX problems translating IP address to string

    + +
    + +
    Question:
    While installing IRIX 6.5.7m on a clean disk +and no special options or software I stumbled upon the following +problem; the inet_ntoa() function seems to return INADDR_NONE +(malformed request?) for every call to it. + +

    + +

    Answer:
    There is an incompatibility between gcc and system +libraries compiled with SGI's cc. See a description in +http://freeware.sgi.com/shared/howto.html. + +

    If you must use gcc, a possible workaround is to use the +inet_ntoa() routine from the BIND source code at http://www.isc.org/. + +

    +
    Up one level | Postfix FAQ diff --git a/postfix/html/motivation.html b/postfix/html/motivation.html index f27c9569a..972da06b7 100644 --- a/postfix/html/motivation.html +++ b/postfix/html/motivation.html @@ -44,8 +44,9 @@ program will go through its life as Postfix instead.

    Postfix is a direct competitor to the -qmail by Dan Bernstein. That's competitor, not enemy. I'm sure -that friendly competition will help to improve both programs. +qmail software by Dan Bernstein. That's competitor, not enemy. +I'm sure that friendly competition will help to improve both +programs.


    diff --git a/postfix/html/pipe.8.html b/postfix/html/pipe.8.html index 0b02333e5..fa0f42390 100644 --- a/postfix/html/pipe.8.html +++ b/postfix/html/pipe.8.html @@ -141,6 +141,11 @@ PIPE(8) PIPE(8) This macro expands to the envelope sender address. + ${size} + This macro expands to Postfix's idea of the + message size, which is an approximation of + the size of the message as delivered. + ${user} This macro expands to the username part of a recipient address. For example, with an @@ -185,12 +190,7 @@ PIPE(8) PIPE(8) transport_destination_concurrency_limit Limit the number of parallel deliveries to the same destination, for delivery via the named transport. - The default limit is taken from the default_desti- - nation_concurrency_limit parameter. The limit is - enforced by the Postfix queue manager. - - transport_destination_recipient_limit - Limit the number of recipients per message + The default limit is taken from the @@ -203,16 +203,21 @@ PIPE(8) PIPE(8) PIPE(8) PIPE(8) - delivery, for delivery via the named transport. The - default limit is taken from the default_destina- - tion_recipient_limit parameter. The limit is + default_destination_concurrency_limit parameter. + The limit is enforced by the Postfix queue manager. + + transport_destination_recipient_limit + Limit the number of recipients per message deliv- + ery, for delivery via the named transport. The + default limit is taken from the default_destina- + tion_recipient_limit parameter. The limit is enforced by the Postfix queue manager. transport_time_limit - Limit the time for delivery to external command, - for delivery via the named transport. The default - limit is taken from the command_time_limit parame- - ter. The limit is enforced by the Postfix queue + Limit the time for delivery to external command, + for delivery via the named transport. The default + limit is taken from the command_time_limit parame- + ter. The limit is enforced by the Postfix queue manager. SEE ALSO @@ -222,7 +227,7 @@ PIPE(8) PIPE(8) syslogd(8) system logging LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) @@ -249,11 +254,6 @@ PIPE(8) PIPE(8) - - - - - diff --git a/postfix/html/uce.html b/postfix/html/uce.html index ce35418fb..d35330a2f 100644 --- a/postfix/html/uce.html +++ b/postfix/html/uce.html @@ -216,9 +216,9 @@ result as another list of UCE restrictions. The -
    reject_maps_rbl
    Reject the request when the client -network address is listed under any of the domains listed in $maps_rbl_domains. The +
    reject_maps_rbl
    Reject the request when the reversed +client network address is listed under any of the domains listed +in $maps_rbl_domains. The maps_rbl_reject_code parameter specifies the response code for rejected requests (default: 554). diff --git a/postfix/lmtp/lmtp.h b/postfix/lmtp/lmtp.h index 241b248d2..0f53c46a7 100644 --- a/postfix/lmtp/lmtp.h +++ b/postfix/lmtp/lmtp.h @@ -86,7 +86,7 @@ typedef struct LMTP_RESP { /* server response */ VSTRING *buf; /* origin of text */ } LMTP_RESP; -extern void lmtp_chat_cmd(LMTP_STATE *, char *,...); +extern void PRINTFLIKE(2, 3) lmtp_chat_cmd(LMTP_STATE *, char *,...); extern LMTP_RESP *lmtp_chat_resp(LMTP_STATE *); extern void lmtp_chat_reset(LMTP_STATE *); extern void lmtp_chat_notify(LMTP_STATE *); @@ -94,10 +94,10 @@ extern void lmtp_chat_notify(LMTP_STATE *); /* * lmtp_trouble.c */ -extern int lmtp_conn_fail(LMTP_STATE *, int, char *,...); -extern int lmtp_site_fail(LMTP_STATE *, int, char *,...); -extern int lmtp_mesg_fail(LMTP_STATE *, int, char *,...); -extern void lmtp_rcpt_fail(LMTP_STATE *, int, RECIPIENT *, char *,...); +extern int PRINTFLIKE(3, 4) lmtp_conn_fail(LMTP_STATE *, int, char *,...); +extern int PRINTFLIKE(3, 4) lmtp_site_fail(LMTP_STATE *, int, char *,...); +extern int PRINTFLIKE(3, 4) lmtp_mesg_fail(LMTP_STATE *, int, char *,...); +extern void PRINTFLIKE(4, 5) lmtp_rcpt_fail(LMTP_STATE *, int, RECIPIENT *, char *,...); extern int lmtp_stream_except(LMTP_STATE *, int, char *); /* diff --git a/postfix/man/man8/pipe.8 b/postfix/man/man8/pipe.8 index 59b3cd028..65ce68a8c 100644 --- a/postfix/man/man8/pipe.8 +++ b/postfix/man/man8/pipe.8 @@ -99,6 +99,9 @@ A command-line argument that contains \fB${\fBrecipient\fR}\fR expands into as many command-line arguments as there are recipients. .IP \fB${\fBsender\fR}\fR This macro expands to the envelope sender address. +.IP \fB${\fBsize\fR}\fR +This macro expands to Postfix's idea of the message size, which +is an approximation of the size of the message as delivered. .IP \fB${\fBuser\fR}\fR This macro expands to the username part of a recipient address. For example, with an address \fIuser+foo@domain\fR the username diff --git a/postfix/nqmgr/qmgr.h b/postfix/nqmgr/qmgr.h index 3872ee35f..a47db71fd 100644 --- a/postfix/nqmgr/qmgr.h +++ b/postfix/nqmgr/qmgr.h @@ -330,7 +330,7 @@ extern void qmgr_defer_recipient(QMGR_MESSAGE *, const char *, const char *); /* * qmgr_bounce.c */ -extern void qmgr_bounce_recipient(QMGR_MESSAGE *, QMGR_RCPT *, const char *,...); +extern void PRINTFLIKE(3, 4) qmgr_bounce_recipient(QMGR_MESSAGE *, QMGR_RCPT *, const char *,...); /* * qmgr_deliver.c diff --git a/postfix/pipe/pipe.c b/postfix/pipe/pipe.c index 78c11a200..e85e328f1 100644 --- a/postfix/pipe/pipe.c +++ b/postfix/pipe/pipe.c @@ -91,6 +91,9 @@ /* expands into as many command-line arguments as there are recipients. /* .IP \fB${\fBsender\fR}\fR /* This macro expands to the envelope sender address. +/* .IP \fB${\fBsize\fR}\fR +/* This macro expands to Postfix's idea of the message size, which +/* is an approximation of the size of the message as delivered. /* .IP \fB${\fBuser\fR}\fR /* This macro expands to the username part of a recipient address. /* For example, with an address \fIuser+foo@domain\fR the username @@ -226,6 +229,7 @@ #define PIPE_DICT_USER "user" /* key */ #define PIPE_DICT_EXTENSION "extension" /* key */ #define PIPE_DICT_MAILBOX "mailbox" /* key */ +#define PIPE_DICT_SIZE "size" /* key */ /* * Flags used to pass back the type of special parameter found by @@ -235,6 +239,7 @@ #define PIPE_FLAG_USER (1<<1) #define PIPE_FLAG_EXTENSION (1<<2) #define PIPE_FLAG_MAILBOX (1<<3) +#define PIPE_FLAG_SIZE (1<<4) /* * Tunable parameters. Values are taken from the config file, after @@ -284,13 +289,15 @@ static int parse_callback(int type, VSTRING *buf, char *context) *expand_flag |= PIPE_FLAG_EXTENSION; else if (strcmp(vstring_str(buf), PIPE_DICT_MAILBOX) == 0) *expand_flag |= PIPE_FLAG_MAILBOX; + else if (strcmp(vstring_str(buf), PIPE_DICT_SIZE) == 0) + *expand_flag |= PIPE_FLAG_SIZE; } return (0); } /* expand_argv - expand macros in the argument vector */ -static ARGV *expand_argv(char **argv, RECIPIENT_LIST *rcpt_list) +static ARGV *expand_argv(char **argv, RECIPIENT_LIST *rcpt_list, long data_size) { VSTRING *buf = vstring_alloc(100); ARGV *result; @@ -387,6 +394,18 @@ static ARGV *expand_argv(char **argv, RECIPIENT_LIST *rcpt_list) lowercase(STR(buf)); dict_update(PIPE_DICT_TABLE, PIPE_DICT_MAILBOX, STR(buf)); } + + /* + * This argument contains $size. + */ + if (expand_flag & PIPE_FLAG_SIZE) { + vstring_sprintf(buf, "%ld", data_size); + dict_update(PIPE_DICT_TABLE, PIPE_DICT_SIZE, STR(buf)); + } + + /* + * Done. + */ argv_add(result, dict_eval(PIPE_DICT_TABLE, *cpp, NO), ARGV_END); } } @@ -670,7 +689,7 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv) dict_update(PIPE_DICT_TABLE, PIPE_DICT_SENDER, request->sender); dict_update(PIPE_DICT_TABLE, PIPE_DICT_NEXTHOP, request->nexthop); - expanded_argv = expand_argv(attr.command, rcpt_list); + expanded_argv = expand_argv(attr.command, rcpt_list, request->data_size); command_status = pipe_command(request->fp, why, PIPE_CMD_UID, attr.uid, diff --git a/postfix/qmgr/qmgr.h b/postfix/qmgr/qmgr.h index 44e6b4fb3..45ceac8e9 100644 --- a/postfix/qmgr/qmgr.h +++ b/postfix/qmgr/qmgr.h @@ -258,7 +258,7 @@ extern void qmgr_defer_recipient(QMGR_MESSAGE *, const char *, const char *); /* * qmgr_bounce.c */ -extern void qmgr_bounce_recipient(QMGR_MESSAGE *, QMGR_RCPT *, const char *,...); +extern void PRINTFLIKE(3, 4) qmgr_bounce_recipient(QMGR_MESSAGE *, QMGR_RCPT *, const char *,...); /* * qmgr_deliver.c diff --git a/postfix/smtp/smtp.h b/postfix/smtp/smtp.h index d73494871..6643944e7 100644 --- a/postfix/smtp/smtp.h +++ b/postfix/smtp/smtp.h @@ -103,7 +103,7 @@ typedef struct SMTP_RESP { /* server response */ VSTRING *buf; /* origin of text */ } SMTP_RESP; -extern void smtp_chat_cmd(SMTP_STATE *, char *,...); +extern void PRINTFLIKE(2, 3) smtp_chat_cmd(SMTP_STATE *, char *,...); extern SMTP_RESP *smtp_chat_resp(SMTP_STATE *); extern void smtp_chat_reset(SMTP_STATE *); extern void smtp_chat_notify(SMTP_STATE *); @@ -111,10 +111,10 @@ extern void smtp_chat_notify(SMTP_STATE *); /* * smtp_trouble.c */ -extern int smtp_conn_fail(SMTP_STATE *, int, char *,...); -extern int smtp_site_fail(SMTP_STATE *, int, char *,...); -extern int smtp_mesg_fail(SMTP_STATE *, int, char *,...); -extern void smtp_rcpt_fail(SMTP_STATE *, int, RECIPIENT *, char *,...); +extern int PRINTFLIKE(3, 4) smtp_conn_fail(SMTP_STATE *, int, char *,...); +extern int PRINTFLIKE(3, 4) smtp_site_fail(SMTP_STATE *, int, char *,...); +extern int PRINTFLIKE(3, 4) smtp_mesg_fail(SMTP_STATE *, int, char *,...); +extern void PRINTFLIKE(4, 5) smtp_rcpt_fail(SMTP_STATE *, int, RECIPIENT *, char *,...); extern int smtp_stream_except(SMTP_STATE *, int, char *); /* diff --git a/postfix/smtpd/smtpd_chat.h b/postfix/smtpd/smtpd_chat.h index a5638b4d7..a2dab070d 100644 --- a/postfix/smtpd/smtpd_chat.h +++ b/postfix/smtpd/smtpd_chat.h @@ -14,7 +14,7 @@ */ extern void smtpd_chat_reset(SMTPD_STATE *); extern void smtpd_chat_query(SMTPD_STATE *); -extern void smtpd_chat_reply(SMTPD_STATE *, char *, ...); +extern void PRINTFLIKE(2, 3) smtpd_chat_reply(SMTPD_STATE *, char *, ...); extern void smtpd_chat_notify(SMTPD_STATE *); /* LICENSE diff --git a/postfix/smtpd/smtpd_check.c b/postfix/smtpd/smtpd_check.c index 03e2ee4fe..e5089b465 100644 --- a/postfix/smtpd/smtpd_check.c +++ b/postfix/smtpd/smtpd_check.c @@ -82,7 +82,7 @@ /* Look up the resolved recipient address in the named access table, /* any parent domains of the recipient domain, and the localpart@. /* .IP reject_maps_rbl -/* Look up the client network address in the real-time blackhole +/* Look up the reversed client network address in the real-time blackhole /* DNS zones below the domains listed in the "maps_rbl_domains" /* configuration parameter. The \fImaps_rbl_reject_code\fR /* configuration parameter specifies the reject status code diff --git a/postfix/util/Makefile.in b/postfix/util/Makefile.in index c0a48c394..89023fd45 100644 --- a/postfix/util/Makefile.in +++ b/postfix/util/Makefile.in @@ -73,7 +73,7 @@ LIB = libutil.a TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \ fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \ inet_addr_host inet_addr_local mac_parse make_dirs msg_syslog \ - mystrtok peer_name sigdelay translit valid_hostname vstream_popen \ + mystrtok sigdelay translit valid_hostname vstream_popen \ vstring vstring_vstream doze select_bug stream_test mac_expand \ watchdog unescape @@ -229,11 +229,6 @@ fifo_trigger: $(LIB) $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS) mv junk $@.o -peer_name: $(LIB) - mv $@.o junk - $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS) - mv junk $@.o - doze: $(LIB) mv $@.o junk $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS) diff --git a/postfix/util/dup2_pass_on_exec.c b/postfix/util/dup2_pass_on_exec.c new file mode 100644 index 000000000..54bca2397 --- /dev/null +++ b/postfix/util/dup2_pass_on_exec.c @@ -0,0 +1,60 @@ +/*++ +/* NAME +/* dup2_pass_on_exec 1 +/* SUMMARY +/* dup2 close-on-exec behaviour test program +/* SYNOPSIS +/* dup2_pass_on_exec +/* DESCRIPTION +/* dup2_pass_on_exec sets the close-on-exec flag on its +/* standard input and then dup2() to duplicate it. +/* Posix-1003.1 specifies in section 6.2.1.2 that dup2(o,n) should behave +/* as: close(n); n = fcntl(o, F_DUPFD, n); as long as o is a valid +/* file-descriptor, n!=o, and 0<=n<=[OPEN_MAX]. +/* Section 6.5.2.2 states that the close-on-exec flag of the result of a +/* successful fcntl(o, F_DUPFD, n) is cleared. +/* +/* At least Ultrix4.3a does not clear the close-on-exec flag of n on +/* dup2(o, n). +/* DIAGNOSTICS +/* Problems are reported to the standard error stream. +/* LICENSE +/* .ad +/* .fi +/* The Secure Mailer license must be distributed with this software. +/* AUTHOR(S) +/* Christian von Roques +/* Forststrasse 71 +/* 76131 Karlsruhe, GERMANY +/*--*/ + +#include +#include + +#define DO(s) if (s < 0) { perror(#s); exit(1); } + +int main(int unused_argc, char **unused_argv) +{ + int res; + + printf("Setting the close-on-exec flag of file-descriptor 0.\n"); + DO(fcntl(0, F_SETFD, 1)); + + printf("Duplicating file-descriptor 0 to 3.\n"); + DO(dup2(0, 3)); + + printf("Testing if the close-on-exec flag of file-descriptor 3 is set.\n"); + DO((res = fcntl(3, F_GETFD, 0))); + if (res & 1) + printf("Yes, a newly dup2()ed file-descriptor has the close-on-exec " + "flag cloned.\n" + "THIS VIOLATES Posix1003.1 section 6.2.1.2 or 6.5.2.2!\n" + "You should #define DUP2_DUPS_CLOSE_ON_EXEC in sys_defs.h " + "for your OS.\n"); + else + printf("No, a newly dup2()ed file-descriptor has the close-on-exec " + "flag cleared.\n" + "This complies with Posix1003.1 section 6.2.1.2 and 6.5.2.2!\n"); + + return 0; +} diff --git a/postfix/util/events.c b/postfix/util/events.c index dc61e97c0..a3921e280 100644 --- a/postfix/util/events.c +++ b/postfix/util/events.c @@ -588,7 +588,7 @@ static void dingdong(char *context) printf("%c", *context); fflush(stdout); *context = (ISUPPER(*context) ? TOLOWER(*context) : TOUPPER(*context)); - event_request_timer(dingdong, context, DELAY); + event_request_timer(dingdong, context, (char *) DELAY); } /* echo - echo text received on stdin */ @@ -608,7 +608,7 @@ main(void) char *cp; for (cp = text; *cp; cp++) - event_request_timer(dingdong, cp, 0); + event_request_timer(dingdong, cp, (char *) 0); event_enable_read(fileno(stdin), echo, (char *) 0); for (;;) event_loop(-1); diff --git a/postfix/util/make_dirs.c b/postfix/util/make_dirs.c index 5fe5e9457..1ca68af13 100644 --- a/postfix/util/make_dirs.c +++ b/postfix/util/make_dirs.c @@ -78,8 +78,12 @@ int make_dirs(const char *path, int perms) ret = -1; break; } - } else if (errno != ENOENT || (ret = mkdir(saved_path, perms)) < 0) - break; + } else { + if (errno != ENOENT) + break; + if ((ret = mkdir(saved_path, perms)) < 0 && errno != EEXIST) + break; + } if (saved_ch != 0) *cp = saved_ch; SKIP_WHILE(*cp == '/', cp); diff --git a/postfix/util/msg.h b/postfix/util/msg.h index 2b62dec5e..fae8a2327 100644 --- a/postfix/util/msg.h +++ b/postfix/util/msg.h @@ -18,11 +18,11 @@ typedef void (*MSG_CLEANUP_FN) (void); extern int msg_verbose; -extern void msg_info(const char *,...); -extern void msg_warn(const char *,...); -extern void msg_error(const char *,...); -extern NORETURN msg_fatal(const char *,...); -extern NORETURN msg_panic(const char *,...); +extern void PRINTFLIKE(1, 2) msg_info(const char *,...); +extern void PRINTFLIKE(1, 2) msg_warn(const char *,...); +extern void PRINTFLIKE(1, 2) msg_error(const char *,...); +extern NORETURN PRINTFLIKE(1, 2) msg_fatal(const char *,...); +extern NORETURN PRINTFLIKE(1, 2) msg_panic(const char *,...); extern int msg_error_limit(int); extern void msg_error_clear(void); diff --git a/postfix/util/msg_output.h b/postfix/util/msg_output.h index b409e9518..2ac4739e0 100644 --- a/postfix/util/msg_output.h +++ b/postfix/util/msg_output.h @@ -21,7 +21,7 @@ */ typedef void (*MSG_OUTPUT_FN) (int, const char *); extern void msg_output(MSG_OUTPUT_FN); -extern void msg_printf(int, const char *,...); +extern void PRINTFLIKE(2, 3) msg_printf(int, const char *,...); extern void msg_vprintf(int, const char *, va_list); extern void msg_text(int, const char *); diff --git a/postfix/util/sys_defs.h b/postfix/util/sys_defs.h index 115b21d06..2a4f73aba 100644 --- a/postfix/util/sys_defs.h +++ b/postfix/util/sys_defs.h @@ -812,6 +812,29 @@ typedef int pid_t; #ifndef NORETURN #define NORETURN void +#endif + + /* + * Turn on format string argument checking. This is more accurate than + * printfck, but it misses #ifdef-ed code. XXX I am just guessing at what + * gcc versions support this. In order to turn this off for some platforms, + * specify #define PRINTFLIKE and #define SCANFLIKE in the system-dependent + * sections above. + */ +#ifndef PRINTFLIKE +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +#define PRINTFLIKE(x,y) __attribute__ ((format (printf, (x), (y)))) +#else +#define PRINTFLIKE +#endif +#endif + +#ifndef SCANFLIKE +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +#define SCANFLIKE(x,y) __attribute__ ((format (scanf, (x), (y)))) +#else +#define SCANFLIKE +#endif #endif /* diff --git a/postfix/util/vstream.h b/postfix/util/vstream.h index 4ae0b5f04..66f926a23 100644 --- a/postfix/util/vstream.h +++ b/postfix/util/vstream.h @@ -111,8 +111,8 @@ extern void vstream_control(VSTREAM *, int,...); #define VSTREAM_CTL_EXCEPT 9 #define VSTREAM_CTL_CONTEXT 10 -extern VSTREAM *vstream_printf(const char *,...); -extern VSTREAM *vstream_fprintf(VSTREAM *, const char *,...); +extern VSTREAM *PRINTFLIKE(1, 2) vstream_printf(const char *,...); +extern VSTREAM *PRINTFLIKE(2, 3) vstream_fprintf(VSTREAM *, const char *,...); extern VSTREAM *vstream_popen(const char *, int); extern VSTREAM *vstream_popen_vargs(int,...); diff --git a/postfix/util/vstring.h b/postfix/util/vstring.h index c1c9eb966..6ae8947e7 100644 --- a/postfix/util/vstring.h +++ b/postfix/util/vstring.h @@ -38,8 +38,8 @@ extern VSTRING *vstring_strcpy(VSTRING *, const char *); extern VSTRING *vstring_strncpy(VSTRING *, const char *, int); extern VSTRING *vstring_strcat(VSTRING *, const char *); extern VSTRING *vstring_strncat(VSTRING *, const char *, int); -extern VSTRING *vstring_sprintf(VSTRING *, const char *,...); -extern VSTRING *vstring_sprintf_append(VSTRING *, const char *,...); +extern VSTRING *PRINTFLIKE(2, 3) vstring_sprintf(VSTRING *, const char *,...); +extern VSTRING *PRINTFLIKE(2, 3) vstring_sprintf_append(VSTRING *, const char *,...); extern char *vstring_export(VSTRING *); extern VSTRING *vstring_import(char *); diff --git a/postfix/util/watchdog.c b/postfix/util/watchdog.c index e712c24e4..da2ac1063 100644 --- a/postfix/util/watchdog.c +++ b/postfix/util/watchdog.c @@ -77,6 +77,7 @@ #include #include #include +#include /* Utility library. */