]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20010501
authorWietse Venema <wietse@porcupine.org>
Tue, 1 May 2001 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:27:15 +0000 (06:27 +0000)
38 files changed:
postfix/HISTORY
postfix/INSTALL.sh
postfix/html/master.8.html
postfix/html/postsuper.1.html
postfix/html/smtpd.8.html
postfix/makedefs
postfix/man/man1/postsuper.1
postfix/man/man8/master.8
postfix/man/man8/smtpd.8
postfix/src/dns/Makefile.in
postfix/src/dns/dns.h
postfix/src/dns/dns_rr.c
postfix/src/global/deliver_request.c
postfix/src/global/mail_conf_bool.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/local/alias.c
postfix/src/master/Makefile.in
postfix/src/master/master.h
postfix/src/master/master_ent.c
postfix/src/master/master_listen.c
postfix/src/nqmgr/qmgr_move.c
postfix/src/postalias/Makefile.in
postfix/src/postmap/Makefile.in
postfix/src/postsuper/postsuper.c
postfix/src/qmgr/qmgr_move.c
postfix/src/sendmail/sendmail.c
postfix/src/smtp/Makefile.in
postfix/src/smtp/smtp_addr.c
postfix/src/smtpd/smtpd.c
postfix/src/smtpd/smtpd_check.c
postfix/src/smtpd/smtpd_check.in
postfix/src/smtpd/smtpd_check.ref
postfix/src/smtpd/smtpd_check.ref2
postfix/src/util/Makefile.in
postfix/src/util/myrand.c
postfix/src/util/sane_link.c
postfix/src/util/writable.c

index a51d2ebea8cbb681d514c6e3c7735a37394415a4..cba26c8b197e45a343b715eb785a6687e4fa8b1c 100644 (file)
@@ -5050,11 +5050,11 @@ Apologies for any names omitted.
 
 20010411
 
-       Compatibility: the SMTP server now replies with 550 instead
-       of 503 when it receives the DATA command without having
-       received a valid recipient address. This is needed for the
-       Sendmail client-side pipelining implementation. Problem
-       reported by Lutz Jaenicke. File: smtpd/smtpd.c.
+       Bugfix: the SMTP server now replies with 550 instead of
+       503 when it receives the DATA command without having received
+       a valid recipient address. This is needed for the Sendmail
+       client-side pipelining implementation. Problem reported by
+       Lutz Jaenicke. File: smtpd/smtpd.c.
 
        Cleanup: shut up if chattr fails on Reiserfs and other file
        systems that do not support the respective attributes.
@@ -5080,9 +5080,10 @@ Apologies for any names omitted.
 
 20010426
 
-       Workaround: the SMTP server did not really parse invalid
-       addresses such as <first last <user@domain>> well.  I
-       thought this was taken care of years ago. File:  smtpd/smtpd.c.
+       Bugfix: the SMTP server did not parse invalid MAIL FROM or
+       RCPT TO addresses such as <first last <user@domain>> the
+       way it was supposed to do.  I thought this was taken care
+       of years ago. File:  smtpd/smtpd.c.
 
 20010427
 
@@ -5095,4 +5096,26 @@ Apologies for any names omitted.
 
        Feature: the Postfix SMTP client now by default randomly
        shuffles destination IP addresses of equal preference.
-       File: smtp/smtp_addr.c. Based on an idea by Aleph1.
+       Specify "smtp_randomize_addresses = no" to disable.
+       Shuffling code by Elias Levy @ SecurityFocus.com Files:
+       dns/dns_rr.c, smtp/smtp_addr.c.
+
+20010501
+
+       Bugfix: The SMTP server's 550 in reply to DATA should be
+       a 554 response.  And it wasn't Sendmail. Claus Assman.
+
+       Bugfix: the INSTALL.sh test for non-interactive upgrade
+       broke rooted installations that specify settings via the
+       environment.  Simon Mudd.
+
+       Bugfix: mailq output is now really flushed one message at
+       a time. File: sendmail/sendmail.c.
+
+       Feature: "postsuper -d queueID" deletes one message queue
+       file; "postsuper -d -" reads zero or more queue IDs from
+       standard input.  In order to make this operation usable
+       with a running Postfix mail system, some routines were made
+       more tolerant for sudden queue file disappearances.  Files:
+       postsuper/postsuper.c, global/deliver_request.c,
+       *qmgr/qmgr_move.c.
index 88a60495d9b0d170532d70ef15c82f7599dabcac..391b45084dc9e8b474474bfff468236c4aed8c6b 100644 (file)
@@ -166,15 +166,17 @@ test -f $CONFIG_DIRECTORY/main.cf && {
     done
 }
 
-test -f $CONFIG_DIRECTORY/install.cf && . $CONFIG_DIRECTORY/install.cf || {
-    test -t 0 || {
-       echo Non-interactive install needs the $CONFIG_DIRECTORY/install.cf 1>&2
-       echo file from a previous Postfix installation. 1>&2
-       echo 1>&2
-       echo Use interactive installation instead. 1>&2
-       exit 1
-    }
-}
+if [ -f $CONFIG_DIRECTORY/install.cf ]
+then
+    . $CONFIG_DIRECTORY/install.cf
+elif [ ! -t 0 -a -z "$install_root" ]
+then
+    echo Non-interactive install needs the $CONFIG_DIRECTORY/install.cf 1>&2
+    echo file from a previous Postfix installation. 1>&2
+    echo 1>&2
+    echo Use interactive installation instead. 1>&2
+    exit 1
+fi
 
 # Override default settings.
 
index b1784ea0059691be875081d813e88d440b273b1b..c767d6dc3070cc5bd60e0285189b40b8ce0013b4 100644 (file)
@@ -9,7 +9,7 @@ MASTER(8)                                               MASTER(8)
        master - Postfix master process
 
 <b>SYNOPSIS</b>
-       <b>master</b> [<b>-c</b> <i>config_dir</i>] [<b>-D</b>] [<b>-t</b>] [<b>-v</b>]
+       <b>master</b> [<b>-c</b> <i>config_dir</i>] [<b>-e</b> <i>exit_time</i>] [<b>-D</b>] [<b>-t</b>] [<b>-v</b>]
 
 <b>DESCRIPTION</b>
        The  <b>master</b> daemon is the resident process that runs Post-
@@ -37,6 +37,11 @@ MASTER(8)                                               MASTER(8)
               in the named directory instead of the default  con-
               figuration directory.
 
+       <b>-e</b> <i>exit_time</i>
+              Terminate  the  master process after <i>exit_time</i> sec-
+              onds. Child processes  terminate  at  their  conve-
+              nience.
+
        <b>-D</b>     After  initialization, run a debugger on the master
               process. The debugging command  is  specified  with
               the <b>debugger</b><i>_</i><b>command</b> in the <b>main.cf</b> global configu-
@@ -54,11 +59,6 @@ MASTER(8)                                               MASTER(8)
        Signals:
 
        <b>SIGHUP</b> Upon  receipt  of a <b>HUP</b> signal (e.g., after <b>postfix</b>
-              <b>reload</b>), the master process re-reads its configura-
-              tion  files. If a service has been removed from the
-              <b>master.cf</b> file, its running  processes  are  termi-
-              nated  immediately.   Otherwise,  running processes
-              are allowed to terminate as soon as is  convenient,
 
 
 
