diff --git a/postfix/HISTORY b/postfix/HISTORY index ebf01fbc1..7d568a39f 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -21013,3 +21013,77 @@ Apologies for any names omitted. Bugfix (introduced: 20141207): in new #ifdef, && should be ||. File: smtpd.c. + +20141210 + + Cleanup: the "inline" table now supports case-insensitive + search, and an iterator. File: util/dict_inline.c. + + Cleanup: minuscule memory leaks in graceful degradation + after lookup table open error. Files: util/dict_inline.c, + util/dict_static.c. + +20141211 + + Cleanup: memory leaks in unit-test driver programs (i.e. + code used only during development). Files: + cleanup/cleanup_milter.c, util/base64_code.c. + + Bugfix (introduced 20141001): mac_expand() error message + with "??" due to dangling pointer. File: util/mac_expand.c. + + Portability: unit-test driver programs. Files: util/myaddrinfo.c, + util/myaddrinfo.ref. + + Portability: Clang support. Files: makedefs, util/sys_defs.h. + + Portability: FreeBSD 10 support. Files: makedefs, + util/sys_defs.h. + + Cleanup: in makedefs, the CC and WARN features are now + independent. File: makedefs. + + Shut up some Clang format-string nags: util/events.c. + + Cleanup: eliminated unnecessary 64->32bit (and back) + conversions on LP64 platforms. Files: util/htable.c, + util/binhash.c util/mvect.[hc], util/name_mask.c, + util/sane_time.c, util/unix_listen.c, util/unix_connect.c, + util/stringops.h, util/trimblanks.c, and dependent code in + smtpd/smtpd_token.c. + + Cleanup: unused inet_proto_init() results. Files: + global/mail_params.c, postconf/postconf_builtin.c, + smtpstone/qmqp-sink.c, smtpstone/qmqp-source.c, + smtpstone/smtp-source.c/ + + Shut up some Clang nags about unused functions in network + interface API selection. File: util/inet_addr_local.c. + + Portability: a historical compiler lacks printf-like + format-string checks for function pointers. Files: util/msg.h, + bounce/bounce_template.h. + +20141212 + + Shut up some Clang format-string nags: util/line_number.c, + sendmail/sendmail.c, smtpd/smtpd_proxy.c, smtp/smtp_sasl_proto.c. + + Cleanup: eliminated unnecessary 64->32bit (and back) + conversions on LP64 platforms. Files: dict_memcache.c, + header_body_checks.[hc], log_adhoc.c, pipe_command.c, + record.[hc], smtp_reply_footer.c, split_addr.c. + cleanup/cleanup_milter.c, master/mail_server.h, + src/master/trigger_server.c, oqmgr/qmgr.c, qmgr/qmgr.c, + pickup/pickup.c. + + Cleanup: nullmx SMTP reply codes 550 and 556, and enhanced + status codes X.1.10 and X.7.27. The nullmx SMTP reply codes + are no longer configurable. Files: global/mail_params.h, + smtpd/smtpd.c, smtpd/smtpd_check.c. + + Portability: default table owner UID for testing. Files: + util/dict_alloc.c, util/dict_open.c. + + Shut up Clang unused assignment nag: global/mail_queue.h. + sendmail/sendmail.c, smtpd/smtpd_proxy.c, smtp/smtp_sasl_proto.c. diff --git a/postfix/WISHLIST b/postfix/WISHLIST index e8fffacab..76d3939bf 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -8,6 +8,10 @@ Wish list: Things to do after the stable release: + Inline support for pcre:{/pattern/=action, ...} and ditto + support for regexp: and cidr: tables. Factor out and reuse + code that already exists in inline: and other tables. + Log command=good/bad statistics in postscreen? Implement smtpd_client_auth_rate limit? diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 88a0ca9e6..95d65ef14 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -14787,7 +14787,7 @@ record or 2) a malformed MX record such as a record with a zero-length MX hostname (Postfix version 2.3 and later).
The reply is specified with the unknown_address_reject_code parameter (default: 450), unknown_address_tempfail_action (default: -defer_if_permit), or nullmx_reject_code (default 556, Postfix 2.12 and +defer_if_permit), or 556 (nullmx, Postfix 2.12 and later). See the respective parameter descriptions for details. @@ -15531,7 +15531,7 @@ record, or 2) a malformed MX record such as a record with a zero-length MX hostname (Postfix version 2.3 and later).
The reply is specified with the unknown_address_reject_code parameter (default: 450), unknown_address_tempfail_action (default: -defer_if_permit), or nullmx_reject_code (default 556, Postfix 2.12 and +defer_if_permit), or 550 (nullmx, Postfix 2.12 and later). See the respective parameter descriptions for details. diff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index 618267d9d..fffa1f2f9 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -1149,13 +1149,6 @@ SMTPD(8) SMTPD(8) reject_unknown_sender_domain or reject_unknown_recipient_domain fail due to a temporary error condition. - Available in Postfix version 2.12 and later: - - nullmx_reject_code (556) - The numerical reply code when the Postfix SMTP server rejects a - sender or recipient address because its domain has a nullmx DNS - record (an MX record with an empty hostname). - MISCELLANEOUS CONTROLS config_directory (see 'postconf -d' output) The default location of the Postfix main.cf and master.cf con- diff --git a/postfix/makedefs b/postfix/makedefs index 27cdf79dc..6d69bb545 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -222,6 +222,15 @@ case "$SYSTEM.$RELEASE" in : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"} : ${PLUGIN_LD="${CC-gcc} -shared"} ;; + FreeBSD.10*) SYSTYPE=FREEBSD10 + : ${CC=cc} + : ${SHLIB_SUFFIX=.so} + : ${SHLIB_CFLAGS=-fPIC} + : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'} + : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'} + : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"} + : ${PLUGIN_LD="${CC} -shared"} + ;; DragonFly.*) SYSTYPE=DRAGONFLY ;; OpenBSD.2*) SYSTYPE=OPENBSD2 @@ -555,7 +564,6 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543 # Use the native compiler by default : ${CC=cc} CCARGS="$CCARGS" - CCWARN='$(WARN)' # Darwin > 1.3 uses awk and flat_namespace case $RELEASE in 1.[0-3]) AWK=gawk;; @@ -998,7 +1006,7 @@ esac # een burned once by a compiler that lies about what warnings it # produces, not taking that chance again. -: ${CC='gcc $(WARN)'} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \ +: ${CC=gcc} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \ ${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \ -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \ -Wunused -Wno-missing-braces'} @@ -1056,7 +1064,7 @@ _AR = $_AR ARFL = $ARFL _RANLIB = $_RANLIB SYSLIBS = $AUXLIBS $SYSLIBS $PLUGIN_AUXLIBS -CC = $CC $CCARGS $CCWARN +CC = $CC $CCARGS \$(WARN) OPT = $OPT DEBUG = $DEBUG AWK = $AWK diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index e1015f464..c06e544df 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -9891,7 +9891,7 @@ a zero-length MX hostname (Postfix version 2.3 and later). The reply is specified with the unknown_address_reject_code parameter (default: 450), unknown_address_tempfail_action (default: -defer_if_permit), or nullmx_reject_code (default 556, Postfix 2.12 and +defer_if_permit), or 556 (nullmx, Postfix 2.12 and later). See the respective parameter descriptions for details. .br .IP "\fBreject_unlisted_recipient\fR (with Postfix version 2.0: check_recipient_maps)" @@ -10471,7 +10471,7 @@ a zero-length MX hostname (Postfix version 2.3 and later). The reply is specified with the unknown_address_reject_code parameter (default: 450), unknown_address_tempfail_action (default: -defer_if_permit), or nullmx_reject_code (default 556, Postfix 2.12 and +defer_if_permit), or 550 (nullmx, Postfix 2.12 and later). See the respective parameter descriptions for details. .br .IP "\fBreject_unlisted_sender\fR" diff --git a/postfix/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index fa0e700ae..b050cc0e4 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -1004,12 +1004,6 @@ fails due to an temporary error condition. The Postfix SMTP server's action when reject_unknown_sender_domain or reject_unknown_recipient_domain fail due to a temporary error condition. -.PP -Available in Postfix version 2.12 and later: -.IP "\fBnullmx_reject_code (556)\fR" -The numerical reply code when the Postfix SMTP server rejects -a sender or recipient address because its domain has a nullmx DNS -record (an MX record with an empty hostname). .SH "MISCELLANEOUS CONTROLS" .na .nf diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index c1e47293e..630f7345b 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -410,7 +410,6 @@ while (<>) { s;\bno_address_mappings\b;$&;g; s;\bno_header_body_checks\b;$&;g; s;\bno_milters\b;$&;g; - s;\bnullmx_reject_code\b;$&;g; s;\brecip[-]*\n* *[]*i[-]*\n* *[]*ent_bcc_maps\b;$&;g; s;\brecip[-]*\n* *[]*i[-]*\n* *[]*ent_canoni[-]*\n* *[]*cal_classes\b;$&;g; s;\brecip[-]*\n* *[]*i[-]*\n* *[]*ent_canoni[-]*\n* *[]*cal_maps\b;$&;g; diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 09a8887c3..9341208db 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -6049,7 +6049,7 @@ record or 2) a malformed MX record such as a record with a zero-length MX hostname (Postfix version 2.3 and later).
The reply is specified with the unknown_address_reject_code parameter (default: 450), unknown_address_tempfail_action (default: -defer_if_permit), or nullmx_reject_code (default 556, Postfix 2.12 and +defer_if_permit), or 556 (nullmx, Postfix 2.12 and later). See the respective parameter descriptions for details. @@ -6518,7 +6518,7 @@ record, or 2) a malformed MX record such as a record with a zero-length MX hostname (Postfix version 2.3 and later).
The reply is specified with the unknown_address_reject_code parameter (default: 450), unknown_address_tempfail_action (default: -defer_if_permit), or nullmx_reject_code (default 556, Postfix 2.12 and +defer_if_permit), or 550 (nullmx, Postfix 2.12 and later). See the respective parameter descriptions for details. diff --git a/postfix/src/bounce/bounce_template.h b/postfix/src/bounce/bounce_template.h index 2927d1328..9bec42973 100644 --- a/postfix/src/bounce/bounce_template.h +++ b/postfix/src/bounce/bounce_template.h @@ -50,7 +50,7 @@ typedef struct BOUNCE_TEMPLATE { #define bounce_template_encoding(t) ((t)->mime_encoding) #define bounce_template_charset(t) ((t)->mime_charset) -typedef int PRINTFLIKE(2, 3) (*BOUNCE_XP_PRN_FN) (VSTREAM *, const char *,...); +typedef int PRINTFPTRLIKE(2, 3) (*BOUNCE_XP_PRN_FN) (VSTREAM *, const char *,...); typedef int (*BOUNCE_XP_PUT_FN) (VSTREAM *, const char *); extern BOUNCE_TEMPLATE *bounce_template_create(const BOUNCE_TEMPLATE *); diff --git a/postfix/src/cleanup/cleanup_milter.c b/postfix/src/cleanup/cleanup_milter.c index 27cbd1cb0..cc60f3595 100644 --- a/postfix/src/cleanup/cleanup_milter.c +++ b/postfix/src/cleanup/cleanup_milter.c @@ -258,7 +258,7 @@ static void cleanup_milter_header_prepend(void *context, int rec_type, /* cleanup_milter_hbc_extend - additional header/body_checks actions */ static char *cleanup_milter_hbc_extend(void *context, const char *command, - int cmd_len, const char *optional_text, + ssize_t cmd_len, const char *optional_text, const char *where, const char *buf, ssize_t buf_len, off_t offset) { @@ -2465,6 +2465,7 @@ int main(int unused_argc, char **argv) } else if (strcmp(argv->argv[0], "close") == 0) { if (*var_milt_head_checks) { cleanup_milter_hbc_finish(state); + myfree(var_milt_head_checks); var_milt_head_checks = ""; } close_queue_file(state); diff --git a/postfix/src/global/dict_memcache.c b/postfix/src/global/dict_memcache.c index 0b87dfb0d..3210d7d69 100644 --- a/postfix/src/global/dict_memcache.c +++ b/postfix/src/global/dict_memcache.c @@ -257,7 +257,7 @@ static int dict_memcache_del(DICT_MC *dict_mc) /* dict_memcache_prepare_key - prepare lookup key */ -static int dict_memcache_prepare_key(DICT_MC *dict_mc, const char *name) +static ssize_t dict_memcache_prepare_key(DICT_MC *dict_mc, const char *name) { /* diff --git a/postfix/src/global/header_body_checks.c b/postfix/src/global/header_body_checks.c index b3ef032c1..f1e6469af 100644 --- a/postfix/src/global/header_body_checks.c +++ b/postfix/src/global/header_body_checks.c @@ -13,7 +13,7 @@ /* void (*prepend) (void *context, int rec_type, /* const char *buf, ssize_t len, off_t offset); /* char *(*extend) (void *context, const char *command, -/* int cmd_len, const char *cmd_args, +/* ssize_t cmd_len, const char *cmd_args, /* const char *where, const char *line, /* ssize_t line_len, off_t offset); /* } HBC_CALL_BACKS; @@ -228,7 +228,7 @@ static char *hbc_action(void *context, HBC_CALL_BACKS *cb, ssize_t line_len, off_t offset) { const char *cmd_args = cmd + strcspn(cmd, " \t"); - int cmd_len = cmd_args - cmd; + ssize_t cmd_len = cmd_args - cmd; char *ret; /* diff --git a/postfix/src/global/header_body_checks.h b/postfix/src/global/header_body_checks.h index f4c642bc4..7a2718e05 100644 --- a/postfix/src/global/header_body_checks.h +++ b/postfix/src/global/header_body_checks.h @@ -36,7 +36,7 @@ typedef struct { typedef struct { void (*logger) (void *, const char *, const char *, const char *, const char *); void (*prepend) (void *, int, const char *, ssize_t, off_t); - char *(*extend) (void *, const char *, int, const char *, const char *, const char *, ssize_t, off_t); + char *(*extend) (void *, const char *, ssize_t, const char *, const char *, const char *, ssize_t, off_t); } HBC_CALL_BACKS; typedef struct { diff --git a/postfix/src/global/log_adhoc.c b/postfix/src/global/log_adhoc.c index 43b3f01fd..ed867f737 100644 --- a/postfix/src/global/log_adhoc.c +++ b/postfix/src/global/log_adhoc.c @@ -76,8 +76,8 @@ * jumping back. */ typedef struct { - int dt_sec; /* make sure it's signed */ - int dt_usec; /* make sure it's signed */ + long dt_sec; /* make sure it's signed */ + long dt_usec; /* make sure it's signed */ } DELTA_TIME; /* log_adhoc - ad-hoc logging */ diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index 18e84abd9..435bfd9bd 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -763,7 +763,6 @@ void mail_params_init() 0, }; const char *cp; - INET_PROTO_INFO *proto_info; /* * Extract compatibility level first, so that we can determine what @@ -795,7 +794,7 @@ void mail_params_init() * What protocols should we attempt to support? The result is stored in * the global inet_proto_table variable. */ - proto_info = inet_proto_init(VAR_INET_PROTOCOLS, var_inet_protocols); + (void) inet_proto_init(VAR_INET_PROTOCOLS, var_inet_protocols); /* * Variables whose defaults are determined at runtime. Some sites use diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 83f2b3631..ffc0fbbfe 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -2145,10 +2145,6 @@ extern int var_non_fqdn_code; #define DEF_UNK_ADDR_CODE 450 extern int var_unk_addr_code; -#define VAR_NULLMX_RCODE "nullmx_reject_code" -#define DEF_NULLMX_RCODE 556 -extern int var_nullmx_rcode; - #define VAR_UNK_ADDR_TF_ACT "unknown_address_tempfail_action" #define DEF_UNK_ADDR_TF_ACT "$" VAR_REJECT_TMPF_ACT extern char *var_unk_addr_tf_act; diff --git a/postfix/src/global/mail_parm_split.c b/postfix/src/global/mail_parm_split.c index 1c54ab015..18aefd367 100644 --- a/postfix/src/global/mail_parm_split.c +++ b/postfix/src/global/mail_parm_split.c @@ -118,6 +118,7 @@ int main(void) argv_free(argv); vstream_fflush(VSTREAM_OUT); } + vstring_free(vp); return (0); } diff --git a/postfix/src/global/mail_queue.h b/postfix/src/global/mail_queue.h index cc0d642cc..7b98f9012 100644 --- a/postfix/src/global/mail_queue.h +++ b/postfix/src/global/mail_queue.h @@ -143,6 +143,8 @@ extern int mail_queue_id_ok(const char *); unsigned long _us_val; \ vstring_strncpy((bp), (zp) - MQID_LG_USEC_PAD, MQID_LG_USEC_PAD); \ MQID_LG_DECODE_USEC(STR(bp), _us_val, _error); \ + if (_error) \ + _us_val = 0; \ (void) MQID_SH_ENCODE_USEC((bp), _us_val); \ } while (0) diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 2755a3914..ec601d24a 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 "20141208" +#define MAIL_RELEASE_DATE "20141213" #define MAIL_VERSION_NUMBER "2.12" #ifdef SNAPSHOT diff --git a/postfix/src/global/pipe_command.c b/postfix/src/global/pipe_command.c index 32a32b010..29c1ffb0d 100644 --- a/postfix/src/global/pipe_command.c +++ b/postfix/src/global/pipe_command.c @@ -393,7 +393,7 @@ int pipe_command(VSTREAM *src, DSN_BUF *why,...) VSTREAM *cmd_in_stream; VSTREAM *cmd_out_stream; char log_buf[VSTREAM_BUFSIZE + 1]; - int log_len; + ssize_t log_len; pid_t pid; int write_status; int write_errno; diff --git a/postfix/src/global/record.c b/postfix/src/global/record.c index 9686d35c8..faa58f445 100644 --- a/postfix/src/global/record.c +++ b/postfix/src/global/record.c @@ -56,7 +56,7 @@ /* int rec_pad(stream, type, len) /* VSTREAM *stream; /* int type; -/* int len; +/* ssize_t len; /* /* REC_SPACE_NEED(buflen, reclen) /* ssize_t buflen; @@ -398,7 +398,7 @@ int rec_fputs(VSTREAM *stream, int type, const char *str) /* rec_pad - write padding record */ -int rec_pad(VSTREAM *stream, int type, int len) +int rec_pad(VSTREAM *stream, int type, ssize_t len) { int width = len - 2; /* type + length */ diff --git a/postfix/src/global/record.h b/postfix/src/global/record.h index c685436b1..8394f6b85 100644 --- a/postfix/src/global/record.h +++ b/postfix/src/global/record.h @@ -38,7 +38,7 @@ extern int rec_put_type(VSTREAM *, int, off_t); extern int PRINTFLIKE(3, 4) rec_fprintf(VSTREAM *, int, const char *,...); extern int rec_fputs(VSTREAM *, int, const char *); extern int rec_goto(VSTREAM *, const char *); -extern int rec_pad(VSTREAM *, int, int); +extern int rec_pad(VSTREAM *, int, ssize_t); #define REC_PUT_BUF(v, t, b) rec_put((v), (t), vstring_str(b), VSTRING_LEN(b)) diff --git a/postfix/src/global/smtp_reply_footer.c b/postfix/src/global/smtp_reply_footer.c index 8f2084821..bd306b408 100644 --- a/postfix/src/global/smtp_reply_footer.c +++ b/postfix/src/global/smtp_reply_footer.c @@ -97,7 +97,7 @@ int smtp_reply_footer(VSTRING *buffer, ssize_t start, char *end; ssize_t dsn_len; int crlf_at_end = 0; - int reply_patch_undo_offs = -1; + ssize_t reply_patch_undo_offs = -1; /* * Sanity check. @@ -158,7 +158,7 @@ int smtp_reply_footer(VSTRING *buffer, ssize_t start, /* Append a clone of the optional enhanced status code. */ if (dsn_len > 0) { VSTRING_SPACE(buffer, dsn_len); - vstring_strncat(buffer, STR(buffer) + start + 4, (int) dsn_len); + vstring_strncat(buffer, STR(buffer) + start + 4, dsn_len); vstring_strcat(buffer, " "); } reply_patch_undo_offs = -1; diff --git a/postfix/src/global/split_addr.c b/postfix/src/global/split_addr.c index 7e7cc27c8..55b699dbd 100644 --- a/postfix/src/global/split_addr.c +++ b/postfix/src/global/split_addr.c @@ -52,7 +52,7 @@ char *split_addr(char *localpart, const char *delimiter_set) { - int len; + ssize_t len; /* * Don't split these, regardless of what the delimiter is. diff --git a/postfix/src/global/uxtext.c b/postfix/src/global/uxtext.c index aade6a8ce..03e5cc138 100644 --- a/postfix/src/global/uxtext.c +++ b/postfix/src/global/uxtext.c @@ -151,9 +151,9 @@ VSTRING *uxtext_unquote_append(VSTRING *unquoted, const char *quoted) for (cp = (const unsigned char *) quoted; (ch = *cp) != 0; cp++) { if (ch == '\\' && cp[1] == 'x' && cp[2] == '{') { - cp += 2; int unicode = 0; + cp += 2; while ((ch = *++cp) != '}') { if (ISDIGIT(ch)) unicode = (unicode << 4) + (ch - '0'); diff --git a/postfix/src/master/mail_server.h b/postfix/src/master/mail_server.h index 60b79e3a5..cdd946943 100644 --- a/postfix/src/master/mail_server.h +++ b/postfix/src/master/mail_server.h @@ -72,7 +72,7 @@ extern int event_server_drain(void); /* * trigger_server.c */ -typedef void (*TRIGGER_SERVER_FN) (char *, int, char *, char **); +typedef void (*TRIGGER_SERVER_FN) (char *, ssize_t, char *, char **); extern NORETURN trigger_server_main(int, char **, TRIGGER_SERVER_FN,...); #define TRIGGER_BUF_SIZE 1024 diff --git a/postfix/src/master/trigger_server.c b/postfix/src/master/trigger_server.c index ffa5e31a9..ef545eec2 100644 --- a/postfix/src/master/trigger_server.c +++ b/postfix/src/master/trigger_server.c @@ -263,7 +263,7 @@ static void trigger_server_timeout(int unused_event, void *unused_context) static void trigger_server_wakeup(int fd) { char buf[TRIGGER_BUF_SIZE]; - int len; + ssize_t len; /* * Commit suicide when the master process disconnected from us. Don't @@ -423,7 +423,7 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,.. MAIL_SERVER_LOOP_FN loop = 0; int key; char buf[TRIGGER_BUF_SIZE]; - int len; + ssize_t len; char *transport = 0; char *lock_path; VSTRING *why; diff --git a/postfix/src/oqmgr/qmgr.c b/postfix/src/oqmgr/qmgr.c index 59e020fe4..daef4cea7 100644 --- a/postfix/src/oqmgr/qmgr.c +++ b/postfix/src/oqmgr/qmgr.c @@ -413,7 +413,7 @@ static void qmgr_deferred_run_event(int unused_event, void *dummy) /* qmgr_trigger_event - respond to external trigger(s) */ -static void qmgr_trigger_event(char *buf, int len, +static void qmgr_trigger_event(char *buf, ssize_t len, char *unused_service, char **argv) { int incoming_flag = 0; @@ -477,7 +477,7 @@ static void qmgr_trigger_event(char *buf, int len, static int qmgr_loop(char *unused_name, char **unused_argv) { char *path; - int token_count; + ssize_t token_count; int feed = 0; int scan_idx; /* Priority order scan index */ static int first_scan_idx = QMGR_SCAN_IDX_INCOMING; diff --git a/postfix/src/pickup/pickup.c b/postfix/src/pickup/pickup.c index 02f1608f4..27a86543d 100644 --- a/postfix/src/pickup/pickup.c +++ b/postfix/src/pickup/pickup.c @@ -509,7 +509,7 @@ static void pickup_free(PICKUP_INFO *info) /* pickup_service - service client */ -static void pickup_service(char *unused_buf, int unused_len, +static void pickup_service(char *unused_buf, ssize_t unused_len, char *unused_service, char **argv) { SCAN_DIR *scan; diff --git a/postfix/src/postconf/postconf_builtin.c b/postfix/src/postconf/postconf_builtin.c index 9be370880..a966ebaec 100644 --- a/postfix/src/postconf/postconf_builtin.c +++ b/postfix/src/postconf/postconf_builtin.c @@ -237,7 +237,6 @@ static const char *pcf_check_mydomainname(void) static const char *pcf_mynetworks(void) { static const char *networks; - INET_PROTO_INFO *proto_info; const char *junk; /* @@ -269,7 +268,7 @@ static const char *pcf_mynetworks(void) DEF_INET_PROTOCOLS, (PCF_MASTER_ENT *) 0); var_inet_protocols = mystrdup(junk); - proto_info = inet_proto_init(VAR_INET_PROTOCOLS, var_inet_protocols); + (void) inet_proto_init(VAR_INET_PROTOCOLS, var_inet_protocols); } return (networks = mystrdup(mynetworks())); } diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index 2d8a1abe1..7e5076ccc 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -501,11 +501,11 @@ int main(int argc, char **argv) * effect. */ if (var_compat_level < CUR_COMPAT_LEVEL) { - msg_warn("Postfix is running with backwards-compatible default " + msg_info("Postfix is running with backwards-compatible default " "settings"); - msg_warn("See http://www.postfix.org/COMPATIBILITY_README.html " + msg_info("See http://www.postfix.org/COMPATIBILITY_README.html " "for details"); - msg_warn("To disable backwards compatibility use \"postconf " + msg_info("To disable backwards compatibility use \"postconf " VAR_COMPAT_LEVEL "=%d\" and \"postfix reload\"", CUR_COMPAT_LEVEL); } diff --git a/postfix/src/qmgr/qmgr.c b/postfix/src/qmgr/qmgr.c index 75a98633f..b8954e348 100644 --- a/postfix/src/qmgr/qmgr.c +++ b/postfix/src/qmgr/qmgr.c @@ -473,7 +473,7 @@ static void qmgr_deferred_run_event(int unused_event, void *dummy) /* qmgr_trigger_event - respond to external trigger(s) */ -static void qmgr_trigger_event(char *buf, int len, +static void qmgr_trigger_event(char *buf, ssize_t len, char *unused_service, char **argv) { int incoming_flag = 0; @@ -537,7 +537,7 @@ static void qmgr_trigger_event(char *buf, int len, static int qmgr_loop(char *unused_name, char **unused_argv) { char *path; - int token_count; + ssize_t token_count; int feed = 0; int scan_idx; /* Priority order scan index */ static int first_scan_idx = QMGR_SCAN_IDX_INCOMING; diff --git a/postfix/src/sendmail/sendmail.c b/postfix/src/sendmail/sendmail.c index cb53818d2..f8ce7dfdb 100644 --- a/postfix/src/sendmail/sendmail.c +++ b/postfix/src/sendmail/sendmail.c @@ -900,7 +900,7 @@ static void enqueue(const int flags, const char *encoding, if (rcpt_count == 0) msg_fatal_status(EX_USAGE, (flags & SM_FLAG_XRCPT) ? "%s(%ld): No recipient addresses found in message header" : - "Recipient addresses must be specified on" + "%s(%ld): Recipient addresses must be specified on" " the command line or via the -t option", saved_sender, (long) uid); diff --git a/postfix/src/smtp/smtp_sasl_proto.c b/postfix/src/smtp/smtp_sasl_proto.c index fa6366095..c49e85cab 100644 --- a/postfix/src/smtp/smtp_sasl_proto.c +++ b/postfix/src/smtp/smtp_sasl_proto.c @@ -138,7 +138,7 @@ void smtp_sasl_helo_auth(SMTP_SESSION *session, const char *words) session->sasl_mechanism_list = mystrdup(mech_list); } else { msg_warn(*words ? "%s offered no supported AUTH mechanisms: '%s'" : - "%s offered null AUTH mechanism list", + "%s offered null AUTH mechanism list%s", session->namaddrport, words); } session->features |= SMTP_FEATURE_AUTH; diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 8d827305b..0444866a6 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -948,12 +948,6 @@ /* The Postfix SMTP server's action when reject_unknown_sender_domain /* or reject_unknown_recipient_domain fail due to a temporary error /* condition. -/* .PP -/* Available in Postfix version 2.12 and later: -/* .IP "\fBnullmx_reject_code (556)\fR" -/* The numerical reply code when the Postfix SMTP server rejects -/* a sender or recipient address because its domain has a nullmx DNS -/* record (an MX record with an empty hostname). /* MISCELLANEOUS CONTROLS /* .ad /* .fi @@ -1328,7 +1322,6 @@ char *var_smtpd_tls_eckey_file; bool var_smtpd_peername_lookup; int var_plaintext_code; -int var_nullmx_rcode; bool var_smtpd_delay_open; char *var_smtpd_milters; int var_milt_conn_time; @@ -5542,7 +5535,6 @@ int main(int argc, char **argv) VAR_VIRT_MAILBOX_CODE, DEF_VIRT_MAILBOX_CODE, &var_virt_mailbox_code, 0, 0, VAR_RELAY_RCPT_CODE, DEF_RELAY_RCPT_CODE, &var_relay_rcpt_code, 0, 0, VAR_PLAINTEXT_CODE, DEF_PLAINTEXT_CODE, &var_plaintext_code, 0, 0, - VAR_NULLMX_RCODE, DEF_NULLMX_RCODE, &var_nullmx_rcode, 0, 0, VAR_SMTPD_CRATE_LIMIT, DEF_SMTPD_CRATE_LIMIT, &var_smtpd_crate_limit, 0, 0, VAR_SMTPD_CCONN_LIMIT, DEF_SMTPD_CCONN_LIMIT, &var_smtpd_cconn_limit, 0, 0, VAR_SMTPD_CMAIL_LIMIT, DEF_SMTPD_CMAIL_LIMIT, &var_smtpd_cmail_limit, 0, 0, diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 5ef8297e9..8e61bfca2 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -1441,9 +1441,10 @@ static int reject_unknown_mailhost(SMTPD_STATE *state, const char *name, } if (dns_status == DNS_NULLMX) return (smtpd_check_reject(state, MAIL_ERROR_POLICY, - var_nullmx_rcode, strcmp(reply_class, SMTPD_NAME_SENDER) == 0 ? - "4.7.0" : "4.1.0", + 550 : 556, + strcmp(reply_class, SMTPD_NAME_SENDER) == 0 ? + "4.7.27" : "4.1.10", "<%s>: %s rejected: Domain %s " "does not accept mail (nullMX)", reply_name, reply_class, name)); @@ -5586,7 +5587,6 @@ int var_smtpd_rej_unl_rcpt; int var_plaintext_code; bool var_smtpd_peername_lookup; bool var_smtpd_client_port_log; -int var_nullmx_rcode; char *var_smtpd_dns_re_filter; #define int_table test_int_table @@ -5622,7 +5622,6 @@ static const INT_TABLE int_table[] = { VAR_PLAINTEXT_CODE, DEF_PLAINTEXT_CODE, &var_plaintext_code, VAR_SMTPD_PEERNAME_LOOKUP, DEF_SMTPD_PEERNAME_LOOKUP, &var_smtpd_peername_lookup, VAR_SMTPD_CLIENT_PORT_LOG, DEF_SMTPD_CLIENT_PORT_LOG, &var_smtpd_client_port_log, - VAR_NULLMX_RCODE, DEF_NULLMX_RCODE, &var_nullmx_rcode, 0, }; diff --git a/postfix/src/smtpd/smtpd_dns_filter.ref b/postfix/src/smtpd/smtpd_dns_filter.ref index bbcae0b75..f3c9bf98e 100644 --- a/postfix/src/smtpd/smtpd_dns_filter.ref +++ b/postfix/src/smtpd/smtpd_dns_filter.ref @@ -83,8 +83,8 @@ OK OK >>> # EXPECT reject (nullmx is not filtered). >>> mail user@nullmx.porcupine.org -./smtpd_check: : reject: MAIL from localhost[127.0.0.1]: 556 5.7.0 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= proto=SMTP helo= -556 5.7.0 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) +./smtpd_check: : reject: MAIL from localhost[127.0.0.1]: 550 5.7.27 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= proto=SMTP helo= +550 5.7.27 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) >>> # EXPECT reject (nxdomain is not filtered). >>> mail user@nxdomain.porcupine.org ./smtpd_check: : reject: MAIL from localhost[127.0.0.1]: 450 4.1.8 : Sender address rejected: Domain not found; from= proto=SMTP helo= @@ -114,8 +114,8 @@ OK 450 4.1.8 : Sender address rejected: Domain not found >>> # EXPECT reject (nullmx is not filtered). >>> mail user@nullmx.porcupine.org -./smtpd_check: : reject: MAIL from localhost[127.0.0.1]: 556 5.7.0 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= proto=SMTP helo= -556 5.7.0 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) +./smtpd_check: : reject: MAIL from localhost[127.0.0.1]: 550 5.7.27 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= proto=SMTP helo= +550 5.7.27 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) >>> # EXPECT reject (nxdomain is not filtered). >>> mail user@nxdomain.porcupine.org ./smtpd_check: : reject: MAIL from localhost[127.0.0.1]: 450 4.1.8 : Sender address rejected: Domain not found; from= proto=SMTP helo= diff --git a/postfix/src/smtpd/smtpd_nullmx.ref b/postfix/src/smtpd/smtpd_nullmx.ref index e2b5a2fa5..4cc258e3b 100644 --- a/postfix/src/smtpd/smtpd_nullmx.ref +++ b/postfix/src/smtpd/smtpd_nullmx.ref @@ -46,8 +46,8 @@ OK ./smtpd_check: : reject: MAIL from spike.porcupine.org[168.100.189.2]: 450 4.1.8 : Sender address rejected: Domain not found; from= proto=SMTP helo= 450 4.1.8 : Sender address rejected: Domain not found >>> mail sname@nullmx.porcupine.org -./smtpd_check: : reject: MAIL from spike.porcupine.org[168.100.189.2]: 556 5.7.0 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= proto=SMTP helo= -556 5.7.0 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) +./smtpd_check: : reject: MAIL from spike.porcupine.org[168.100.189.2]: 550 5.7.27 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= proto=SMTP helo= +550 5.7.27 : Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) >>> mail sname@spike.porcupine.org OK >>> # @@ -75,8 +75,8 @@ OK >>> relay_domains nullmx.porcupine.org OK >>> rcpt rname@nullmx.porcupine.org -./smtpd_check: : reject: RCPT from spike.porcupine.org[168.100.189.2]: 556 5.1.0 : Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= to= proto=SMTP helo= -556 5.1.0 : Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) +./smtpd_check: : reject: RCPT from spike.porcupine.org[168.100.189.2]: 556 5.1.10 : Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from= to= proto=SMTP helo= +556 5.1.10 : Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX) >>> relay_domains spike.porcupine.org OK >>> rcpt rname@spike.porcupine.org diff --git a/postfix/src/smtpd/smtpd_proxy.c b/postfix/src/smtpd/smtpd_proxy.c index e60559990..8a6bffb3a 100644 --- a/postfix/src/smtpd/smtpd_proxy.c +++ b/postfix/src/smtpd/smtpd_proxy.c @@ -202,7 +202,6 @@ #include #include #include -#include /* null_format_string */ #include #include #include @@ -241,7 +240,6 @@ static int smtpd_proxy_rec_put(VSTREAM *, int, const char *, ssize_t); */ #define STR(x) vstring_str(x) #define LEN(x) VSTRING_LEN(x) -#define SMTPD_PROXY_CONN_FMT null_format_string #define STREQ(x, y) (strcmp((x), (y)) == 0) /* smtpd_proxy_xforward_flush - flush forwarding information */ @@ -364,7 +362,7 @@ static int smtpd_proxy_connect(SMTPD_STATE *state) * back a negative greeting banner: the proxy open is delayed to the * point that the client expects a MAIL FROM or RCPT TO reply. */ - if (smtpd_proxy_cmd(state, SMTPD_PROX_WANT_OK, SMTPD_PROXY_CONN_FMT)) { + if (smtpd_proxy_cmd(state, SMTPD_PROX_WANT_OK, "%s", "")) { smtpd_proxy_fake_server_reply(state, CLEANUP_STAT_PROXY); smtpd_proxy_close(state); return (-1); @@ -627,8 +625,7 @@ static int smtpd_proxy_replay_send(SMTPD_STATE *state) case REC_TYPE_FROM: if (expect == SMTPD_PROX_WANT_BAD) msg_panic("%s: missing server reply type", myname); - if (smtpd_proxy_cmd(state, expect, *STR(replay_buf) ? "%s" : - SMTPD_PROXY_CONN_FMT, STR(replay_buf)) < 0) + if (smtpd_proxy_cmd(state, expect, "%s", STR(replay_buf)) < 0) return (-1); expect = SMTPD_PROX_WANT_BAD; break; @@ -672,11 +669,8 @@ static int PRINTFLIKE(3, 4) smtpd_proxy_save_cmd(SMTPD_STATE *state, int expect, /* * The command can be omitted at the start of an SMTP session. This is * not documented as part of the official interface because it is used - * only internally to this module. Use an explicit null string in case - * the SMTPD_PROXY_CONN_FMT implementation details change. + * only internally to this module. */ - if (fmt == SMTPD_PROXY_CONN_FMT) - fmt = ""; /* * Save the command to the replay log, and send it to the before-queue @@ -712,19 +706,19 @@ static int smtpd_proxy_cmd(SMTPD_STATE *state, int expect, const char *fmt,...) return (smtpd_proxy_rdwr_error(state, err)); } + /* + * Format the command. + */ + va_start(ap, fmt); + vstring_vsprintf(proxy->request, fmt, ap); + va_end(ap); + /* * The command can be omitted at the start of an SMTP session. This is * not documented as part of the official interface because it is used * only internally to this module. */ - if (fmt != SMTPD_PROXY_CONN_FMT) { - - /* - * Format the command. - */ - va_start(ap, fmt); - vstring_vsprintf(proxy->request, fmt, ap); - va_end(ap); + if (LEN(proxy->request) > 0) { /* * Optionally log the command first, so that we can see in the log @@ -807,7 +801,7 @@ static int smtpd_proxy_cmd(SMTPD_STATE *state, int expect, const char *fmt,...) */ if (expect != SMTPD_PROX_WANT_ANY && expect != *STR(proxy->reply)) { msg_warn("proxy %s rejected \"%s\": \"%s\"", - proxy->service_name, fmt == SMTPD_PROXY_CONN_FMT ? + proxy->service_name, LEN(proxy->request) == 0 ? "connection request" : STR(proxy->request), STR(proxy->reply)); if (*STR(proxy->reply) == SMTPD_PROX_WANT_OK diff --git a/postfix/src/smtpd/smtpd_token.c b/postfix/src/smtpd/smtpd_token.c index 7180317c4..927088f62 100644 --- a/postfix/src/smtpd/smtpd_token.c +++ b/postfix/src/smtpd/smtpd_token.c @@ -161,7 +161,7 @@ static char *smtp_next_token(char *cp, SMTPD_TOKEN *arg) /* smtpd_token_init - initialize token structures */ -static void smtpd_token_init(char *ptr, int count) +static void smtpd_token_init(char *ptr, ssize_t count) { SMTPD_TOKEN *arg; int n; diff --git a/postfix/src/smtpstone/qmqp-sink.c b/postfix/src/smtpstone/qmqp-sink.c index e1aa75a2e..6c1d2cff0 100644 --- a/postfix/src/smtpstone/qmqp-sink.c +++ b/postfix/src/smtpstone/qmqp-sink.c @@ -251,7 +251,6 @@ int main(int argc, char **argv) int ch; int ttl; const char *protocols = INET_PROTO_NAME_ALL; - INET_PROTO_INFO *proto_info; /* * Fingerprint executables and core dumps. @@ -302,7 +301,7 @@ int main(int argc, char **argv) /* * Initialize. */ - proto_info = inet_proto_init("protocols", protocols); + (void) inet_proto_init("protocols", protocols); buffer = vstring_alloc(1024); if (strncmp(argv[optind], "unix:", 5) == 0) { sock = unix_listen(argv[optind] + 5, backlog, BLOCKING); diff --git a/postfix/src/smtpstone/qmqp-source.c b/postfix/src/smtpstone/qmqp-source.c index 71e34ee4b..a7da5c0b8 100644 --- a/postfix/src/smtpstone/qmqp-source.c +++ b/postfix/src/smtpstone/qmqp-source.c @@ -471,7 +471,6 @@ int main(int argc, char **argv) struct addrinfo *res; int aierr; const char *protocols = INET_PROTO_NAME_ALL; - INET_PROTO_INFO *proto_info; /* * Fingerprint executables and core dumps. @@ -555,7 +554,7 @@ int main(int argc, char **argv) /* * Translate endpoint address to internal form. */ - proto_info = inet_proto_init("protocols", protocols); + (void) inet_proto_init("protocols", protocols); if (strncmp(argv[optind], "unix:", 5) == 0) { path = argv[optind] + 5; path_len = strlen(path); diff --git a/postfix/src/smtpstone/smtp-source.c b/postfix/src/smtpstone/smtp-source.c index c318f564f..f19d284de 100644 --- a/postfix/src/smtpstone/smtp-source.c +++ b/postfix/src/smtpstone/smtp-source.c @@ -949,7 +949,6 @@ int main(int argc, char **argv) struct addrinfo *res; int aierr; const char *protocols = INET_PROTO_NAME_ALL; - INET_PROTO_INFO *proto_info; char *message_file = 0; /* @@ -1102,7 +1101,7 @@ int main(int argc, char **argv) /* * Translate endpoint address to internal form. */ - proto_info = inet_proto_init("protocols", protocols); + (void) inet_proto_init("protocols", protocols); if (strncmp(argv[optind], "unix:", 5) == 0) { path = argv[optind] + 5; path_len = strlen(path); diff --git a/postfix/src/util/base64_code.c b/postfix/src/util/base64_code.c index c7d745ecb..e60721886 100644 --- a/postfix/src/util/base64_code.c +++ b/postfix/src/util/base64_code.c @@ -220,6 +220,8 @@ int main(int unused_argc, char **unused_argv) if (STR(b2)[n] != test[n]) msg_panic("bad decode value %d != %d", (unsigned char) STR(b2)[n], (unsigned char) test[n]); + vstring_free(b1); + vstring_free(b2); return (0); } diff --git a/postfix/src/util/binhash.c b/postfix/src/util/binhash.c index d52fb3a99..ef8900dcc 100644 --- a/postfix/src/util/binhash.c +++ b/postfix/src/util/binhash.c @@ -124,7 +124,7 @@ /* binhash_hash - hash a string */ -static unsigned binhash_hash(const void *key, ssize_t len, size_t size) +static size_t binhash_hash(const void *key, ssize_t len, size_t size) { size_t h = 0; size_t g; @@ -187,7 +187,7 @@ static void binhash_grow(BINHASH *table) { BINHASH_INFO *ht; BINHASH_INFO *next; - unsigned old_size = table->size; + ssize_t old_size = table->size; BINHASH_INFO **h = table->data; BINHASH_INFO **old_entries = h; @@ -279,7 +279,7 @@ void binhash_delete(BINHASH *table, const void *key, ssize_t key_len, void (* void binhash_free(BINHASH *table, void (*free_fn) (void *)) { if (table != 0) { - size_t i = table->size; + ssize_t i = table->size; BINHASH_INFO *ht; BINHASH_INFO *next; BINHASH_INFO **h = table->data; @@ -304,7 +304,7 @@ void binhash_free(BINHASH *table, void (*free_fn) (void *)) void binhash_walk(BINHASH *table, void (*action) (BINHASH_INFO *, void *), void *ptr) { if (table != 0) { - size_t i = table->size; + ssize_t i = table->size; BINHASH_INFO **h = table->data; BINHASH_INFO *ht; diff --git a/postfix/src/util/dict_alloc.c b/postfix/src/util/dict_alloc.c index 9a19b918d..f370569a8 100644 --- a/postfix/src/util/dict_alloc.c +++ b/postfix/src/util/dict_alloc.c @@ -151,7 +151,7 @@ DICT *dict_alloc(const char *dict_type, const char *dict_name, ssize_t size) dict->mtime = 0; dict->fold_buf = 0; dict->owner.status = DICT_OWNER_UNKNOWN; - dict->owner.uid = ~0; + dict->owner.uid = INT_MAX; dict->error = DICT_ERR_NONE; dict->jbuf = 0; return dict; diff --git a/postfix/src/util/dict_inline.c b/postfix/src/util/dict_inline.c index 8a97f7e1a..af646007c 100644 --- a/postfix/src/util/dict_inline.c +++ b/postfix/src/util/dict_inline.c @@ -46,16 +46,72 @@ typedef struct { DICT dict; /* generic members */ HTABLE *table; /* lookup table */ + HTABLE_INFO **info; /* for iterator */ + HTABLE_INFO **cursor; /* ditto */ } DICT_INLINE; /* dict_inline_lookup - search inline table */ -static const char *dict_inline_lookup(DICT *dict, const char *query) +static const char *dict_inline_lookup(DICT *dict, const char *name) { DICT_INLINE *dict_inline = (DICT_INLINE *) dict; + const char *result = 0; - DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE, - htable_find(dict_inline->table, query)); + /* + * Optionally fold the key. + */ + if (dict->flags & DICT_FLAG_FOLD_FIX) { + if (dict->fold_buf == 0) + dict->fold_buf = vstring_alloc(10); + vstring_strcpy(dict->fold_buf, name); + name = lowercase(vstring_str(dict->fold_buf)); + } + + /* + * Look up the value. + */ + result = htable_find(dict_inline->table, name); + + DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE, result); +} + +/* dict_inline_sequence - traverse the dictionary */ + +static int dict_inline_sequence(DICT *dict, int function, + const char **key, const char **value) +{ + const char *myname = "dict_inline_sequence"; + DICT_INLINE *dict_inline = (DICT_INLINE *) dict; + + /* + * Determine and execute the seek function. + */ + switch (function) { + case DICT_SEQ_FUN_FIRST: + if (dict_inline->info == 0) + dict_inline->info = htable_list(dict_inline->table); + dict_inline->cursor = dict_inline->info; + break; + case DICT_SEQ_FUN_NEXT: + if (dict_inline->cursor[0]) + dict_inline->cursor += 1; + break; + default: + msg_panic("%s: invalid function: %d", myname, function); + } + + /* + * Return the entry under the cursor. + */ + if (dict_inline->cursor[0]) { + *key = dict_inline->cursor[0]->key; + *value = dict_inline->cursor[0]->value; + DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE, DICT_STAT_SUCCESS); + } else { + *key = 0; + *value = 0; + DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE, DICT_STAT_FAIL); + } } /* dict_inline_close - disassociate from inline table */ @@ -65,6 +121,10 @@ static void dict_inline_close(DICT *dict) DICT_INLINE *dict_inline = (DICT_INLINE *) dict; htable_free(dict_inline->table, myfree); + if (dict_inline->info) + myfree((void *) dict_inline->info); + if (dict->fold_buf) + vstring_free(dict->fold_buf); dict_free(dict); } @@ -78,16 +138,20 @@ DICT *dict_inline_open(const char *name, int open_flags, int dict_flags) HTABLE *table = 0; char *nameval, *vname, *value; const char *err = 0; + char *xperr = 0; /* * Clarity first. Let the optimizer worry about redundant code. */ #define DICT_INLINE_RETURN(x) do { \ + DICT *__d = (x); \ if (saved_name != 0) \ myfree(saved_name); \ + if (xperr != 0) \ + myfree(xperr); \ if (table != 0) \ htable_free(table, myfree); \ - return (x); \ + return (__d); \ } while (0) /* @@ -114,7 +178,7 @@ DICT *dict_inline_open(const char *name, int open_flags, int dict_flags) table = htable_create(5); while ((nameval = mystrtokq(&cp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) { if ((nameval[0] != CHARS_BRACE[0] - || (err = extpar(&nameval, CHARS_BRACE, EXTPAR_FLAG_STRIP)) == 0) + || (err = xperr = extpar(&nameval, CHARS_BRACE, EXTPAR_FLAG_STRIP)) == 0) && (err = split_nameval(nameval, &vname, &value)) != 0) break; (void) htable_enter(table, vname, mystrdup(value)); @@ -134,9 +198,13 @@ DICT *dict_inline_open(const char *name, int open_flags, int dict_flags) dict_inline = (DICT_INLINE *) dict_alloc(DICT_TYPE_INLINE, name, sizeof(*dict_inline)); dict_inline->dict.lookup = dict_inline_lookup; + dict_inline->dict.sequence = dict_inline_sequence; dict_inline->dict.close = dict_inline_close; dict_inline->dict.flags = dict_flags | DICT_FLAG_FIXED; dict_inline->dict.owner.status = DICT_OWNER_TRUSTED; + if (dict_flags & DICT_FLAG_FOLD_FIX) + dict_inline->dict.fold_buf = vstring_alloc(10); + dict_inline->info = 0; dict_inline->table = table; table = 0; DICT_INLINE_RETURN(DICT_DEBUG (&dict_inline->dict)); diff --git a/postfix/src/util/dict_inline.ref b/postfix/src/util/dict_inline.ref index 0014d93de..771ca9f6a 100644 --- a/postfix/src/util/dict_inline.ref +++ b/postfix/src/util/dict_inline.ref @@ -1,14 +1,14 @@ ./dict_open: error: empty table: "inline:{ }"; need "inline:{name=value...}" -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) ./dict_open: error: missing '=' after attribute name: "inline:{ foo = xx }"; need "inline:{name=value...}" -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) ./dict_open: error: bad syntax: "inline:{ foo=xx }x"; need "inline:{name=value...}" -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) ./dict_open: error: bad syntax: "inline:{ foo=xx x"; need "inline:{name=value...}" -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) ./dict_open: error: syntax error after '}' in "{x=y}x": "inline:{ foo=xx {x=y}x}"; need "inline:{name=value...}" -owner=trusted (uid=-1) -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) +owner=trusted (uid=2147483647) > get foo foo=xx > get bar diff --git a/postfix/src/util/dict_lmdb.c b/postfix/src/util/dict_lmdb.c index f22f16d14..2df583088 100644 --- a/postfix/src/util/dict_lmdb.c +++ b/postfix/src/util/dict_lmdb.c @@ -131,7 +131,8 @@ static const char *dict_lmdb_lookup(DICT *dict, const char *name) MDB_val mdb_key; MDB_val mdb_value; const char *result = 0; - int status, klen; + int status; + ssize_t klen; dict->error = 0; klen = strlen(name); @@ -305,7 +306,8 @@ static int dict_lmdb_delete(DICT *dict, const char *name) { DICT_LMDB *dict_lmdb = (DICT_LMDB *) dict; MDB_val mdb_key; - int status = 1, klen; + int status = 1; + ssize_t klen; dict->error = 0; klen = strlen(name); diff --git a/postfix/src/util/dict_static.c b/postfix/src/util/dict_static.c index 445f3cb37..d5fa0a6ce 100644 --- a/postfix/src/util/dict_static.c +++ b/postfix/src/util/dict_static.c @@ -60,7 +60,7 @@ static void dict_static_close(DICT *dict) DICT *dict_static_open(const char *name, int open_flags, int dict_flags) { DICT *dict; - const char *err; + char *err = 0; char *cp, *saved_name = 0; /* @@ -70,6 +70,8 @@ DICT *dict_static_open(const char *name, int open_flags, int dict_flags) DICT *__d = (d); \ if (saved_name != 0) \ myfree(saved_name); \ + if (err != 0) \ + myfree(err); \ return (__d); \ } while (0) diff --git a/postfix/src/util/dict_static.ref b/postfix/src/util/dict_static.ref index 0c3de56c1..550264a0d 100644 --- a/postfix/src/util/dict_static.ref +++ b/postfix/src/util/dict_static.ref @@ -1,13 +1,13 @@ -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo foo=fooxx > get bar bar=fooxx ./dict_open: error: bad static:name syntax: missing '}' in "{ foo xx " -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) ./dict_open: error: bad static:name syntax: syntax error after '}' in "{ foo xx }x" -owner=trusted (uid=-1) -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) +owner=trusted (uid=2147483647) > get foo foo=foo xx > get bar diff --git a/postfix/src/util/events.c b/postfix/src/util/events.c index e726be8cb..c2157bb04 100644 --- a/postfix/src/util/events.c +++ b/postfix/src/util/events.c @@ -610,8 +610,12 @@ static void event_extend(int fd) int new_slots = (event_fdslots > fd / 2 ? 2 * old_slots : fd + EVENT_ALLOC_INCR); EVENT_FDTABLE *fdp; + +#ifdef EVENT_REG_UPD_HANDLE int err; +#endif + if (msg_verbose > 2) msg_info("%s: fd %d", myname, fd); event_fdtable = (EVENT_FDTABLE *) diff --git a/postfix/src/util/format_tv.c b/postfix/src/util/format_tv.c index e555cb3c7..641461902 100644 --- a/postfix/src/util/format_tv.c +++ b/postfix/src/util/format_tv.c @@ -8,8 +8,8 @@ /* /* VSTRING *format_tv(buffer, sec, usec, sig_dig, max_dig) /* VSTRING *buffer; -/* int sec; -/* int usec; +/* long sec; +/* long usec; /* int sig_dig; /* int max_dig; /* DESCRIPTION @@ -62,7 +62,7 @@ /* format_tv - print time with limited precision */ -VSTRING *format_tv(VSTRING *buf, int sec, int usec, +VSTRING *format_tv(VSTRING *buf, long sec, long usec, int sig_dig, int max_dig) { static int pow10[] = {1, 10, 100, 1000, 10000, 100000, 1000000}; @@ -77,7 +77,7 @@ VSTRING *format_tv(VSTRING *buf, int sec, int usec, if (max_dig < 0 || max_dig > 6) msg_panic("format_tv: bad maximum decimal count %d", max_dig); if (sec < 0 || usec < 0 || usec > MILLION) - msg_panic("format_tv: bad time %ds %dus", sec, usec); + msg_panic("format_tv: bad time %lds %ldus", sec, usec); if (sig_dig < 1 || sig_dig > 6) msg_panic("format_tv: bad significant decimal count %d", sig_dig); ures = MILLION / pow10[max_dig]; @@ -111,7 +111,7 @@ VSTRING *format_tv(VSTRING *buf, int sec, int usec, /* * Format the number. Truncate trailing null and thrash below resolution. */ - vstring_sprintf_append(buf, "%d", sec); + vstring_sprintf_append(buf, "%ld", sec); if (usec >= ures) { VSTRING_ADDCH(buf, '.'); for (rem = usec, n = MILLION / 10; rem >= ures && n > 0; n /= 10) { diff --git a/postfix/src/util/format_tv.h b/postfix/src/util/format_tv.h index e62a8618c..bef787a3f 100644 --- a/postfix/src/util/format_tv.h +++ b/postfix/src/util/format_tv.h @@ -19,7 +19,7 @@ /* * External interface. */ -extern VSTRING *format_tv(VSTRING *, int, int, int, int); +extern VSTRING *format_tv(VSTRING *, long, long, int, int); /* LICENSE /* .ad diff --git a/postfix/src/util/htable.c b/postfix/src/util/htable.c index 84d92b1fb..48838e5a6 100644 --- a/postfix/src/util/htable.c +++ b/postfix/src/util/htable.c @@ -287,7 +287,7 @@ void htable_delete(HTABLE *table, const char *key, void (*free_fn) (void *)) void htable_free(HTABLE *table, void (*free_fn) (void *)) { if (table) { - size_t i = table->size; + ssize_t i = table->size; HTABLE_INFO *ht; HTABLE_INFO *next; HTABLE_INFO **h = table->data; @@ -315,7 +315,7 @@ void htable_free(HTABLE *table, void (*free_fn) (void *)) void htable_walk(HTABLE *table, void (*action) (HTABLE_INFO *, void *), void *ptr) { if (table) { - unsigned i = table->size; + ssize_t i = table->size; HTABLE_INFO **h = table->data; HTABLE_INFO *ht; diff --git a/postfix/src/util/inet_addr_local.c b/postfix/src/util/inet_addr_local.c index fc4f7442f..e48803ad1 100644 --- a/postfix/src/util/inet_addr_local.c +++ b/postfix/src/util/inet_addr_local.c @@ -116,6 +116,8 @@ * -- Dean Strik (dcs) */ +#ifndef HAVE_GETIFADDRS + /* ial_socket - make socket for ioctl() operations */ static int ial_socket(int af) @@ -145,6 +147,8 @@ static int ial_socket(int af) return (sock); } +#endif + #ifdef HAVE_GETIFADDRS /* @@ -229,9 +233,7 @@ static int ial_getifaddrs(INET_ADDR_LIST *addr_list, return (0); } -#endif /* HAVE_GETIFADDRS */ - -#ifdef HAS_SIOCGLIF +#elif defined(HAS_SIOCGLIF) /* HAVE_GETIFADDRS */ /* * The SIOCLIF* ioctls are the successors of SIOCGIF* on the Solaris diff --git a/postfix/src/util/line_number.c b/postfix/src/util/line_number.c index 253b3e282..557e05389 100644 --- a/postfix/src/util/line_number.c +++ b/postfix/src/util/line_number.c @@ -63,8 +63,9 @@ char *format_line_number(VSTRING *result, ssize_t first, ssize_t last) /* * Print a range only when the numbers differ. */ - vstring_sprintf(result, first == last ? "%ld" : "%ld-%ld", - (long) first, (long) last); + vstring_sprintf(result, "%ld", (long) first); + if (first != last) + vstring_sprintf_append(result, "-%ld", (long) last); return (vstring_str(result)); } diff --git a/postfix/src/util/mac_expand.c b/postfix/src/util/mac_expand.c index 41de95668..17fa53e60 100644 --- a/postfix/src/util/mac_expand.c +++ b/postfix/src/util/mac_expand.c @@ -332,6 +332,7 @@ static int mac_exp_parse_logical(MAC_EXP_CONTEXT *mc, const char **lookup, VSTRING *rite_op_buf; const char *left_op_strval; const char *rite_op_strval; + char *op_pos; char *op_strval; size_t op_len; int op_tokval; @@ -348,6 +349,7 @@ static int mac_exp_parse_logical(MAC_EXP_CONTEXT *mc, const char **lookup, /* * Operator. Todo: regexp operator. */ + op_pos = cp; op_len = strspn(cp, "<>!=?+-*/~&|%"); /* for better diagnostics. */ op_strval = mystrndup(cp, op_len); op_tokval = name_code(mac_exp_op_table, NAME_CODE_FLAG_NONE, op_strval); @@ -363,7 +365,7 @@ static int mac_exp_parse_logical(MAC_EXP_CONTEXT *mc, const char **lookup, if (MAC_EXP_FIND_LEFT_CURLY(tmp_len, cp) == 0) MAC_EXP_ERR_RETURN(mc, "\"{expression}\" expected at: " "\"...{%s} %.*s>>>%.20s\"", - left_op_strval, (int) op_len, op_strval, cp); + left_op_strval, (int) op_len, op_pos, cp); if ((rite_op_strval = mac_exp_extract_curly_payload(mc, &cp)) == 0) return (mc->status); diff --git a/postfix/src/util/mac_expand.ref b/postfix/src/util/mac_expand.ref index d004b6c16..973dc50ba 100644 --- a/postfix/src/util/mac_expand.ref +++ b/postfix/src/util/mac_expand.ref @@ -74,7 +74,7 @@ stat=0 result=Good: Postfix 2.11 compatible << ${{${name2::bug}} != {:bug}?{Error: NOT}:{Good:}} Postfix 2.11 compatible stat=0 result=Good: Postfix 2.11 compatible << ${{xx}==(yy)?{oops}:{phew}} -unknown: warning: "{expression}" expected at: "...{xx} ??>>>(yy)?{oops}:{phew}" +unknown: warning: "{expression}" expected at: "...{xx} ==>>>(yy)?{oops}:{phew}" stat=1 result= << diff --git a/postfix/src/util/msg.h b/postfix/src/util/msg.h index c69dce14c..fef09313a 100644 --- a/postfix/src/util/msg.h +++ b/postfix/src/util/msg.h @@ -43,7 +43,7 @@ extern void msg_error_clear(void); extern MSG_CLEANUP_FN msg_cleanup(MSG_CLEANUP_FN); extern void PRINTFLIKE(4, 5) msg_rate_delay(time_t *, int, - void PRINTFLIKE(1, 2) (*log_fn) (const char *,...), + void PRINTFPTRLIKE(1, 2) (*log_fn) (const char *,...), const char *,...); /* LICENSE diff --git a/postfix/src/util/mvect.c b/postfix/src/util/mvect.c index 401308517..346b8e0ba 100644 --- a/postfix/src/util/mvect.c +++ b/postfix/src/util/mvect.c @@ -8,14 +8,14 @@ /* /* char *mvect_alloc(vector, elsize, nelm, init_fn, wipe_fn) /* MVECT *vector; -/* int elsize; -/* int nelm; -/* void (*init_fn)(char *ptr, int count); -/* void (*wipe_fn)(char *ptr, int count); +/* ssize_t elsize; +/* ssize_t nelm; +/* void (*init_fn)(char *ptr, ssize_t count); +/* void (*wipe_fn)(char *ptr, ssize_t count); /* /* char *mvect_realloc(vector, nelm) /* MVECT *vector; -/* int nelm; +/* ssize_t nelm; /* /* char *mvect_free(vector) /* MVECT *vector; @@ -67,8 +67,8 @@ /* mvect_alloc - allocate memory vector */ -char *mvect_alloc(MVECT *vect, int elsize, int nelm, - void (*init_fn) (char *, int), void (*wipe_fn) (char *, int)) +char *mvect_alloc(MVECT *vect, ssize_t elsize, ssize_t nelm, + void (*init_fn) (char *, ssize_t), void (*wipe_fn) (char *, ssize_t)) { vect->init_fn = init_fn; vect->wipe_fn = wipe_fn; @@ -83,11 +83,11 @@ char *mvect_alloc(MVECT *vect, int elsize, int nelm, /* mvect_realloc - adjust memory vector allocation */ -char *mvect_realloc(MVECT *vect, int nelm) +char *mvect_realloc(MVECT *vect, ssize_t nelm) { - int old_len = vect->nelm; - int incr = nelm - old_len; - int new_nelm; + ssize_t old_len = vect->nelm; + ssize_t incr = nelm - old_len; + ssize_t new_nelm; if (incr > 0) { if (incr < old_len) diff --git a/postfix/src/util/mvect.h b/postfix/src/util/mvect.h index 23214d547..bdbb701e7 100644 --- a/postfix/src/util/mvect.h +++ b/postfix/src/util/mvect.h @@ -14,18 +14,18 @@ /* * Generic memory vector interface. */ -typedef void (*MVECT_FN) (char *, int); +typedef void (*MVECT_FN) (char *, ssize_t); typedef struct { char *ptr; - int elsize; - int nelm; + ssize_t elsize; + ssize_t nelm; MVECT_FN init_fn; MVECT_FN wipe_fn; } MVECT; -extern char *mvect_alloc(MVECT *, int, int, MVECT_FN, MVECT_FN); -extern char *mvect_realloc(MVECT *, int); +extern char *mvect_alloc(MVECT *, ssize_t, ssize_t, MVECT_FN, MVECT_FN); +extern char *mvect_realloc(MVECT *, ssize_t); extern char *mvect_free(MVECT *); /* LICENSE diff --git a/postfix/src/util/myaddrinfo.c b/postfix/src/util/myaddrinfo.c index 049aef439..a52e07685 100644 --- a/postfix/src/util/myaddrinfo.c +++ b/postfix/src/util/myaddrinfo.c @@ -796,16 +796,27 @@ char *gai_strerror(int ecode) * A test program that takes some info from the command line and runs it * forward and backward through the above conversion routines. */ +#include #include #include #include +static int compare_family(const void *a, const void *b) +{ + struct addrinfo *resa = *(struct addrinfo **) a; + struct addrinfo *resb = *(struct addrinfo **) b; + + return (resa->ai_family - resb->ai_family); +} + int main(int argc, char **argv) { struct addrinfo *info; struct addrinfo *ip; + struct addrinfo **resv; MAI_HOSTNAME_STR host; MAI_HOSTADDR_STR addr; + size_t len, n; int err; msg_vstream_init(argv[0], VSTREAM_ERR); @@ -821,7 +832,14 @@ int main(int argc, char **argv) msg_info("hostname_to_sockaddr(%s): %s", argv[2], err == EAI_SYSTEM ? strerror(errno) : gai_strerror(err)); } else { - for (ip = info; ip != 0; ip = ip->ai_next) { + for (len = 0, ip = info; ip != 0; ip = ip->ai_next) + len += 1; + resv = (struct addrinfo **) mymalloc(len * sizeof(*resv)); + for (len = 0, ip = info; ip != 0; ip = ip->ai_next) + resv[len++] = ip; + qsort((void *) resv, len, sizeof(*resv), compare_family); + for (n = 0; n < len; n++) { + ip = resv[n]; if ((err = sockaddr_to_hostaddr(ip->ai_addr, ip->ai_addrlen, &addr, (MAI_SERVPORT_STR *) 0, 0)) != 0) { msg_info("sockaddr_to_hostaddr: %s", @@ -839,6 +857,7 @@ int main(int argc, char **argv) msg_info("%s -> %s", addr.buf, host.buf); } freeaddrinfo(info); + myfree((void *) resv); } msg_info("=== host address %s ===", argv[3]); diff --git a/postfix/src/util/myaddrinfo.ref b/postfix/src/util/myaddrinfo.ref index f0da580cb..360228a10 100644 --- a/postfix/src/util/myaddrinfo.ref +++ b/postfix/src/util/myaddrinfo.ref @@ -1,8 +1,8 @@ ./myaddrinfo: === hostname belly.porcupine.org === -./myaddrinfo: belly.porcupine.org -> family=28 sock=1 proto=6 2604:8d00:189::6 -./myaddrinfo: 2604:8d00:189::6 -> belly.porcupine.org ./myaddrinfo: belly.porcupine.org -> family=2 sock=1 proto=6 168.100.189.6 ./myaddrinfo: 168.100.189.6 -> belly.porcupine.org +./myaddrinfo: belly.porcupine.org -> family=28 sock=1 proto=6 2604:8d00:189::6 +./myaddrinfo: 2604:8d00:189::6 -> belly.porcupine.org ./myaddrinfo: === host address 168.100.189.2 === ./myaddrinfo: 168.100.189.2 -> family=2 sock=1 proto=6 168.100.189.2 ./myaddrinfo: 168.100.189.2 -> spike.porcupine.org diff --git a/postfix/src/util/name_mask.c b/postfix/src/util/name_mask.c index 6bb3b4df4..92e956fa2 100644 --- a/postfix/src/util/name_mask.c +++ b/postfix/src/util/name_mask.c @@ -268,7 +268,7 @@ const char *str_name_mask_opt(VSTRING *buf, const char *context, { const char *myname = "name_mask"; const NAME_MASK *np; - int len; + ssize_t len; static VSTRING *my_buf = 0; int delim = (flags & NAME_MASK_COMMA ? ',' : (flags & NAME_MASK_PIPE ? '|' : ' ')); @@ -382,7 +382,7 @@ const char *str_long_name_mask_opt(VSTRING *buf, const char *context, long mask, int flags) { const char *myname = "name_mask"; - int len; + ssize_t len; static VSTRING *my_buf = 0; int delim = (flags & NAME_MASK_COMMA ? ',' : (flags & NAME_MASK_PIPE ? '|' : ' ')); diff --git a/postfix/src/util/sane_time.c b/postfix/src/util/sane_time.c index 157c95e15..cc86de2f9 100644 --- a/postfix/src/util/sane_time.c +++ b/postfix/src/util/sane_time.c @@ -61,9 +61,8 @@ time_t sane_time(void) { time_t now; - static time_t last_time, - last_real; - int delta; + static time_t last_time, last_real; + long delta; static int fraction; static int warned; diff --git a/postfix/src/util/stringops.h b/postfix/src/util/stringops.h index 3d9b60fa6..3d4d3b869 100644 --- a/postfix/src/util/stringops.h +++ b/postfix/src/util/stringops.h @@ -25,7 +25,7 @@ extern char *neuter(char *, const char *, int); extern char *lowercase(char *); extern char *uppercase(char *); extern char *skipblanks(const char *); -extern char *trimblanks(char *, int); +extern char *trimblanks(char *, ssize_t); extern char *concatenate(const char *,...); extern char *mystrtok(char **, const char *); extern char *mystrtokq(char **, const char *, const char *); diff --git a/postfix/src/util/surrogate.ref b/postfix/src/util/surrogate.ref index 6b2251305..b8ecd8e7c 100644 --- a/postfix/src/util/surrogate.ref +++ b/postfix/src/util/surrogate.ref @@ -1,55 +1,55 @@ ./dict_open: error: cidr:/xx map requires O_RDONLY access mode -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: cidr:/xx is unavailable. cidr:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open /xx: No such file or directory -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: cidr:/xx is unavailable. open /xx: No such file or directory foo: error ./dict_open: error: pcre:/xx map requires O_RDONLY access mode -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: pcre:/xx is unavailable. pcre:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open /xx: No such file or directory -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: pcre:/xx is unavailable. open /xx: No such file or directory foo: error ./dict_open: error: regexp:/xx map requires O_RDONLY access mode -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: regexp:/xx is unavailable. regexp:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open /xx: No such file or directory -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: regexp:/xx is unavailable. open /xx: No such file or directory foo: error ./dict_open: error: unix:xx map requires O_RDONLY access mode -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: unix:xx is unavailable. unix:xx map requires O_RDONLY access mode foo: error ./dict_open: error: unknown table: unix:xx -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: unix:xx is unavailable. unknown table: unix:xx foo: error ./dict_open: error: texthash:/xx map requires O_RDONLY access mode -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: texthash:/xx is unavailable. texthash:/xx map requires O_RDONLY access mode foo: error ./dict_open: error: open database /xx: No such file or directory -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: texthash:/xx is unavailable. open database /xx: No such file or directory foo: error ./dict_open: error: open database /xx.db: No such file or directory -owner=trusted (uid=-1) +owner=trusted (uid=2147483647) > get foo ./dict_open: warning: hash:/xx is unavailable. open database /xx.db: No such file or directory foo: error diff --git a/postfix/src/util/sys_defs.h b/postfix/src/util/sys_defs.h index e1b460003..55a6fdd6f 100644 --- a/postfix/src/util/sys_defs.h +++ b/postfix/src/util/sys_defs.h @@ -25,7 +25,7 @@ */ #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ - || defined(FREEBSD8) || defined(FREEBSD9) \ + || defined(FREEBSD8) || defined(FREEBSD9) || defined(FREEBSD10) \ || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ || defined(OPENBSD5) \ @@ -235,9 +235,6 @@ #define USE_STATFS #define STATFS_IN_SYS_MOUNT_H #define HAS_POSIX_REGEXP -#define NORETURN void -#define PRINTFLIKE(x,y) -#define SCANFLIKE(x,y) #ifndef NO_NETINFO #define HAS_NETINFO #endif @@ -1167,9 +1164,6 @@ typedef unsigned short mode_t; #define O_NONBLOCK O_NDELAY #define WEXITSTATUS(x) ((x).w_retcode) #define WTERMSIG(x) ((x).w_termsig) -#define NORETURN /* the native compiler */ -#define PRINTFLIKE(x,y) -#define SCANFLIKE(x,y) #endif #ifdef ReliantUnix543 @@ -1566,6 +1560,17 @@ typedef int pid_t; #endif #endif + /* + * Clang-style attribute tests. + * + * XXX Without the unconditional test below, gcc 4.6 will barf on ``elif + * defined(__clang__) && __has_attribute(__whatever__)'' with error message + * ``missing binary operator before token "("''. + */ +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif /* __has_attribute */ + /* * Need to specify what functions never return, so that the compiler can * warn for missing initializations and other trouble. However, OPENSTEP4 @@ -1578,12 +1583,12 @@ typedef int pid_t; #ifndef NORETURN #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 #define NORETURN void __attribute__((__noreturn__)) -#endif -#endif - -#ifndef NORETURN +#elif defined(__clang__) && __has_attribute(__noreturn__) +#define NORETURN void __attribute__((__noreturn__)) +#else #define NORETURN void #endif +#endif /* NORETURN */ /* * Turn on format string argument checking. This is more accurate than @@ -1595,18 +1600,22 @@ typedef int pid_t; #ifndef PRINTFLIKE #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 #define PRINTFLIKE(x,y) __attribute__ ((format (printf, (x), (y)))) +#elif defined(__clang__) && __has_attribute(__format__) +#define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y)))) #else #define PRINTFLIKE(x,y) #endif -#endif +#endif /* PRINTFLIKE */ #ifndef SCANFLIKE #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 #define SCANFLIKE(x,y) __attribute__ ((format (scanf, (x), (y)))) +#elif defined(__clang__) && __has_attribute(__format__) +#define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, (x), (y)))) #else #define SCANFLIKE(x,y) #endif -#endif +#endif /* SCANFLIKE */ /* * Some gcc implementations don't grok these attributes with pointer to @@ -1616,6 +1625,8 @@ typedef int pid_t; #ifndef PRINTFPTRLIKE #if (__GNUC__ >= 3) /* XXX Rough estimate */ #define PRINTFPTRLIKE(x,y) PRINTFLIKE(x,y) +#elif defined(__clang__) && __has_attribute(__format__) +#define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y)))) #else #define PRINTFPTRLIKE(x,y) #endif diff --git a/postfix/src/util/trimblanks.c b/postfix/src/util/trimblanks.c index 8d0eae8a6..a4d9cb2c8 100644 --- a/postfix/src/util/trimblanks.c +++ b/postfix/src/util/trimblanks.c @@ -8,7 +8,7 @@ /* /* char *trimblanks(string, len) /* char *string; -/* int len; +/* ssize_t len; /* DESCRIPTION /* trimblanks() returns a pointer to the beginning of the trailing /* whitespace in \fIstring\fR, or a pointer to the string terminator @@ -34,7 +34,7 @@ #include "stringops.h" -char *trimblanks(char *string, int len) +char *trimblanks(char *string, ssize_t len) { char *curr; diff --git a/postfix/src/util/unix_connect.c b/postfix/src/util/unix_connect.c index 3cf9b7f0b..cbd8c0d2d 100644 --- a/postfix/src/util/unix_connect.c +++ b/postfix/src/util/unix_connect.c @@ -60,13 +60,13 @@ int unix_connect(const char *addr, int block_mode, int timeout) { #undef sun struct sockaddr_un sun; - int len = strlen(addr); + ssize_t len = strlen(addr); int sock; /* * Translate address information to internal form. */ - if (len >= (int) sizeof(sun.sun_path)) + if (len >= sizeof(sun.sun_path)) msg_fatal("unix-domain name too long: %s", addr); memset((void *) &sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; diff --git a/postfix/src/util/unix_listen.c b/postfix/src/util/unix_listen.c index b68a7dcb9..64404061a 100644 --- a/postfix/src/util/unix_listen.c +++ b/postfix/src/util/unix_listen.c @@ -67,13 +67,13 @@ int unix_listen(const char *addr, int backlog, int block_mode) { #undef sun struct sockaddr_un sun; - int len = strlen(addr); + ssize_t len = strlen(addr); int sock; /* * Translate address information to internal form. */ - if (len >= (int) sizeof(sun.sun_path)) + if (len >= sizeof(sun.sun_path)) msg_fatal("unix-domain name too long: %s", addr); memset((void *) &sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX;