]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.12-20141213
authorWietse Venema <wietse@porcupine.org>
Sat, 13 Dec 2014 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sun, 14 Dec 2014 03:41:45 +0000 (22:41 -0500)
73 files changed:
postfix/HISTORY
postfix/WISHLIST
postfix/html/postconf.5.html
postfix/html/smtpd.8.html
postfix/makedefs
postfix/man/man5/postconf.5
postfix/man/man8/smtpd.8
postfix/mantools/postlink
postfix/proto/postconf.proto
postfix/src/bounce/bounce_template.h
postfix/src/cleanup/cleanup_milter.c
postfix/src/global/dict_memcache.c
postfix/src/global/header_body_checks.c
postfix/src/global/header_body_checks.h
postfix/src/global/log_adhoc.c
postfix/src/global/mail_params.c
postfix/src/global/mail_params.h
postfix/src/global/mail_parm_split.c
postfix/src/global/mail_queue.h
postfix/src/global/mail_version.h
postfix/src/global/pipe_command.c
postfix/src/global/record.c
postfix/src/global/record.h
postfix/src/global/smtp_reply_footer.c
postfix/src/global/split_addr.c
postfix/src/global/uxtext.c
postfix/src/master/mail_server.h
postfix/src/master/trigger_server.c
postfix/src/oqmgr/qmgr.c
postfix/src/pickup/pickup.c
postfix/src/postconf/postconf_builtin.c
postfix/src/postfix/postfix.c
postfix/src/qmgr/qmgr.c
postfix/src/sendmail/sendmail.c
postfix/src/smtp/smtp_sasl_proto.c
postfix/src/smtpd/smtpd.c
postfix/src/smtpd/smtpd_check.c
postfix/src/smtpd/smtpd_dns_filter.ref
postfix/src/smtpd/smtpd_nullmx.ref
postfix/src/smtpd/smtpd_proxy.c
postfix/src/smtpd/smtpd_token.c
postfix/src/smtpstone/qmqp-sink.c
postfix/src/smtpstone/qmqp-source.c
postfix/src/smtpstone/smtp-source.c
postfix/src/util/base64_code.c
postfix/src/util/binhash.c
postfix/src/util/dict_alloc.c
postfix/src/util/dict_inline.c
postfix/src/util/dict_inline.ref
postfix/src/util/dict_lmdb.c
postfix/src/util/dict_static.c
postfix/src/util/dict_static.ref
postfix/src/util/events.c
postfix/src/util/format_tv.c
postfix/src/util/format_tv.h
postfix/src/util/htable.c
postfix/src/util/inet_addr_local.c
postfix/src/util/line_number.c
postfix/src/util/mac_expand.c
postfix/src/util/mac_expand.ref
postfix/src/util/msg.h
postfix/src/util/mvect.c
postfix/src/util/mvect.h
postfix/src/util/myaddrinfo.c
postfix/src/util/myaddrinfo.ref
postfix/src/util/name_mask.c
postfix/src/util/sane_time.c
postfix/src/util/stringops.h
postfix/src/util/surrogate.ref
postfix/src/util/sys_defs.h
postfix/src/util/trimblanks.c
postfix/src/util/unix_connect.c
postfix/src/util/unix_listen.c

index ebf01fbc1445aa85b9a0d77017a216d5a902271f..7d568a39f31f61d47e94b9e44ce90fcaabbfe8db 100644 (file)
@@ -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.
index e8fffacab3d490dc11862a4b439003746ddd8e5e..76d3939bf7d49547158e4d39ad9096c09bc1b18a 100644 (file)
@@ -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?
index 88a0ca9e64661847a75c033c3fedfa1c18c98032..95d65ef1424c03bf982706e5729704107fd42e71 100644 (file)
@@ -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). <br> The
 reply is specified with the <a href="postconf.5.html#unknown_address_reject_code">unknown_address_reject_code</a> parameter
 (default: 450), <a href="postconf.5.html#unknown_address_tempfail_action">unknown_address_tempfail_action</a> (default:
-<a href="postconf.5.html#defer_if_permit">defer_if_permit</a>), or <a href="postconf.5.html#nullmx_reject_code">nullmx_reject_code</a> (default 556, Postfix 2.12 and
+<a href="postconf.5.html#defer_if_permit">defer_if_permit</a>), or 556 (nullmx, Postfix 2.12 and
 later). See the respective parameter descriptions for details.
 </dd>
 