@@ -71,6 +71,11 @@ MASTER(8)                                               MASTER(8)
 MASTER(8)                                               MASTER(8)
 
 
+              <b>reload</b>), the master process re-reads its configura-
+              tion  files. If a service has been removed from the
+              <b>master.cf</b> file, its running  processes  are  termi-
+              nated  immediately.   Otherwise,  running processes
+              are allowed to terminate as soon as is  convenient,
               so  that  changes  in configuration settings affect
               only new service requests.
 
@@ -119,11 +124,6 @@ MASTER(8)                                               MASTER(8)
        <b>daemon</b><i>_</i><b>directory</b>
               Directory with Postfix daemon programs.
 
-       <b>queue</b><i>_</i><b>directory</b>
-              Top-level  directory  of the Postfix queue. This is
-              also the root directory of Postfix daemons that run
-              chrooted.
-
 
 
 
@@ -137,6 +137,11 @@ MASTER(8)                                               MASTER(8)
 MASTER(8)                                               MASTER(8)
 
 
+       <b>queue</b><i>_</i><b>directory</b>
+              Top-level  directory  of the Postfix queue. This is
+              also the root directory of Postfix daemons that run
+              chrooted.
+
 <b>Resource</b> <b>controls</b>
        <b>default</b><i>_</i><b>process</b><i>_</i><b>limit</b>
               Default  limit for the number of simultaneous child
@@ -188,11 +193,6 @@ MASTER(8)                                               MASTER(8)
 
 
 
-
-
-
-
-
 
                                                                 3
 
index 15aa92cc5dedb3ab865c1c6a63ac4b09ac85d76b..0d2993f8f361e47984c3ae50030ba22aa65f3ac9 100644 (file)
@@ -9,7 +9,7 @@ POSTSUPER(1)                                         POSTSUPER(1)
        postsuper - Postfix super intendent
 
 <b>SYNOPSIS</b>
-       <b>postsuper</b> [<b>-p</b>] [<b>-s</b>] [<b>-v</b>] [<i>directory</i> <i>...</i>]
+       <b>postsuper</b> [<b>-d</b> <i>queue_id</i>] [<b>-p</b>] [<b>-s</b>] [<b>-v</b>] [<i>directory</i> <i>...</i>]
 
 <b>DESCRIPTION</b>
        The  <b>postsuper</b>  command does small maintenance jobs on the
@@ -25,51 +25,64 @@ POSTSUPER(1)                                         POSTSUPER(1)
 
        Options:
 
-       <b>-s</b>     Structure check.  Move queue files that are in  the
+       <b>-d</b>     Delete one message queue file with the named  queue
+              ID.  Specify multiple <b>-d</b> options to delete multiple
+              queue files by name.
+
+              Alternatively, if a <i>queue_id</i> of <b>-</b> is specified, the
+              program reads queue IDs from standard input.
+
+              This  operation  can  be performed safely while the
+              mail system is running, although the queue  manager
+              may issue warnings when a file suddenly disappears.
+              The exit status is zero if  at  least  one  of  the
+              named message queue files was found.
+
+       <b>-s</b>     Structure  check.  Move queue files that are in the
               wrong place in the file system hierarchy and remove
-              subdirectories that  are  no  longer  needed.  File
-              rearrangements  are necessary after a change in the
+              subdirectories  that  are  no  longer  needed. File
+              rearrangements are necessary after a change in  the
               <b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b> and/or <b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b> configura-
-              tion  parameters.  It  is highly recommended to run
+              tion parameters. It is highly  recommended  to  run
               this check once before Postfix startup.
 