@@ -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). <br> The
 reply is specified with the <a href="postconf.5.html#unknown_address_reject_code">unknown_address_reject_code</a> parameter
 (default: 450), <a href="postconf.5.html#unknown_address_tempfail_action">unknown_address_tempfail_action</a> (default:
-<a href="postconf.5.html#defer_if_permit">defer_if_permit</a>), or <a href="postconf.5.html#nullmx_reject_code">nullmx_reject_code</a> (default 556, Postfix 2.12 and
+<a href="postconf.5.html#defer_if_permit">defer_if_permit</a>), or 550 (nullmx, Postfix 2.12 and
 later). See the respective parameter descriptions for details.
 </dd>
 
index 618267d9d7109d98ddd90f39bbffa139778c4e7f..fffa1f2f97be6be5f33559fddcdf2ed08788e2f0 100644 (file)
@@ -1149,13 +1149,6 @@ SMTPD(8)                                                              SMTPD(8)
               <a href="postconf.5.html#reject_unknown_sender_domain">reject_unknown_sender_domain</a> or  <a href="postconf.5.html#reject_unknown_recipient_domain">reject_unknown_recipient_domain</a>
               fail due to a temporary error condition.
 
-       Available in Postfix version 2.12 and later:
-
-       <b><a href="postconf.5.html#nullmx_reject_code">nullmx_reject_code</a> (556)</b>
-              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).
-
 <b>MISCELLANEOUS CONTROLS</b>
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
               The  default  location of the Postfix <a href="postconf.5.html">main.cf</a> and <a href="master.5.html">master.cf</a> con-
index 27cdf79dca44a62e59bc3111f6ddb3c8d77c0568..6d69bb545c1af70ec157d87a05e3b5f8d1410bed 100644 (file)
@@ -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
index e1015f464bdf2240ffb022bbcd4074b8a7a0bbea..c06e544dfc16d3b8ee3e27d62a9aa2b90b1d2fb2 100644 (file)
@@ -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"
index fa0e700aecb50a7814ef9c7a4da6dc57e812f06f..b050cc0e43693aae417c4c3132ac352494914ed6 100644 (file)
@@ -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
index c1e47293e8a8525aede6de8918630d4832821eb7..630f7345b71e42572a3361bd2aa253e6332aa452 100755 (executable)
@@ -410,7 +410,6 @@ while (<>) {
     s;\bno_address_mappings\b;<a href="postconf.5.html#no_address_mappings">$&</a>;g;
     s;\bno_header_body_checks\b;<a href="postconf.5.html#no_header_body_checks">$&</a>;g;
     s;\bno_milters\b;<a href="postconf.5.html#no_milters">$&</a>;g;
-    s;\bnullmx_reject_code\b;<a href="postconf.5.html#nullmx_reject_code">$&</a>;g;
     s;\brecip[-</bB>]*\n* *[<bB>]*i[-</bB>]*\n* *[<bB>]*ent_bcc_maps\b;<a href="postconf.5.html#recipient_bcc_maps">$&</a>;g;
     s;\brecip[-</bB>]*\n* *[<bB>]*i[-</bB>]*\n* *[<bB>]*ent_canoni[-</bB>]*\n* *[<bB>]*cal_classes\b;<a href="postconf.5.html#recipient_canonical_classes">$&</a>;g;
     s;\brecip[-</bB>]*\n* *[<bB>]*i[-</bB>]*\n* *[<bB>]*ent_canoni[-</bB>]*\n* *[<bB>]*cal_maps\b;<a href="postconf.5.html#recipient_canonical_maps">$&</a>;g;
index 09a8887c3258535289a8dafedc467f21dda4c58a..9341208dbbee2bd59ab03e0e68fee2e1f47d3063 100644 (file)
@@ -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). <br> 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.
 </dd>
 