-       <b>-p</b>     Purge stale files (files that are left  over  after
+       <b>-p</b>     Purge  stale  files (files that are left over after
               system or software crashes).
 
        <b>-v</b>     Enable verbose logging for debugging purposes. Mul-
-              tiple <b>-v</b> options  make  the  software  increasingly
+              tiple  <b>-v</b>  options  make  the software increasingly
               verbose.
 
 <b>DIAGNOSTICS</b>
-       Problems  are reported to the standard error stream and to
+       Problems are reported to the standard error stream and  to
        <b>syslogd</b>.
 
 <b>CONFIGURATION</b> <b>PARAMETERS</b>
-       See the Postfix <b>main.cf</b> file for syntax  details  and  for
-       default values.
+       See  the  Postfix  <b>main.cf</b> file for syntax details and for
 
-       <b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b>
-              Number of subdirectory levels for hashed queues.
 
-       <b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b>
-              The  names of queues that are organized into multi-
-              ple levels of subdirectories.
 
-<b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
-       software.
+                                                                1
 
 
 
 
-                                                                1
 
+POSTSUPER(1)                                         POSTSUPER(1)
 
 
+       default values.
 
+       <b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b>
+              Number of subdirectory levels for hashed queues.
 
-POSTSUPER(1)                                         POSTSUPER(1)
+       <b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b>
+              The names of queues that are organized into  multi-
+              ple levels of subdirectories.
 
+<b>LICENSE</b>
+       The  Secure  Mailer  license must be distributed with this
+       software.
 
 <b>AUTHOR(S)</b>
        Wietse Venema
@@ -101,19 +114,6 @@ POSTSUPER(1)                                         POSTSUPER(1)
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 
index 97ae6d8377baa8d3882d30272d4eb71fbbc0839c..0e96e6860a58c52f721f6293645d20bd025f978a 100644 (file)
@@ -283,7 +283,7 @@ SMTPD(8)                                                 SMTPD(8)
               nasty  relay  loopholes involving trusted backup MX
               hosts.
 
-       <b>restriction</b><i>_</i><b>classes</b>
+       <b>smtpd</b><i>_</i><b>restriction</b><i>_</i><b>classes</b>
               Declares the name of zero or more  parameters  that
               contain  a  list  of UCE restrictions. The names of
               these parameters can then be used  instead  of  the
index 9623d0410bc37e7f50d82c5123f8e5e859471285..b594e1c5b5b0d12746ea4f3d64a39d6cac1b791c 100644 (file)
@@ -175,17 +175,18 @@ case "$SYSTEM.$RELEASE" in
                    echo "See the RELEASE_NOTES file for more information." 1>&2
                    exit 1
                fi
-               # See where GDBM's ndbm.h include file sits. XXX verify that
-               # gdbm links in by default (i.e. NO -lgdbm is needed).
+               # See where GDBM's ndbm.h include file sits.
                if [ -f /usr/include/gdbm-ndbm.h ]
                then
                    CCARGS="$CCARGS -DHAS_DBM -DPATH_NDBM_H=\\\"<gdbm-ndbm.h>\\\""
+                   GDBM_LIBS=gdbm
                elif [ -f /usr/include/gdbm/ndbm.h ]
                then
                    CCARGS="$CCARGS -DHAS_DBM -DPATH_NDBM_H=\\\"<gdbm/ndbm.h>\\\""
+                   GDBM_LIBS=gdbm
                fi
                SYSLIBS="-ldb"
-               for name in nsl resolv
+               for name in nsl resolv $GDBM_LIBS
                do
                    test -f /usr/lib/lib$name.a && SYSLIBS="$SYSLIBS -l$name"
                done
index 07fada8e870376b5e46bd8db93bdd918031febdd..050497aaa5590b0be002ef0809932088d0c62257 100644 (file)
@@ -9,7 +9,8 @@ Postfix super intendent
 .na
 .nf
 .fi
-\fBpostsuper\fR [\fB-p\fR] [\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR]
+\fBpostsuper\fR [\fB-d \fIqueue_id\fR] [\fB-p\fR]
+[\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR]
 .SH DESCRIPTION
 .ad
 .fi
@@ -23,6 +24,17 @@ By default, \fBpostsuper\fR performs the operations requested with the
 nor directories.  Use of this command is restricted to the super-user.
 
 Options:
+.IP \fB-d \fIqueue_id\fR
+Delete one message queue file with the named queue ID.  Specify
+multiple \fB-d\fR options to delete multiple queue files by name.
+.sp
+Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified, the
+program reads queue IDs from standard input.
+.sp
+This operation can be performed safely while the mail system is
+running, although the queue manager may issue warnings when a
+file suddenly disappears. The exit status is zero if at least one
+of the named message queue files was found.
 .IP \fB-s\fR
 Structure check.  Move queue files that are in the wrong place
 in the file system hierarchy and remove subdirectories that are
index ad4f0344406f88ce85b64e2478461f1543cc9f42..7729c2957d3a73b6eddfc52d3b3180b588f7b5aa 100644 (file)
@@ -9,7 +9,8 @@ Postfix master process
 .na
 .nf
 .fi
-\fBmaster\fR [\fB-c \fIconfig_dir\fR] [\fB-D\fR] [\fB-t\fR] [\fB-v\fR]
+\fBmaster\fR [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR]
+[\fB-D\fR] [\fB-t\fR] [\fB-v\fR]
 .SH DESCRIPTION
 .ad
 .fi
@@ -34,6 +35,9 @@ Options:
 .IP "\fB-c \fIconfig_dir\fR"
 Read the \fBmain.cf\fR and \fBmaster.cf\fR configuration files in
 the named directory instead of the default configuration directory.
+.IP "\fB-e \fIexit_time\fR"
+Terminate the master process after \fIexit_time\fR seconds. Child
+processes terminate at their convenience.
 .IP \fB-D\fR
 After initialization, run a debugger on the master process. The
 debugging command is specified with the \fBdebugger_command\fR in
index c544a890d5c6b67305e1e428bfd811da239acc96..7b5a4ea6e917e384890e8d08736d3e0fdb8f1f0b 100644 (file)
@@ -196,7 +196,7 @@ and what clients may issue \fBETRN\fR commands.
 Allow untrusted clients to specify addresses with sender-specified
 routing.  Enabling this opens up nasty relay loopholes involving
 trusted backup MX hosts.
-.IP \fBrestriction_classes\fR
+.IP \fBsmtpd_restriction_classes\fR
 Declares the name of zero or more parameters that contain a
 list of UCE restrictions. The names of these parameters can
 then be used instead of the restriction lists that they represent.
index e132be3db589a6d09a0dda350fe5fd528ef4b2c4..812c3fbc8e809bdf54d62facc7dd85c15aaff3ae 100644 (file)
@@ -81,6 +81,7 @@ dns_rr.o: dns_rr.c
 dns_rr.o: ../../include/sys_defs.h
 dns_rr.o: ../../include/msg.h
 dns_rr.o: ../../include/mymalloc.h
+dns_rr.o: ../../include/myrand.h
 dns_rr.o: dns.h
 dns_rr.o: ../../include/vstring.h
 dns_rr.o: ../../include/vbuf.h
index 490a5ff39236990b6e2b53bc8a247ff97c20a910..e08583d6e8d5ae6d3b7f791feaa0a925bbed9d06 100644 (file)
@@ -105,6 +105,7 @@ extern void dns_rr_free(DNS_RR *);
 extern DNS_RR *dns_rr_copy(DNS_RR *);
 extern DNS_RR *dns_rr_append(DNS_RR *, DNS_RR *);
 extern DNS_RR *dns_rr_sort(DNS_RR *, int (*) (DNS_RR *, DNS_RR *));
+extern DNS_RR *dns_rr_shuffle(DNS_RR *);
 
  /*
   * dns_lookup.c
index 39cbf192061ae4c253cf7bbad521f7b0cd7c5ad0..2dc8edd1b0c8ab1d0635e718171690d4913c0e37 100644 (file)
@@ -26,6 +26,9 @@
 /*     DNS_RR  *dns_rr_sort(list, compar)
 /*     DNS_RR  *list
 /*     int     (*compar)(DNS_RR *, DNS_RR *);
+/*
+/*     DNS_RR  *dns_rr_shuffle(list)
+/*     DNS_RR  *list;
 /* DESCRIPTION
 /*     The routines in this module maintain memory for DNS resource record
 /*     information, and maintain lists of DNS resource records.
@@ -49,6 +52,8 @@
 /*     dns_rr_sort() sorts a list of resource records into ascending
 /*     order according to a user-specified criterion. The result is the
 /*     sorted list.
+/*
+/*     dns_rr_shuffle() randomly permutes a list of resource records.
 /* LICENSE
 /* .ad
 /* .fi
@@ -70,6 +75,7 @@
 
 #include <msg.h>
 #include <mymalloc.h>
+#include <myrand.h>
 
 /* DNS library. */
 
@@ -193,3 +199,47 @@ DNS_RR *dns_rr_sort(DNS_RR *list, int (*compar) (DNS_RR *, DNS_RR *))
     dns_rr_sort_user = saved_user;
     return (list);
 }
+
+/* dns_rr_shuffle - shuffle resource record list */
+
+DNS_RR *dns_rr_shuffle(DNS_RR *list)
+{
+    DNS_RR **rr_array;
+    DNS_RR *rr;
+    int     len;
+    int     i;
+    int     r;
+
+    /*
+     * Build linear array with pointers to each list element.
+     */
+    for (len = 0, rr = list; rr != 0; len++, rr = rr->next)
+        /* void */ ;
+    rr_array = (DNS_RR **) mymalloc(len * sizeof(*rr_array));
+    for (len = 0, rr = list; rr != 0; len++, rr = rr->next)
+       rr_array[len] = rr;
+
+    /*
+     * Shuffle resource records.
+     */
+    for (i = 0; i < len; i++) {
+       r = myrand() % len;
+       rr = rr_array[i];
+       rr_array[i] = rr_array[r];
+       rr_array[r] = rr;
+    }
+
+    /*
+     * Fix the links.
+     */
+    for (i = 0; i < len - 1; i++)
+       rr_array[i]->next = rr_array[i + 1];
+    rr_array[i]->next = 0;
+    list = rr_array[0];
+
+    /*
+     * Cleanup.
+     */
+    myfree((char *) rr_array);
+    return (list);
+}
index 63c20c4fee45146e2dac36e40fb73414143a1d97..29a041ea2ebea074b4e044121257a7311d211d64 100644 (file)
@@ -85,6 +85,7 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <unistd.h>
+#include <errno.h>
 
 /* Utility library. */
 
@@ -230,8 +231,12 @@ static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request)
 
     request->fp =
        mail_queue_open(request->queue_name, request->queue_id, O_RDWR, 0);