@@ -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). <br> 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.
 </dd>
 
index 2927d13285be849b92b2864a108910cc8644cb73..9bec42973474190dddac0cbdfde1fa9eafa0aa3b 100644 (file)
@@ -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 *);
index 27cbd1cb00289b55c25776dac3e29e1005f428b6..cc60f3595370d4d4f26469a83f4b14b516f8537c 100644 (file)
@@ -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);
index 0b87dfb0d7a877caa99564b165016e5fd76a0873..3210d7d69961a7fae4993da7439d0901ed63eeb5 100644 (file)
@@ -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)
 {
 
     /*
index b3ef032c1487728add6de0f5bccab177f6c2a920..f1e6469af427680853c7c23fee069fc597359417 100644 (file)
@@ -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;
 
     /*
index f4c642bc432f26bc5dff92dc4c03b89be0eeaa2c..7a2718e0592158c3c61e537007c22e364d402162 100644 (file)
@@ -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 {
index 43b3f01fd12fc3d0ae273109f4dfc849c9562011..ed867f737931235a02f1783ea40bccf2fea8b62b 100644 (file)
@@ -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 */
index 18e84abd9e5d31092adf70f4cd5b3b8fc437c9c0..435bfd9bd64072eec4d4a0e3b7e09a78041811a2 100644 (file)
@@ -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
index 83f2b36313fa22f80957c9c1f4a3291f52186941..ffc0fbbfe1f56e7da8ad9c8ff101da015180829b 100644 (file)
@@ -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;
index 1c54ab0157469a84fc0379a666b0522fc3d4b0ca..18aefd367a41110ce2ae3e5653075987af9f327e 100644 (file)
@@ -118,6 +118,7 @@ int     main(void)
        argv_free(argv);
        vstream_fflush(VSTREAM_OUT);
     }
+    vstring_free(vp);
     return (0);
 }
 
index cc0d642cc5e0b9f4359e3bda6a680ab2e3c81754..7b98f901286c02e15a0150a87d17f61c33442c2c 100644 (file)
@@ -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)
 
index 2755a3914e3dd448a4cfb18c527f588ce5a13bec..ec601d24a85fb2aecff3ecd06d34fadaf272026b 100644 (file)
@@ -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
index 32a32b010a40a8b811a009c2f6981f902f1ced66..29c1ffb0d350c5314439d0fc9859047dbb47a5af 100644 (file)
@@ -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;
index 9686d35c85821365b439cb6df41e8a8d9868c61d..faa58f4456fa0aa9338fdfd63f03d8fe856d43b5 100644 (file)
@@ -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 */
 
index c685436b1b401193cc89799535a86d8181ecd73f..8394f6b8504a2fd63aa9ae8f5dd01bd918a8a4f7 100644 (file)
@@ -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))
 
index 8f20848210473e473509b3bb74416c4bd1762f57..bd306b4081e060a405d48d60857096b4ab877f97 100644 (file)
@@ -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;
index 7e7cc27c8c19e207b10bc0dd8cf203ec09378a71..55b699dbd9816531efad54d0b69642c831305fad 100644 (file)
@@ -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.
index aade6a8ce5aa3da22159309e7f640fb8ca668687..03e5cc1380d26bf7b820cf8f819ce475b6001334 100644 (file)
@@ -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');
index 60b79e3a5997cc53bf1798df5a0ca2e3797fd7b6..cdd9469431cd039d9f69c951c1f743fd9dc01280 100644 (file)
@@ -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
index ffa5e31a929d78d70c8c38a4913e600be976d44b..ef545eec2820d1f8a96476b39d6367abce4c536c 100644 (file)
@@ -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;
index 59e020fe4cfed6da9cfefa8f85854fccf1b67e70..daef4cea722ba4615856df0f3584f0b3b5f41747 100644 (file)
@@ -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;
index 02f1608f4ec744a4ec060675a250cd536e796788..27a86543db1309a53dedc3e84a8a68c77c59453a 100644 (file)
@@ -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;
index 9be370880b9daffddfb871e4e2a37a180805de45..a966ebaec8d19f07b1deef905da210d327fddb8f 100644 (file)
@@ -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()));
 }