-    if (request->fp == 0)
-       msg_fatal("open %s %s: %m", request->queue_name, request->queue_id);
+    if (request->fp == 0) {
+       if (errno != ENOENT)
+           msg_fatal("open %s %s: %m", request->queue_name, request->queue_id);
+       msg_warn("open %s %s: %m", request->queue_name, request->queue_id);
+       return (-1);
+    }
     if (msg_verbose)
        msg_info("%s: file %s", myname, VSTREAM_PATH(request->fp));
     if (myflock(vstream_fileno(request->fp), INTERNAL_LOCK, DELIVER_LOCK_MODE) < 0)
index f366e23252ea9eb99be8427b229b6253cf8bee7a..f6a11024bab14dca6c57bf731925d261521f3a53 100644 (file)
@@ -7,12 +7,10 @@
 /*     #include <mail_conf.h>
 /*
 /*     int     get_mail_conf_bool(name, defval)
-/*     const char *path;
 /*     const char *name;
 /*     int     defval;
 /*
 /*     int     get_mail_conf_bool_fn(name, defval)
-/*     const char *path;
 /*     const char *name;
 /*     int     (*defval)();
 /*
index d66cbd2a148b1fed9112073f9bafa87c3f4cb53d..caea36103d220c274a37a75421a8d49aef236bfe 100644 (file)
@@ -699,7 +699,7 @@ extern bool var_smtp_never_ehlo;
 #define DEF_SMTP_BIND_ADDR     ""
 extern char *var_smtp_bind_addr;
 
-#define VAR_SMTP_RAND_ADDR     "smtp_randomize_address"
+#define VAR_SMTP_RAND_ADDR     "smtp_randomize_addresses"
 #define DEF_SMTP_RAND_ADDR     1
 extern bool var_smtp_rand_addr;
 
index 9b7b98965f07c0218b005f65de25b4bb92ff5c0d..56c9709504cc2c8d1f29d91bfab9f0f1c33e6dbe 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-20010429"
+#define DEF_MAIL_VERSION       "Snapshot-20010501"
 extern char *var_mail_version;
 
 /* LICENSE
index 2fc36e91d89d53de1ac01fee4da73a5794beb844..fe1eb46fd7dc4c8389e4c0af932925dfbb7e2106 100644 (file)
@@ -279,7 +279,9 @@ int     deliver_alias(LOCAL_STATE state, USER_ATTR usr_attr,
                              "alias database unavailable") :
            deliver_token_string(state, usr_attr, expansion, &alias_count));
 #if 0
-           if (state.msg_attr.owner == 0 && alias_count > 10)
+           if (var_ownreq_special
+               && strncmp("owner-", state.msg_attr.sender, 6) != 0 
+               && alias_count > 10)
                msg_warn("mailing list \"%s\" needs an \"owner-%s\" alias",
                         name, name);
 #endif
index e92df20c5a201d7b254e1a0151adf9538e2f7bfa..d33912054c0c1d99ddf7aa35666f6bc974214c36 100644 (file)
@@ -121,6 +121,8 @@ master_ent.o: ../../include/argv.h
 master_ent.o: ../../include/stringops.h
 master_ent.o: ../../include/readlline.h
 master_ent.o: ../../include/inet_addr_list.h
+master_ent.o: ../../include/inet_util.h
+master_ent.o: ../../include/inet_addr_host.h
 master_ent.o: ../../include/mail_proto.h
 master_ent.o: ../../include/iostuff.h
 master_ent.o: ../../include/mail_params.h
index bb32b956e4e228f8dc72dfaa5796a5af376d6a2f..abdfecc720f8005be01afb6a38fde4f4f057d13a 100644 (file)
@@ -24,8 +24,13 @@ typedef struct MASTER_SERV {
     int    *listen_fd;                 /* incoming requests */
     int     listen_fd_count;           /* nr of descriptors */
     union {
-       struct INET_ADDR_LIST *inet;
-    } addr_list;
+       struct {
+           char   *port;               /* inet listen port */
+           struct INET_ADDR_LIST *addr;/* inet listen address */
+       } inet_ep;
+#define MASTER_INET_ADDRLIST(s)        ((s)->endpoint.inet_ep.addr)
+#define MASTER_INET_PORT(s)    ((s)->endpoint.inet_ep.port)
+    } endpoint;
     int     max_proc;                  /* upper bound on # processes */
     char   *path;                      /* command pathname */
     struct ARGV *args;                 /* argument vector */
index 6a6e976f3d77b9847f7115655712bd6b2482cb20..3eb824c97513c5cd5b35d7ca40c7625a6bb298a9 100644 (file)
@@ -276,20 +276,21 @@ MASTER_SERV *get_master_ent()
     if (STR_SAME(transport, MASTER_XPORT_NAME_INET)) {
        serv->type = MASTER_SERV_TYPE_INET;
        atmp = inet_parse(name, &host, &port);
-       if (host && *host) {
+       if (*host) {
            serv->flags |= MASTER_FLAG_INETHOST;/* host:port */
-           serv->addr_list.inet =
-               (INET_ADDR_LIST *) mymalloc(sizeof(*serv->addr_list.inet));
-           inet_addr_list_init(serv->addr_list.inet);
-           inet_addr_host(serv->addr_list.inet, host);
-           serv->listen_fd_count = serv->addr_list.inet->used;
+           MASTER_INET_ADDRLIST(serv) = (INET_ADDR_LIST *)
+               mymalloc(sizeof(*MASTER_INET_ADDRLIST(serv)));
+           inet_addr_list_init(MASTER_INET_ADDRLIST(serv));
+           inet_addr_host(MASTER_INET_ADDRLIST(serv), host);
+           serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
        } else if (strcasecmp(var_inet_interfaces, DEF_INET_INTERFACES) == 0) {
-           serv->addr_list.inet = 0;           /* wild-card */
+           MASTER_INET_ADDRLIST(serv) = 0;     /* wild-card */
            serv->listen_fd_count = 1;
        } else {
-           serv->addr_list.inet = own_inet_addr_list();        /* virtual */
-           serv->listen_fd_count = serv->addr_list.inet->used;
+           MASTER_INET_ADDRLIST(serv) = own_inet_addr_list();  /* virtual */
+           serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
        }
+       MASTER_INET_PORT(serv) = mystrdup(port);
        myfree(atmp);
     } else if (STR_SAME(transport, MASTER_XPORT_NAME_UNIX)) {
        serv->type = MASTER_SERV_TYPE_UNIX;
@@ -463,8 +464,12 @@ void    free_master_ent(MASTER_SERV *serv)
     /*
      * Undo what get_master_ent() created.
      */
-    if (serv->flags & MASTER_FLAG_INETHOST)
-       inet_addr_list_free(serv->addr_list.inet);
+    if (serv->flags & MASTER_FLAG_INETHOST) {
+       inet_addr_list_free(MASTER_INET_ADDRLIST(serv));
+       myfree((char *) MASTER_INET_ADDRLIST(serv));
+    }
+    if (serv->type == MASTER_SERV_TYPE_INET)
+       myfree(MASTER_INET_PORT(serv));
     myfree(serv->name);
     myfree(serv->path);
     argv_free(serv->args);
index 9b1d9f8a771b75f33d97a0676c108ee68ae1a44b..9ff3056d1eb2394322f3cb363fd654fee5a77322 100644 (file)
@@ -107,15 +107,16 @@ void    master_listen_init(MASTER_SERV *serv)
         * bound to specific interface addresses.
         */
     case MASTER_SERV_TYPE_INET:
-       if (serv->addr_list.inet == 0) {        /* wild-card */
+       if (MASTER_INET_ADDRLIST(serv) == 0) {  /* wild-card */
            serv->listen_fd[0] =
-               inet_listen(serv->name, serv->max_proc > var_proc_limit ?
+               inet_listen(MASTER_INET_PORT(serv),
+                           serv->max_proc > var_proc_limit ?
                            serv->max_proc : var_proc_limit, NON_BLOCKING);
            close_on_exec(serv->listen_fd[0], CLOSE_ON_EXEC);
-       } else {                                /* virtual */
+       } else {                                /* virtual or host:port */
            for (n = 0; n < serv->listen_fd_count; n++) {
-               end_point = concatenate(inet_ntoa(serv->addr_list.inet->addrs[n]),
-                                       ":", serv->name, (char *) 0);
+               end_point = concatenate(inet_ntoa(MASTER_INET_ADDRLIST(serv)->addrs[n]),
+                                  ":", MASTER_INET_PORT(serv), (char *) 0);
                serv->listen_fd[n]
                    = inet_listen(end_point, serv->max_proc > var_proc_limit ?
                             serv->max_proc : var_proc_limit, NON_BLOCKING);
index 7f86197ec01f2ae694b083b63ba716cfbe5011d0..a4e55f0585f3a351277574b9474e97e7d867883e 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <utime.h>
+#include <errno.h>
 
 /* Utility library. */
 
@@ -73,12 +74,21 @@ void    qmgr_move(const char *src_queue, const char *dst_queue,
            if (time_stamp > 0) {
                tbuf.actime = tbuf.modtime = time_stamp;
                path = mail_queue_path((VSTRING *) 0, src_queue, queue_id);
-               if (utime(path, &tbuf) < 0)
-                   msg_fatal("%s: update %s time stamps: %m", myname, path);
+               if (utime(path, &tbuf) < 0) {
+                   if (errno != ENOENT)
+                       msg_fatal("%s: update %s time stamps: %m", myname, path);
+                   msg_warn("%s: update %s time stamps: %m", myname, path);
+                   continue;
+               }
+           }
+           if (mail_queue_rename(queue_id, src_queue, dst_queue)) {
+               if (errno != ENOENT)
+                   msg_fatal("%s: rename %s from %s to %s: %m",
+                             myname, queue_id, src_queue, dst_queue);
+               msg_warn("%s: rename %s from %s to %s: %m",
+                        myname, queue_id, src_queue, dst_queue);
+               continue;
            }
-           if (mail_queue_rename(queue_id, src_queue, dst_queue))
-               msg_fatal("%s: rename %s from %s to %s: %m",
-                         myname, queue_id, src_queue, dst_queue);
            if (msg_verbose)
                msg_info("%s: moved %s from %s to %s",
                         myname, queue_id, src_queue, dst_queue);
index 1fbc2a67d5496a6556591164e0635b8fbac91987..f5449495f749f3d633d352709d2b046b901cede8 100644 (file)
@@ -65,6 +65,7 @@ postalias.o: ../../include/readlline.h
 postalias.o: ../../include/stringops.h
 postalias.o: ../../include/split_at.h
 postalias.o: ../../include/get_hostname.h
+postalias.o: ../../include/vstring_vstream.h
 postalias.o: ../../include/tok822.h
 postalias.o: ../../include/resolve_clnt.h
 postalias.o: ../../include/mail_conf.h
index b2d64c2bf1d9b1e29e4bc60f34cf127925ec3332..bcc098a6b0c26862ec193ec7183e450847309ee8 100644 (file)
@@ -64,6 +64,7 @@ postmap.o: ../../include/msg_vstream.h
 postmap.o: ../../include/readlline.h
 postmap.o: ../../include/stringops.h
 postmap.o: ../../include/split_at.h
+postmap.o: ../../include/vstring_vstream.h
 postmap.o: ../../include/mail_conf.h
 postmap.o: ../../include/mail_params.h
 postmap.o: ../../include/mkmap.h
index e525247340b527f97a04985108be7296d265a4a2..6b4896e67f00023c29521f0af4f9ba47dad0ad96 100644 (file)
@@ -5,7 +5,8 @@
 /*     Postfix super intendent
 /* SYNOPSIS
 /* .fi
-/*     \fBpostsuper\fR [\fB-p\fR] [\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR]
+/*     \fBpostsuper\fR [\fB-d \fIqueue_id\fR] [\fB-p\fR]
+/*             [\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR]
 /* DESCRIPTION
 /*     The \fBpostsuper\fR command does small maintenance jobs on the named
 /*     Postfix queue directories (default: all).
 /*     nor directories.  Use of this command is restricted to the super-user.
 /*
 /*     Options:
+/* .IP \fB-d \fIqueue_id\fR
+/*     Delete one message queue file with the named queue ID.  Specify
+/*     multiple \fB-d\fR options to delete multiple queue files by name.
+/* .sp
+/*     Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified, the
+/*     program reads queue IDs from standard input.
+/* .sp
+/*     This operation can be performed safely while the mail system is
+/*     running, although the queue manager may issue warnings when a
+/*     file suddenly disappears. The exit status is zero if at least one
+/*     of the named message queue files was found.
 /* .IP \fB-s\fR
 /*     Structure check.  Move queue files that are in the wrong place
 /*     in the file system hierarchy and remove subdirectories that are
@@ -76,6 +88,7 @@
 #include <safe.h>
 #include <set_ugid.h>
 #include <argv.h>
+#include <vstring_vstream.h>
 
 /* Global library. */
 
 
 #define ACTION_STRUCT  (1<<0)          /* fix file organization */
 #define ACTION_PURGE   (1<<1)          /* purge old temp files */
+#define ACTION_DELETE  (1<<2)          /* delete named queue file(s) */
 
 #define ACTION_DEFAULT (ACTION_STRUCT | ACTION_PURGE)
 
@@ -121,6 +135,57 @@ static struct queue_info queue_info[] = {
     0,
 };
 
+/* delete_one - delete one message instance and all its associated files */
+
+static int delete_one(const char *queue_id)
+{
+    const char *msg_queue_names[] = {
+       MAIL_QUEUE_INCOMING,            /* twice, to avoid */
+       MAIL_QUEUE_ACTIVE,              /* missing a file while */
+       MAIL_QUEUE_DEFERRED,            /* it is being renamed */
+       MAIL_QUEUE_INCOMING,            /* this is not 100% */
+       MAIL_QUEUE_ACTIVE,              /* foolproof but adequate */
+       MAIL_QUEUE_DEFERRED,
+       0,
+    };
+    const char **cpp;
+    VSTRING *msg_path = vstring_alloc(100);
+    int     found = 0;
+
+    /*
+     * Do not delete defer or bounce logfiles, because we could lose a race
+     * and delete a defer/bounce logfile from a message that reuses the queue
+     * ID.
+     */
+    for (cpp = msg_queue_names; *cpp != 0; cpp++) {
+       (void) mail_queue_path(msg_path, *cpp, queue_id);
+       if (unlink(STR(msg_path)) == 0) {
+           found = 1;
+           if (msg_verbose)
+               msg_info("removed file %s", STR(msg_path));
+           break;
+       } else if (errno != ENOENT) {
+           msg_warn("remove file %s: %m", STR(msg_path));
+       }
+    }
+    vstring_free(msg_path);
+    return (found);
+}
+
+/* delete_stream - delete queue IDs given on stream */
+
+static int delete_stream(VSTREAM *fp)
+{
+    VSTRING *buf = vstring_alloc(20);
+    int     found = 0;
+
+    while (vstring_get_nonl(buf, fp) != VSTREAM_EOF)
+       found |= delete_one(STR(buf));
+
+    vstring_free(buf);
+    return (found);
+}
+
 /* super - check queue file location and clean up */
 
 static void super(char **queues, int action)
@@ -286,6 +351,7 @@ int     main(int argc, char **argv)
     int     action = 0;
     char  **queues;
     int     c;
+    int     found = 0;
 
     /*
      * Defaults.
@@ -356,11 +422,18 @@ int     main(int argc, char **argv)
     /*
      * Parse JCL.
      */
-    while ((c = GETOPT(argc, argv, "spv")) > 0) {
+    while ((c = GETOPT(argc, argv, "d:spv")) > 0) {
        switch (c) {
        default:
-           msg_fatal("usage: %s [-s (fix structure)] [-p (purge stale files)]",
+           msg_fatal("usage: %s [-d queue_id] [-p (purge stale files)] [-s (fix structure)]",
                      argv[0]);
+       case 'd':
+           if (strcmp(optarg, "-") == 0)
+               found |= delete_stream(VSTREAM_IN);
+           else
+               found |= delete_one(optarg);
+           action |= ACTION_DELETE;
+           break;
        case 's':
            action |= ACTION_STRUCT;
            break;
@@ -384,7 +457,8 @@ int     main(int argc, char **argv)
     else
        queues = argv + optind;
 
-    super(queues, action);
+    if (action & ~ACTION_DELETE)
+       super(queues, action & ~ACTION_DELETE);
 
-    exit(0);
+    exit((action & ACTION_DELETE) ? !found : 0);
 }
index 7f86197ec01f2ae694b083b63ba716cfbe5011d0..a4e55f0585f3a351277574b9474e97e7d867883e 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <string.h>
 #include <utime.h>
+#include <errno.h>
 
 /* Utility library. */
 
@@ -73,12 +74,21 @@ void    qmgr_move(const char *src_queue, const char *dst_queue,
            if (time_stamp > 0) {
                tbuf.actime = tbuf.modtime = time_stamp;
                path = mail_queue_path((VSTRING *) 0, src_queue, queue_id);
-               if (utime(path, &tbuf) < 0)
-                   msg_fatal("%s: update %s time stamps: %m", myname, path);
+               if (utime(path, &tbuf) < 0) {
+                   if (errno != ENOENT)
+                       msg_fatal("%s: update %s time stamps: %m", myname, path);
+                   msg_warn("%s: update %s time stamps: %m", myname, path);
+                   continue;
+               }
+           }
+           if (mail_queue_rename(queue_id, src_queue, dst_queue)) {
+               if (errno != ENOENT)
+                   msg_fatal("%s: rename %s from %s to %s: %m",
+                             myname, queue_id, src_queue, dst_queue);
+               msg_warn("%s: rename %s from %s to %s: %m",
+                        myname, queue_id, src_queue, dst_queue);
+               continue;
            }
-           if (mail_queue_rename(queue_id, src_queue, dst_queue))
-               msg_fatal("%s: rename %s from %s to %s: %m",
-                         myname, queue_id, src_queue, dst_queue);
            if (msg_verbose)
                msg_info("%s: moved %s from %s to %s",
                         myname, queue_id, src_queue, dst_queue);
index e9311ef4a552d59b2a7af921555738659c97fe8f..978ff14b07730ed22ef91d9a53e2e6f11d943f92 100644 (file)
@@ -517,12 +517,10 @@ static void show_queue(void)
     signal(SIGPIPE, SIG_DFL);
     if ((showq = mail_connect(MAIL_CLASS_PUBLIC, MAIL_SERVICE_SHOWQ, BLOCKING)) != 0) {
        while ((n = vstream_fread(showq, buf, sizeof(buf))) > 0)
-           if (vstream_fwrite(VSTREAM_OUT, buf, n) != n)
+           if (vstream_fwrite(VSTREAM_OUT, buf, n) != n
+               || vstream_fflush(VSTREAM_OUT) != 0)
                msg_fatal("write error: %m");
 
-       if (vstream_fflush(VSTREAM_OUT))
-           msg_fatal("write error: %m");
-
        if (vstream_fclose(showq))
            msg_warn("close: %m");
     }
index ed46099b66507f1d8e8cee7af5fbdc155c6f342b..15f860f611cb08938f431cfc6c0b960edfb39d42 100644 (file)
@@ -91,6 +91,7 @@ smtp_addr.o: ../../include/vbuf.h
 smtp_addr.o: ../../include/mymalloc.h
 smtp_addr.o: ../../include/inet_addr_list.h
 smtp_addr.o: ../../include/stringops.h
+smtp_addr.o: ../../include/myrand.h
 smtp_addr.o: ../../include/mail_params.h
 smtp_addr.o: ../../include/own_inet_addr.h
 smtp_addr.o: ../../include/dns.h
index bbf1d4cb5e448d30526edec6edb8d8fc2af324aa..223e70db599928a474e458a6ea1994baa9ad7e05 100644 (file)
@@ -128,20 +128,6 @@ static void smtp_print_addr(char *what, DNS_RR *addr_list)
     msg_info("end %s address list", what);
 }
 
-/* smtp_rand_addr - randomize equal-preference resource records */
-
-static int smtp_rand_addr(DNS_RR *a, DNS_RR *b)
-{
-    int     diff;
-
-    /*
-     * XXX Equal-preference records are made to appear different. The bogus
-     * difference is not consistent from one call to the next. Code based on
-     * an idea by Aleph1.
-     */
-    return ((diff = a->pref - b->pref != 0) ? diff : (myrand() & 1) ? -1 : 1);
-}
-
 /* smtp_addr_one - address lookup for one host name */
 
 static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRING *why)
@@ -377,8 +363,10 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why, int *found_myself)
                }
            }
        }
-       if (addr_list && var_smtp_rand_addr)
-           addr_list = dns_rr_sort(addr_list, smtp_rand_addr);
+       if (addr_list && addr_list->next && var_smtp_rand_addr) {
+           addr_list = dns_rr_shuffle(addr_list);
+           addr_list = dns_rr_sort(addr_list, smtp_compare_pref);
+       }
        break;
     case DNS_NOTFOUND:
        addr_list = smtp_host_addr(name, why);
@@ -404,8 +392,8 @@ DNS_RR *smtp_host_addr(char *host, VSTRING *why)
      */
 #define PREF0  0
     addr_list = smtp_addr_one((DNS_RR *) 0, host, PREF0, why);
-    if (addr_list && var_smtp_rand_addr)
-       addr_list = dns_rr_sort(addr_list, smtp_rand_addr);
+    if (addr_list && addr_list->next && var_smtp_rand_addr)
+       addr_list = dns_rr_shuffle(addr_list);
     if (msg_verbose)
        smtp_print_addr(host, addr_list);
     return (addr_list);
index d93043b82fbead1fb4ce8c2a8e5a7b823c2c97ec..48f8c82e871342d909929d0550eb3a8fa0b8e81d 100644 (file)
@@ -834,7 +834,7 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
            state->error_mask |= MAIL_ERROR_PROTOCOL;
            smtpd_chat_reply(state, "503 Error: need RCPT command");
        } else {
-           smtpd_chat_reply(state, "550 Error: no valid recipients");
+           smtpd_chat_reply(state, "554 Error: no valid recipients");
        }
        return (-1);
     }
index 038ffb8f3ecfb303b8f83f6b293932296be99708..656a652ba66721d6521911fe285127f752252036 100644 (file)
 /*     SMTPD_STATE *state;
 /*     char    *recipient;
 /*
+/*     char    *smtpd_check_rcptmap(state, recipient)
+/*     SMTPD_STATE *state;
+/*     char    *recipient;
+/*
 /*     char    *smtpd_check_etrn(state, destination)
 /*     SMTPD_STATE *state;
 /*     char    *destination;
 /*     Restrictions on the recipient address that is sent with the RCPT
 /*     TO command.
 /* .PP
+/*     smtpd_check_rcptmap() validates the recipient address provided
+/*     with an RCPT TO request. Relevant configuration parameters:
+/* .IP local_recipients_map
+/*     Tables of user names (not addresses) that exist in $mydestination.
+/*     Mail for local users not in these tables is rejected.
+/* .PP
 /*     smtpd_check_etrn() validates the domain name provided with the
 /*     ETRN command, and other client-provided information. Relevant
 /*     configuration parameters:
index 02e11e9e9e568fbce9b7e91509caf97151ec6cdc..f7c3cdd709d0e8bfda7f642f6837c708128a53d6 100644 (file)
@@ -111,12 +111,12 @@ rcpt foo@porcupine.org
 #
 # MX backup
 #
-mydestination spike.porcupine.org,localhost.porcupine.org
-inet_interfaces 168.100.189.2,127.0.0.1
-recipient_restrictions permit_mx_backup,reject
-rcpt wietse@wzv.win.tue.nl
-rcpt wietse@trouble.org
-rcpt wietse@porcupine.org
+#mydestination spike.porcupine.org,localhost.porcupine.org
+#inet_interfaces 168.100.189.2,127.0.0.1
+#recipient_restrictions permit_mx_backup,reject
+#rcpt wietse@wzv.win.tue.nl
+#rcpt wietse@trouble.org
+#rcpt wietse@porcupine.org
 #
 # Deferred restrictions
 #
index b631b3c86bdf47616d22c02813702753c5f1e351..b63c3f7054554efe9be72e275e2d6b59e10a9eed 100644 (file)
@@ -47,8 +47,6 @@ OK
 >>> client foo 123.123.123.123
 OK
 >>> helo foo.
-./smtpd_check: warning: valid_hostname: misplaced delimiter: foo.
-./smtpd_check: warning: valid_hostname: misplaced delimiter: foo.
 ./smtpd_check: reject: HELO from foo[123.123.123.123]: 450 <foo.>: Helo command rejected: Host not found
 450 <foo.>: Helo command rejected: Host not found
 >>> helo foo
@@ -66,9 +64,6 @@ OK
 >>> helo_restrictions reject_invalid_hostname,reject_unknown_hostname
 OK
 >>> helo 123.123.123.123
-./smtpd_check: warning: valid_hostname: numeric hostname: 123.123.123.123
-./smtpd_check: warning: valid_hostname: numeric hostname: 123.123.123.123
-./smtpd_check: warning: valid_hostname: numeric hostname: 123.123.123.123
 ./smtpd_check: reject: HELO from foo[123.123.123.123]: 450 <123.123.123.123>: Helo command rejected: Host not found
 450 <123.123.123.123>: Helo command rejected: Host not found
 >>> helo_restrictions permit_naked_ip_address,reject_invalid_hostname,reject_unknown_hostname
@@ -186,8 +181,8 @@ OK
 >>> client spike.porcupine.org 168.100.189.2
 OK
 >>> client foo 127.0.0.2
-./smtpd_check: reject: CONNECT from foo[127.0.0.2]: 554 Service unavailable; [127.0.0.2] blocked using rbl.maps.vix.com, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>; from=<foo@friend.bad.domain>
-554 Service unavailable; [127.0.0.2] blocked using rbl.maps.vix.com, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
+./smtpd_check: reject: CONNECT from foo[127.0.0.2]: 554 Service unavailable; [127.0.0.2] blocked using blackholes.mail-abuse.org, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>; from=<foo@friend.bad.domain>
+554 Service unavailable; [127.0.0.2] blocked using blackholes.mail-abuse.org, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
 >>> #
 >>> # Hybrids
 >>> #
@@ -215,7 +210,6 @@ OK
 ./smtpd_check: reject: RCPT from foo[131.155.210.17]: 554 <bad.domain>: Helo command rejected: match bad.domain; from=<foo@friend.bad.domain> to=<foo@porcupine.org>
 554 <bad.domain>: Helo command rejected: match bad.domain
 >>> helo 131.155.210.17
-./smtpd_check: warning: valid_hostname: numeric hostname: 131.155.210.17
 OK
 >>> rcpt foo@porcupine.org
 OK
@@ -234,19 +228,12 @@ OK
 >>> #
 >>> # MX backup
 >>> #
->>> mydestination spike.porcupine.org,localhost.porcupine.org
-OK
->>> inet_interfaces 168.100.189.2,127.0.0.1
-OK
->>> recipient_restrictions permit_mx_backup,reject
-OK
->>> rcpt wietse@wzv.win.tue.nl
-OK
->>> rcpt wietse@trouble.org
-./smtpd_check: reject: RCPT from foo[131.155.210.17]: 554 <wietse@trouble.org>: Recipient address rejected: Access denied; from=<foo@friend.bad.domain> to=<wietse@trouble.org>
-554 <wietse@trouble.org>: Recipient address rejected: Access denied
->>> rcpt wietse@porcupine.org
-OK
+>>> #mydestination spike.porcupine.org,localhost.porcupine.org
+>>> #inet_interfaces 168.100.189.2,127.0.0.1
+>>> #recipient_restrictions permit_mx_backup,reject
+>>> #rcpt wietse@wzv.win.tue.nl
+>>> #rcpt wietse@trouble.org
+>>> #rcpt wietse@porcupine.org
 >>> #
 >>> # Deferred restrictions
 >>> #
@@ -316,68 +303,52 @@ OK
 >>> helo [1.2.3.4]
 OK
 >>> helo [321.255.255.255]
-./smtpd_check: warning: valid_hostaddr: invalid octet value: 321.255.255.255
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[321.255.255.255]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[321.255.255.255]>: Helo command rejected: invalid ip address
 >>> helo [0.255.255.255]
-./smtpd_check: warning: valid_hostaddr: bad initial octet value: 0.255.255.255
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[0.255.255.255]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[0.255.255.255]>: Helo command rejected: invalid ip address
 >>> helo [1.2.3.321]
-./smtpd_check: warning: valid_hostaddr: invalid octet value: 1.2.3.321
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[1.2.3.321]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[1.2.3.321]>: Helo command rejected: invalid ip address
 >>> helo [1.2.3]
-./smtpd_check: warning: valid_hostaddr: invalid octet count: 1.2.3
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[1.2.3]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[1.2.3]>: Helo command rejected: invalid ip address
 >>> helo [1.2.3.4.5]
-./smtpd_check: warning: valid_hostaddr: invalid octet count: 1.2.3.4.5
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[1.2.3.4.5]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[1.2.3.4.5]>: Helo command rejected: invalid ip address
 >>> helo [1..2.3.4]
-./smtpd_check: warning: valid_hostaddr: misplaced dot: 1..2.3.4
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[1..2.3.4]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[1..2.3.4]>: Helo command rejected: invalid ip address
 >>> helo [.1.2.3.4]
-./smtpd_check: warning: valid_hostaddr: misplaced dot: .1.2.3.4
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[.1.2.3.4]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[.1.2.3.4]>: Helo command rejected: invalid ip address
 >>> helo [1.2.3.4.5.]
-./smtpd_check: warning: valid_hostaddr: misplaced dot: 1.2.3.4.5.
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <[1.2.3.4.5.]>: Helo command rejected: invalid ip address; from=<foo>
 501 <[1.2.3.4.5.]>: Helo command rejected: invalid ip address
 >>> helo 1.2.3.4
 OK
 >>> helo 321.255.255.255
-./smtpd_check: warning: valid_hostaddr: invalid octet value: 321.255.255.255
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <321.255.255.255>: Helo command rejected: invalid ip address; from=<foo>
 501 <321.255.255.255>: Helo command rejected: invalid ip address
 >>> helo 0.255.255.255
-./smtpd_check: warning: valid_hostaddr: bad initial octet value: 0.255.255.255
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <0.255.255.255>: Helo command rejected: invalid ip address; from=<foo>
 501 <0.255.255.255>: Helo command rejected: invalid ip address
 >>> helo 1.2.3.321
-./smtpd_check: warning: valid_hostaddr: invalid octet value: 1.2.3.321
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <1.2.3.321>: Helo command rejected: invalid ip address; from=<foo>
 501 <1.2.3.321>: Helo command rejected: invalid ip address
 >>> helo 1.2.3
-./smtpd_check: warning: valid_hostaddr: invalid octet count: 1.2.3
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <1.2.3>: Helo command rejected: invalid ip address; from=<foo>
 501 <1.2.3>: Helo command rejected: invalid ip address
 >>> helo 1.2.3.4.5
-./smtpd_check: warning: valid_hostaddr: invalid octet count: 1.2.3.4.5
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <1.2.3.4.5>: Helo command rejected: invalid ip address; from=<foo>
 501 <1.2.3.4.5>: Helo command rejected: invalid ip address
 >>> helo 1..2.3.4
-./smtpd_check: warning: valid_hostaddr: misplaced dot: 1..2.3.4
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <1..2.3.4>: Helo command rejected: invalid ip address; from=<foo>
 501 <1..2.3.4>: Helo command rejected: invalid ip address
 >>> helo .1.2.3.4
-./smtpd_check: warning: valid_hostaddr: misplaced dot: .1.2.3.4
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <.1.2.3.4>: Helo command rejected: invalid ip address; from=<foo>
 501 <.1.2.3.4>: Helo command rejected: invalid ip address
 >>> helo 1.2.3.4.5.
-./smtpd_check: warning: valid_hostaddr: misplaced dot: 1.2.3.4.5.
 ./smtpd_check: reject: HELO from foo[131.155.210.17]: 501 <1.2.3.4.5.>: Helo command rejected: invalid ip address; from=<foo>
 501 <1.2.3.4.5.>: Helo command rejected: invalid ip address
index 155cb6104d1c7a38b4c8b534d70eb7aa98f9de1f..c8d014f6000a2013ba125cd0f53188be04513864 100644 (file)
@@ -47,8 +47,6 @@ OK
 >>> client foo 123.123.123.123
 OK
 >>> helo foo.
-./smtpd_check: warning: valid_hostname: misplaced delimiter: foo.
-./smtpd_check: warning: valid_hostname: misplaced delimiter: foo.
 ./smtpd_check: reject: HELO from foo[123.123.123.123]: 450 <foo.>: Helo command rejected: Host not found
 450 <foo.>: Helo command rejected: Host not found
 >>> helo foo
@@ -174,8 +172,8 @@ OK
 >>> client spike.porcupine.org 168.100.189.2
 OK
 >>> client foo 127.0.0.2
-./smtpd_check: reject: CONNECT from foo[127.0.0.2]: 554 Service unavailable; [127.0.0.2] blocked using rbl.maps.vix.com, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>; from=<foo@friend.bad.domain>
-554 Service unavailable; [127.0.0.2] blocked using rbl.maps.vix.com, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
+./smtpd_check: reject: CONNECT from foo[127.0.0.2]: 554 Service unavailable; [127.0.0.2] blocked using blackholes.mail-abuse.org, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>; from=<foo@friend.bad.domain>
+554 Service unavailable; [127.0.0.2] blocked using blackholes.mail-abuse.org, reason: Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
 >>> #
 >>> # unknown sender/recipient domain
 >>> #
index c9789271dbb227cafcc2f889ce08dde025000e36..244bae4ad910d2e761bd358a4500b827e9f78c7a 100644 (file)
@@ -810,6 +810,7 @@ printable.o: vbuf.h
 rand_sleep.o: rand_sleep.c
 rand_sleep.o: sys_defs.h
 rand_sleep.o: msg.h
+rand_sleep.o: myrand.h
 rand_sleep.o: iostuff.h
 read_wait.o: read_wait.c
 read_wait.o: sys_defs.h
index 52d839c6c4c7a496dc49fdd6c07341eac69687a2..d86f2bce10e67d6e29fbbe9eee10063ce1d72977 100644 (file)
 /*     mysrand() performs initialization. This call may be skipped.
 /*
 /*     myrand() returns a pseudo-random number in the range [0, RAND_MAX].
-/*     If mysrand() was not called, it is invoked with the process ID.
+/*     If mysrand() was not called, it is invoked with the process ID
+/*     ex-or-ed with the time of day in seconds.
 /* LICENSE
 /* .ad
 /* .fi
 /*     The Secure Mailer license must be distributed with this software.
+/* WARNING
+/*     Do not use this code for generating unpredictable numbers.
 /* AUTHOR(S)
 /*     Wietse Venema
 /*     IBM T.J. Watson Research
@@ -34,6 +37,7 @@
 #include <sys_defs.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <time.h>
 
 /* Utility library. */
 
@@ -54,6 +58,6 @@ void    mysrand(int seed)
 int     myrand(void)
 {
     if (myrand_initdone == 0)
-       mysrand(getpid());
+       mysrand(getpid() ^ time((time_t *) 0));
     return (rand());
 }
index 13c071cc7c1708cdd8594f383210bcf1368baed3..20016e57e67dfd32c717db3836e4169f199ad48d 100644 (file)
@@ -6,7 +6,7 @@
 /* SYNOPSIS
 /*     #include <sane_fsops.h>
 /*
-/*     int     sane_link(old, new)
+/*     int     sane_link(from, to)
 /*     const char *from;
 /*     const char *to;
 /* DESCRIPTION
index 53af93cbb104c6fb26554cb6b32adb2b406b2b8c..52c6d4c7ff392d14fb9241abfa102cb96f08042f 100644 (file)
@@ -10,7 +10,7 @@
 /*     int     fd;
 /* DESCRIPTION
 /*     writable() asks the kernel if the specified file descriptor
-/*     is writable, i.e. a read operation would not block.
+/*     is writable, i.e. a write operation would not block.
 /*
 /*     Arguments:
 /* .IP fd