index 2d8a1abe155b129aa16df3d1e2a8e3475774e834..7e5076ccc1f12efb7ddcfd3c91e972cacc6f98bd 100644 (file)
@@ -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);
     }
index 75a98633fafbb17071988528b9c13db21c97cdaa..b8954e3482eb944a8e81e3ef6d85d5fb5e56e1d3 100644 (file)
@@ -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;
index cb53818d2901cf7bbfe3d0bedae01194576b430e..f8ce7dfdbc579f118ea02caa7a09e25852c9c534 100644 (file)
@@ -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);
 
index fa636609537a03666211b6fb9bb63ec1c5730ad2..c49e85cabb0623d47883ac4c41e6b6a9233f7c4f 100644 (file)
@@ -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;
index 8d827305b230a1f23a8e53a9a00ab5725ff1fd70..0444866a6e3cf476303295f806d7b27dd4c9ea78 100644 (file)
 /*     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,
index 5ef8297e929ef97176991066caebfdad3f6064db..8e61bfca2228cd505d8df6ec138c1986e64601f0 100644 (file)
@@ -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,
 };
 
index bbcae0b75d1fd1a3938578f141584c25efd719f7..f3c9bf98eb1600d65499aaf355a407f88815d34d 100644 (file)
@@ -83,8 +83,8 @@ OK
 OK
 >>> # EXPECT reject (nullmx is not filtered).
 >>> mail user@nullmx.porcupine.org
-./smtpd_check: <queue id>: reject: MAIL from localhost[127.0.0.1]: 556 5.7.0 <user@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<user@nullmx.porcupine.org> proto=SMTP helo=<localhost>
-556 5.7.0 <user@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX)
+./smtpd_check: <queue id>: reject: MAIL from localhost[127.0.0.1]: 550 5.7.27 <user@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<user@nullmx.porcupine.org> proto=SMTP helo=<localhost>
+550 5.7.27 <user@nullmx.porcupine.org>: 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: <queue id>: reject: MAIL from localhost[127.0.0.1]: 450 4.1.8 <user@nxdomain.porcupine.org>: Sender address rejected: Domain not found; from=<user@nxdomain.porcupine.org> proto=SMTP helo=<localhost>
@@ -114,8 +114,8 @@ OK
 450 4.1.8 <user@xn--1xa.porcupine.org>: Sender address rejected: Domain not found
 >>> # EXPECT reject (nullmx is not filtered).
 >>> mail user@nullmx.porcupine.org
-./smtpd_check: <queue id>: reject: MAIL from localhost[127.0.0.1]: 556 5.7.0 <user@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<user@nullmx.porcupine.org> proto=SMTP helo=<localhost>
-556 5.7.0 <user@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX)
+./smtpd_check: <queue id>: reject: MAIL from localhost[127.0.0.1]: 550 5.7.27 <user@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<user@nullmx.porcupine.org> proto=SMTP helo=<localhost>
+550 5.7.27 <user@nullmx.porcupine.org>: 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: <queue id>: reject: MAIL from localhost[127.0.0.1]: 450 4.1.8 <user@nxdomain.porcupine.org>: Sender address rejected: Domain not found; from=<user@nxdomain.porcupine.org> proto=SMTP helo=<localhost>
index e2b5a2fa5d9a42a50664fb4ea9432db583006904..4cc258e3b4168d5ab818db63d310ce29102fd5e9 100644 (file)
@@ -46,8 +46,8 @@ OK
 ./smtpd_check: <queue id>: reject: MAIL from spike.porcupine.org[168.100.189.2]: 450 4.1.8 <sname@nxdomain.porcupine.org>: Sender address rejected: Domain not found; from=<sname@nxdomain.porcupine.org> proto=SMTP helo=<spike.porcupine.org>
 450 4.1.8 <sname@nxdomain.porcupine.org>: Sender address rejected: Domain not found
 >>> mail sname@nullmx.porcupine.org
-./smtpd_check: <queue id>: reject: MAIL from spike.porcupine.org[168.100.189.2]: 556 5.7.0 <sname@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<sname@nullmx.porcupine.org> proto=SMTP helo=<spike.porcupine.org>
-556 5.7.0 <sname@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX)
+./smtpd_check: <queue id>: reject: MAIL from spike.porcupine.org[168.100.189.2]: 550 5.7.27 <sname@nullmx.porcupine.org>: Sender address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<sname@nullmx.porcupine.org> proto=SMTP helo=<spike.porcupine.org>
+550 5.7.27 <sname@nullmx.porcupine.org>: 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: <queue id>: reject: RCPT from spike.porcupine.org[168.100.189.2]: 556 5.1.0 <rname@nullmx.porcupine.org>: Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<sname@sdomain> to=<rname@nullmx.porcupine.org> proto=SMTP helo=<spike.porcupine.org>
-556 5.1.0 <rname@nullmx.porcupine.org>: Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX)
+./smtpd_check: <queue id>: reject: RCPT from spike.porcupine.org[168.100.189.2]: 556 5.1.10 <rname@nullmx.porcupine.org>: Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX); from=<sname@sdomain> to=<rname@nullmx.porcupine.org> proto=SMTP helo=<spike.porcupine.org>
+556 5.1.10 <rname@nullmx.porcupine.org>: Recipient address rejected: Domain nullmx.porcupine.org does not accept mail (nullMX)
 >>> relay_domains spike.porcupine.org
 OK
 >>> rcpt rname@spike.porcupine.org
index e60559990e81cbae247f532ef6b2568500f41436..8a6bffb3a25997481906f2cc7a6bd4d66b393561 100644 (file)
 #include <mail_params.h>
 #include <rec_type.h>
 #include <mail_proto.h>
-#include <mail_params.h>               /* null_format_string */
 #include <xtext.h>
 #include <record.h>
 #include <mail_queue.h>
@@ -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
index 7180317c444382d2a0f610bd86cd4c259cbdabeb..927088f62e72997f9492011c93d164f468b488a1 100644 (file)
@@ -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;
index e1aa75a2e984bdcd6dd7e704a7ba9fcabb167e37..6c1d2cff07265ae496f76c5063e40306c186afc9 100644 (file)
@@ -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);
index 71e34ee4b40f93f10f55be1de1c0e434c0e23b2a..a7da5c0b82844ff96b151ce9c06598964bcb3a07 100644 (file)
@@ -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);
index c318f564ff08761792b634552a3b7882313d7e97..f19d284de359db223a72c6a14a64033dc39ce987 100644 (file)
@@ -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);
index c7d745ecb40c967142fac14d9bdff98a2e15af0f..e60721886586c49009a180a7d19754da99488b2e 100644 (file)
@@ -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);
 }
 
index d52fb3a9981e672fa1dbfc45152477be0fe706a2..ef8900dcce07d20f41f63720eb0080938880bd62 100644 (file)
 
 /* 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;
 
index 9a19b918dc8cb0fa7a65ab50d5ca1242a7714abd..f370569a82c35697c664f575e5ca554e766e4da7 100644 (file)
@@ -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;
index 8a97f7e1ab389482ab5652ebcb4a94c0699e555f..af646007c02cd616df9f938a874216b4e188a9bb 100644 (file)
 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));
index 0014d93de2dc8f9f7979fc5dc0ea079d73514a8e..771ca9f6a53f59cb52ebc40104a83f4ac5f752ca 100644 (file)
@@ -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
index f22f16d1435cd0676f3003671f96c91169763e76..2df583088998c18b957759c3ec5ad90405cb10b7 100644 (file)
@@ -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);
index 445f3cb37d1947551b9d679e74ba17b788742f1b..d5fa0a6ceb928f55c754c3dae36a5443cab15a23 100644 (file)
@@ -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)
 
index 0c3de56c1c9ac5e66208e7b329562c7d979cb544..550264a0d7ca891cba3c51617b7ce19ed6468fd6 100644 (file)
@@ -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
index e726be8cb2d5488b6e6a90d88d1c5229c99af003..c2157bb046d48865826576d101bc8ef474c211e3 100644 (file)
@@ -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 *)
index e555cb3c7fa9f5b12081da05374fc3a42309cc70..64146190232c89fb00b164575cab4f6e8d82fd5c 100644 (file)
@@ -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) {
index e62a8618ca7a5c665e905f49c943c21e29dcd048..bef787a3f11c15a0c70f51147a467074bd347bfc 100644 (file)
@@ -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
index 84d92b1fbbd6221a77e5356e3a638c2e732c1adf..48838e5a63395128d2e574cc73091a3e2c2c3afc 100644 (file)
@@ -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;
 
index fc4f7442f39537bd1730eba4eae8c601a6166a8c..e48803ad1b6876b021340be2c786b6ea512dea62 100644 (file)
   * -- 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
index 253b3e282eda2258801e92f1cf9c7c2e4e31be77..557e0538971c788ba901f8630a9f4c4e3905c988 100644 (file)
@@ -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));
 }
index 41de95668e0337aaaed285f3dda1427c2e2cc7e0..17fa53e6067db4fda83f08380886cb87d478af5f 100644 (file)
@@ -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);
 
index d004b6c166eb4be194bd4e49318e8eb904d0285d..973dc50ba5a55a245dfe8c6fcc4f89a04c168441 100644 (file)
@@ -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=
 << 
 
index c69dce14c63dc68109251b895b590475f0522414..fef09313a30402697d0c774e0393fa5ca91f194c 100644 (file)
@@ -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
index 4013085171adf16564c706bc0ae2573bbc2a65a6..346b8e0baef98e0b0c42115a8411411111d7a78e 100644 (file)
@@ -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)
index 23214d54761a2c7bedaf5a9329a09e7f365f3aad..bdbb701e718d5601d4340f818200e757d6c4f397 100644 (file)
  /*
   * 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
index 049aef4397e875d54cbf04e70c751debb60ee519..a52e076859846451edb351aecc48f268bae87264 100644 (file)
@@ -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 <stdlib.h>
 #include <msg.h>
 #include <vstream.h>
 #include <msg_vstream.h>
 
+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]);
index f0da580cbddc601145e20493a2fffff225bbed96..360228a10b637e7d732e33f55bff70e39575b105 100644 (file)
@@ -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
index 6bb3b4df467f426972709ca41d156e7221252daf..92e956fa2afeb1b0b2a54be9d3f2c002659dc6d5 100644 (file)
@@ -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 ? '|' : ' '));
index 157c95e15bc2fee452fdeb447fb454b1addfaacf..cc86de2f90b9f96752edf84057ae50c98987577b 100644 (file)
@@ -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;
 
index 3d9b60fa66c6a6a6ab8b987d5719fe370ff4dda4..3d4d3b86933e70786c7f8443c3fce8e551d1efcd 100644 (file)
@@ -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 *);
index 6b2251305ea81812f108d41ec599380d983cf3ba..b8ecd8e7c54f0f78b0715a4a7cf06d513daad797 100644 (file)
@@ -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
index e1b46000397e42163451aa6935270300cd73ddf2..55a6fdd6f00cf42e731681f553f5b37f01e82890 100644 (file)
@@ -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) \
 #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
index 8d0eae8a64f4a2061ac9560bd54f022a9ca66176..a4d9cb2c84b90033f4bb6107286cedfac42c1dfe 100644 (file)
@@ -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;
 
index 3cf9b7f0b614b14d3f542386a4d0ad701f72ad95..cbd8c0d2da4e6670a5221cc180dc202e2383ef54 100644 (file)
@@ -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;
index b68a7dcb937b2415a8313d3a42b00aa4f16f3865..64404061a3fd6df345d2eebc37b3d0acc0434982 100644 (file)
@@ -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;