]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-19990831
authorWietse Venema <wietse@porcupine.org>
Tue, 31 Aug 1999 05:00:00 +0000 (00:00 -0500)
committerWietse Venema <wietse@porcupine.org>
Thu, 17 Jan 2013 23:09:31 +0000 (18:09 -0500)
73 files changed:
postfix/0README
postfix/BEWARE [new file with mode: 0644]
postfix/HISTORY
postfix/INSTALL
postfix/LICENSE
postfix/cleanup/cleanup.c
postfix/cleanup/cleanup_extracted.c
postfix/conf/LICENSE
postfix/conf/aliases
postfix/conf/main.cf
postfix/conf/master.cf
postfix/conf/postfix-script-nosgid
postfix/conf/postfix-script-sgid
postfix/conf/sample-misc.cf
postfix/conf/sample-regexp.cf
postfix/conf/sample-smtpd.cf
postfix/examples/chroot-setup/Solaris2
postfix/global/Makefile.in
postfix/global/deliver_request.c
postfix/global/deliver_request.h
postfix/global/mail_connect.c
postfix/global/mail_params.h
postfix/global/mail_version.h
postfix/global/maps.c
postfix/html/cleanup.8.html
postfix/html/faq.html
postfix/html/local.8.html
postfix/html/postalias.1.html
postfix/html/postconf.1.html
postfix/html/postlock.1.html
postfix/html/postmap.1.html
postfix/html/uce.html
postfix/local/Makefile.in
postfix/local/command.c
postfix/local/dotforward.c
postfix/local/forward.c
postfix/local/local.c
postfix/local/local_expand.c
postfix/makedefs
postfix/man/man1/postalias.1
postfix/man/man1/postconf.1
postfix/man/man1/postlock.1
postfix/man/man1/postmap.1
postfix/man/man8/cleanup.8
postfix/man/man8/local.8
postfix/pickup/pickup.c
postfix/pipe/Makefile.in
postfix/pipe/pipe.c
postfix/postalias/postalias.c
postfix/postconf/Makefile.in
postfix/postconf/extract.awk [moved from postfix/postconf/extract.sh with 96% similarity]
postfix/postconf/postconf.c
postfix/postlock/postlock.c
postfix/postmap/postmap.c
postfix/qmgr/qmgr.h
postfix/qmgr/qmgr_active.c
postfix/qmgr/qmgr_message.c
postfix/sendmail/sendmail.c
postfix/showq/showq.c
postfix/smtp/Makefile.in
postfix/smtp/smtp.c
postfix/smtp/smtp_addr.c
postfix/smtp/smtp_connect.c
postfix/smtp/smtp_proto.c
postfix/smtpd/smtpd_check.c
postfix/smtpstone/smtp-source.c
postfix/util/Makefile.in
postfix/util/dict_db.c
postfix/util/dict_dbm.c
postfix/util/inet_addr_local.c
postfix/util/scan_dir.c
postfix/util/split_at.c
postfix/util/sys_defs.h

index 6f501299781afba434fd851e00d9cca2606e0a93..b09fc924709addc52b1e2ce892e1c2c072e8a27d 100644 (file)
@@ -106,6 +106,11 @@ Documentation:
     html/              HTML format
     man/               UNIX on-line manual page format
 
+Example files:
+
+    conf/              sample configuration files
+    examples/          chroot environments, virtual domains
+
 Library routines:
 
     dns/               DNS client library
diff --git a/postfix/BEWARE b/postfix/BEWARE
new file mode 100644 (file)
index 0000000..cac1f38
--- /dev/null
@@ -0,0 +1,38 @@
+LINUX SYSLOGD PERFORMANCE
+=========================
+
+LINUX syslogd uses synchronous writes by default, which is very
+expensive. For services such a mail it is recommended that you
+disable synchronous logfile writes by prepending a - to the logfile
+name:
+
+    mail.*                          -/var/log/mail.log
+
+SPAM BLOCKING SOURCE ROUTED ADDRESSES
+=====================================
+
+If you relay mail for other domains, you must prevent unauthorized
+relay of addresses such as:
+
+    user@elsewhere@the.other.domain
+    user%elsewhere@the.other.domain
+    elsewhere!user@the.other.domain
+
+The simplest solution is to install a regular expression filter:
+
+    /etc/postfix/main.cf: 
+       smtpd_recipient_restrictions = regexp:/etc/postfix/regexp_access
+
+    /etc/postfix/regexp_access:
+       /[%!@].*@/ 550 Sender specified routing is not supported here.
+
+For the local domain, Postfix will do the right thing with:
+
+    user@elsewhere@my.own.domain
+    user%elsewhere@my.own.domain
+    elsewhere!user@my.own.domain
+
+That is, it bounces the first form because "user@elsewhere" is not
+a valid local user, and it accepts the second and third forms only
+when user@elsewhere is a valid relay destination.
+
index 4c8056521da1deb9d1149a36e241aa655aafd22a..ef70ad097819b440f193180350286824d021d7e3 100644 (file)
@@ -2887,3 +2887,111 @@ Apologies for any names omitted.
        is:  "prepend_delivered_header = command, file, forward".
        Turning off the Delivered-To: header when forwarding mail
        is not recommended.
+
+19990628
+
+       Feature: the postlock command now returns EX_TEMPFAIL
+       when the destination file is locked by another process.
+
+19990705
+
+       Workaround: in the SMTP client, move the "mail loops back
+       to myself test" from the 220 greeting to the HELO response.
+       This change does not weaken the test, and makes Postfix
+       more robust against broken software that greets with the
+       client hostname.
+
+19990706
+
+       Workaround: in the INSTALL file, use `&&' instead of `;'
+       in (cd path; tar ...) pipelines because some UNIX re-invented
+       shells don't bail out when cd fails. Matthias Andree
+       @dosis.uni-dortmund.de.
+
+19990709
+
+       Bugfix: $user was not set when delivering to a non-user.
+       Found by Vladimir Ulogov @ rohan.control.att.com when
+       configuring a luser_relay that contained $user.
+
+19990714
+
+       Robustness: add PATH statement to Solaris2 chroot setup
+       script to avoid running the ucb commands. Problem found
+       by Panagiotis Astithas @ ece.ntua.gr.
+
+19990721
+
+       Bugfix: don't claim a "mail loops to myself" error when
+       the best MX host was not found in the DNS. Found by Andrew
+       McNamara, connect.com.au Pty Ltd. File: smtp/smtp_addr.c.
+
+19990810
+
+       Feature: added "-c config_directory" support to the postconf
+       command. This probably means that "-f file" will never be
+       implemented.
+
+19990812
+
+       Bugfix: showq didn't print properly when listing a maildrop
+       file.  Fix by: Andrew McNamara, connect.com.au Pty Ltd.
+       File: showq/showq.c.
+
+       Feature: added SENDER to the list of parameters exported
+       to external commands. File: local/command.c. Code by: Lars
+       Hecking, National Microelectronics Research Centre, Ireland.
+
+19990813
+
+       Bugfix: sendmail -t (extract recipients from headers) did not
+       work when the always_bcc feature was turned on. Reported
+       by: Denis Shaposhnikov @ neva.vlink.ru.
+
+19990813
+       Bugfix: "sendmail -bd" returns a bogus exit status (the child
+       process ID). Fix by Lamont Jones of Hewlett-Packard. File:
+       sendmail/sendmail.c.
+
+19990824
+
+       Bugfix: null pointer dereference while rejecting VRFY before
+       MAIL FROM. Found by Laurent Wacrenier @ fr.clara.net.
+
+19990826
+
+       Portability: more MacOS X Server patches; some NEXTSTEP/OPENSTEP
+       code that had been removed for the first public beta release;
+       NEXTSTEP/OPENSTEP now defaults to netinfo for the aliases
+       database.  Submitted by Gerben Wierda.
+
+       Portability: workaround for a FreeBSD 3.x active network
+       interface without IP address by Pierre Beyssac @ enst.fr.
+       File:  inet_addr_local.c.
+
+19990831
+
+       Workaround: sendmail now prints a warning when installed
+       set-uid or when run by a set-uid command. Reportedly, the
+       linuxconf software turns on the set-uid bit, which could
+       open up a security loophole. File: sendmail/sendmail.c.
+
+       Bugfix: Postfix daemons now temporarily lock DB/DBM files
+       while opening them, in order to avoid "invalid argument"
+       errors because some other process is changing the file.
+       Files: util/dict_db.c, util/dict_dbm.c.
+
+       Robustness: Postfix locks queue files during delivery, to
+       prevent duplicate delivery when "postfix reload" is
+       immediately followed by "sendmail -q". This involves a
+       change of the deliver_request interface:  delivery agents
+       no longer need to open and close queue files explicitly.
+       Files:  global/deliver_request.c, pipe/pipe.c, smtp/smtp.c,
+       local/local.c, qmgr/qmgr_active.c, qmgr/qmgr_message.c.
+
+       Feature: reject_unauth_destination SMTP recipient restriction
+       that rejects destinations not in $relay_domains.  By Lamont
+       Jones of Hewlett-Packard.  File: smtpd/smtpd_check.c.
+
+       Robustness: postconf now validates the syntax of all main.cf
+       parameters.
index b133cf5a9d2f73e02cb0e31d0fb65f2445344bba..9eabab10e026ef25f89352e8636a0e4540417f3f 100644 (file)
@@ -46,6 +46,7 @@ those embedded manual pages are available in the mantools directory.
 
 If your system is supported, it is one of
 
+    AIX 3.2.5
     AIX 4.1.x
     AIX 4.2.0
     BSD/OS 2.x
@@ -65,16 +66,20 @@ If your system is supported, it is one of
     Linux RedHat 5.x
     Linux Slackware 3.5
     Linux SuSE 5.x
+    Mac OS X server
     NEXTSTEP 3.x
     NetBSD 1.x
     OPENSTEP 4.x
+    OSF1.V3 (Digital UNIX)
     OSF1.V4 aka Digital UNIX V4
     OpenBSD 2.x
+    Reliant UNIX 5.x
+    Rhapsody 5.x
     SunOS 4.1.x
     SunOS 5.4..5.7 (Solaris 2.4..7)
+    Ultrix 4.x
 
-or something closely resemblant. Some platforms such as Ultrix 4
-need a bit of work because their shell is a bit brain damaged.
+or something closely resemblant.
 
 If at any time in the build process you get messages like: "make:
 don't know how to ..." you should be able to recover by running
@@ -210,7 +215,7 @@ Installing Postfix by hand takes only a few steps.
 - On-line manual pages:
 
     # mkdir /some/where/man
-    # (cd man; tar cf - .) | (cd /some/where/man; tar xvf -)
+    # (cd man && tar cf - .) | (cd /some/where/man && tar xvf -)
 
   Alternative: leave the manpages in the Postfix source tree.
 
index 2f1ba0c2f36e00b67e93b7f5123d3c9e98fa94ab..45b98347aea53df72fabf04ee625172ec4adc0b7 100644 (file)
@@ -1,4 +1,4 @@
-IBM PUBLIC LICENSE VERSION 1.0 6/14/1999 - SECURE MAILER
+IBM PUBLIC LICENSE VERSION 1.0 - SECURE MAILER
 
 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC
 LICENSE ("AGREEMENT").  ANY USE, REPRODUCTION OR DISTRIBUTION OF THE
@@ -106,8 +106,8 @@ When the Program is made available in source code form:
 Each Contributor must include the following in a conspicuous location 
 in the Program: 
 
-    Copyright (c) {date here}, International Business Machines Corporation 
-    and others. All Rights Reserved.  
+    Copyright (c) 1997,1998,1999, International Business Machines
+    Corporation and others. All Rights Reserved.
 
 In addition, each Contributor must identify itself as the originator of
 its Contribution, if any, in a manner that reasonably allows subsequent
index 2a66a5f1a8125865a1c0d496ed16153100472f6d..f40e27751bd7437248af627e847fedaa0bcecaef 100644 (file)
 /* CONFIGURATION PARAMETERS
 /* .ad
 /* .fi
-/*      The following \fBmain.cf\fR parameters are especially relevant to
-/*      this program. See the Postfix \fBmain.cf\fR file for syntax details
-/*      and for default values. Use the \fBpostfix reload\fR command after
-/*      a configuration change.
+/*     The following \fBmain.cf\fR parameters are especially relevant to
+/*     this program. See the Postfix \fBmain.cf\fR file for syntax details
+/*     and for default values. Use the \fBpostfix reload\fR command after
+/*     a configuration change.
 /* .SH Miscellaneous
 /* .ad
 /* .fi
+/* .IP \fBalways_bcc\fR
+/*     Address to send a copy of each message that enters the system.
 /* .IP \fBhopcount_limit\fR
 /*     Limit the number of \fBReceived:\fR message headers.
 /* .SH "Address transformations"
@@ -174,6 +176,7 @@ int     var_dup_filter_limit;               /* recipient dup filter */
 char   *var_empty_addr;                        /* destination of bounced bounces */
 int     var_delay_warn_time;           /* delay that triggers warning */
 char   *var_prop_extension;            /* propagate unmatched extension */
+char   *var_always_bcc;
 
  /*
   * Mappings.
@@ -400,7 +403,7 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
     if (*var_masq_domains)
        cleanup_masq_domains = argv_split(var_masq_domains, " ,\t\r\n");
     if (*var_header_checks)
-       cleanup_header_checks = 
+       cleanup_header_checks =
            maps_create(VAR_HEADER_CHECKS, var_header_checks, DICT_FLAG_LOCK);
 }
 
@@ -456,6 +459,7 @@ int     main(int argc, char **argv)
        VAR_MASQ_EXCEPTIONS, DEF_MASQ_EXCEPTIONS, &var_masq_exceptions, 0, 0,
        VAR_HEADER_CHECKS, DEF_HEADER_CHECKS, &var_header_checks, 0, 0,
        VAR_PROP_EXTENSION, DEF_PROP_EXTENSION, &var_prop_extension, 0, 0,
+       VAR_ALWAYS_BCC, DEF_ALWAYS_BCC, &var_always_bcc, 0, 0,
        0,
     };
 
index 1057273f5669049854904b063a24f7f53ed44273..f7e2b94b943204129710f7a0562ad19ec8d1c499 100644 (file)
@@ -118,9 +118,24 @@ void    cleanup_extracted(void)
 
     /*
      * Optionally account for missing recipient envelope records.
+     * 
+     * XXX Code duplication from cleanup_envelope.c. This should be in one
+     * place.
      */
     if (cleanup_recip == 0) {
        rcpt = (cleanup_resent[0] ? cleanup_resent_recip : cleanup_recipients);
+       if (*var_always_bcc && rcpt->argv[0]) {
+           clean_addr = vstring_alloc(100);
+           cleanup_rewrite_internal(clean_addr, var_always_bcc);
+           if (cleanup_rcpt_canon_maps)
+               cleanup_map11_internal(clean_addr, cleanup_rcpt_canon_maps,
+                               cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
+           if (cleanup_comm_canon_maps)
+               cleanup_map11_internal(clean_addr, cleanup_comm_canon_maps,
+                               cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
+           argv_add(rcpt, STR(clean_addr), (char *) 0);
+           vstring_free(clean_addr);
+       }
        argv_terminate(rcpt);
        for (cpp = rcpt->argv; CLEANUP_OUT_OK() && *cpp; cpp++)
            cleanup_out_recipient(*cpp);
index 2f1ba0c2f36e00b67e93b7f5123d3c9e98fa94ab..45b98347aea53df72fabf04ee625172ec4adc0b7 100644 (file)
@@ -1,4 +1,4 @@
-IBM PUBLIC LICENSE VERSION 1.0 6/14/1999 - SECURE MAILER
+IBM PUBLIC LICENSE VERSION 1.0 - SECURE MAILER
 
 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC
 LICENSE ("AGREEMENT").  ANY USE, REPRODUCTION OR DISTRIBUTION OF THE
@@ -106,8 +106,8 @@ When the Program is made available in source code form:
 Each Contributor must include the following in a conspicuous location 
 in the Program: 
 
-    Copyright (c) {date here}, International Business Machines Corporation 
-    and others. All Rights Reserved.  
+    Copyright (c) 1997,1998,1999, International Business Machines
+    Corporation and others. All Rights Reserved.
 
 In addition, each Contributor must identify itself as the originator of
 its Contribution, if any, in a manner that reasonably allows subsequent
index fc0471f2a2bc786c2ff5d5d046456935a71740a6..a372b16550eb82f2e8cbf3162a698bcfbfa92a2a 100644 (file)
@@ -1,30 +1,35 @@
 #
-#       >>>>>>>>>>      The program "newaliases" must be run after
-#       >> NOTE >>      this file is updated for any changes to
-#       >>>>>>>>>>      show through to sendmail.
+#      >>>>>>>>>>      The program "newaliases" must be run after
+#      >> NOTE >>      this file is updated for any changes to
+#      >>>>>>>>>>      show through to Postfix.
 #
 
 # Basic system aliases -- these MUST be present
-MAILER-DAEMON: postmaster
-postmaster: root
+MAILER-DAEMON: postmaster
+postmaster:    root
 
 # General redirections for pseudo accounts
-bin:    root
-daemon: root
-named:  root
-nobody: root
-operator: root
-uucp:   root
-www:    root
-ftp-bugs: root
+bin:           root
+daemon:                root
+named:         root
+nobody:                root
+uucp:          root
+www:           root
+ftp-bugs:      root
 
 # Put your local aliases here.
 
-# Well-known aliases -- these should be filled in!
-# root:
-# manager:
-# dumper:
-# operator:
+# Well-known aliases
+manager:       root
+dumper:                root
+operator:      root
+abuse:         postmaster
+
+# trap decode to catch security attacks
+decode:                root
+
+# Person who should get root's mail
+#root:         you
 
 #++
 # NAME
index 46e964de2d00d6618f94d9ee10557c47e386fe5b..9c0e5ddcc74a5913bdcef75fd2a4146e16676da6 100644 (file)
@@ -181,6 +181,7 @@ program_directory = /some/where/postfix/bin
 #alias_maps = dbm:/etc/aliases
 #alias_maps = hash:/etc/aliases
 #alias_maps = hash:/etc/aliases, nis:mail.aliases
+#alias_maps = netinfo:/aliases
 
 # The alias_database parameter specifies the alias database(s) that
 # are built with "newaliases" or "sendmail -bi".  This is a separate
@@ -286,8 +287,10 @@ program_directory = /some/where/postfix/bin
 
 # The header_checks parameter restricts what may appear in message
 # headers. This requires that POSIX or PCRE regular expression support
-# is built-in. Specify "/^header-name: stuff you don not want/ REJECT"
-# in the pattern file. Patterns are case-insensitive by default.
+# is built-in. Specify "/^header-name: stuff you do not want/ REJECT"
+# in the pattern file. Patterns are case-insensitive by default. Note:
+# specify only patterns ending in REJECT. Patterns ending in OK are
+# a waste of cycles.
 #
 #header_checks = regexp:/etc/postfix/filename
 #header_checks = pcre:/etc/postfix/filename
index adb7adebfe4fbb0818d160e93b285ab03b8c3f2a..454a4f713a3696703bdebc5ef46f9f2ebe6dc3e6 100644 (file)
@@ -24,9 +24,9 @@
 # Chroot: whether or not the service runs chrooted to the mail queue
 # directory (pathname is controlled by the queue_directory configuration
 # variable in the main.cf file). Presently, all Postfix daemons can run
-# chrooted, except for the pipe and local daemons. The contributed
-# source code from http://www.postfix.org/ describes how to set up
-# a Postfix chroot environment for your type of machine.
+# chrooted, except for the pipe and local daemons. The files in the
+# examples/chroot-setup subdirectory describe how to set up a Postfix
+# chroot environment for your type of machine.
 #
 # Wakeup time: automatically wake up the named service after the
 # specified number of seconds.  Specify 0 for no wakeup. Presently,
@@ -70,3 +70,6 @@ uucp    unix  -       n       n       -       -       pipe
     flags=F user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
 ifmail    unix  -       n       n       -       -       pipe
     flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
+bsmtp     unix  -       n       n       -       -       pipe
+    flags=F user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
+
index 471856d1f79702bf32d1317a6791b8acd2d24dd6..21392f933ad2f480b20d621e81f7724e02052d4e 100755 (executable)
@@ -48,7 +48,7 @@ umask 022
 # LINUX by default does not synchronously update directories -
 # that's dangerous for mail.
 #
-if [ -x /usr/bin/chattr ]
+if [ -f /usr/bin/chattr ]
 then
        CHATTR="/usr/bin/chattr +S"
 else
@@ -66,7 +66,7 @@ cd $daemon_directory || {
        $FATAL no Postfix daemon directory $daemon_directory!
        exit 1
 }
-test -x master || {
+test -f master || {
        $FATAL no Postfix master program $daemon_directory/master!
        exit 1
 }
index 2ba58b979127438d89c6937bc2dde925d33d673f..337b2ade17b86c25cca8bdd8723f29ca35410541 100755 (executable)
@@ -48,7 +48,7 @@ umask 022
 # LINUX by default does not synchronously update directories -
 # that's dangerous for mail.
 #
-if [ -x /usr/bin/chattr ]
+if [ -f /usr/bin/chattr ]
 then
        CHATTR="/usr/bin/chattr +S"
 else
@@ -66,7 +66,7 @@ cd $daemon_directory || {
        $FATAL no Postfix daemon directory $daemon_directory!
        exit 1
 }
-test -x master || {
+test -f master || {
        $FATAL no Postfix master program $daemon_directory/master!
        exit 1
 }
index a0f63f2035f39bf51a8d2958a103c434b2184d32..f7a990529fdf9063485a2969ab4ce14aac905e80 100644 (file)
@@ -219,8 +219,8 @@ program_directory = /usr/libexec/postfix
 
 # The queue_directory specifies the location of the Postfix queue.
 # This is also the root directory of Postfix daemons that run chrooted.
-# The contributed source code from http://www.postfix.org/ has examples
-# for setting up Postfix chroot environments on different UNIX systems.
+# The files in the examples/chroot-setup subdirectory describe how
+# to set up Postfix chroot environments on different UNIX systems.
 #
 queue_directory = /var/spool/postfix
 
index 263c5509ab1ee93ff21f235ad019d192ab440505..c4c49186330eeb8bb2886f45f98ab8370de22718 100644 (file)
 # second (if present) must not match.  The first matching line wins,
 # terminating processing of the ruleset.
 
+# Disallow sender-specified routing. This is a must if you relay mail
+#for other domains.
+/[%!@].*@/                             550 Sender-specified routing rejected
+
 # Postmaster is OK, that way they can talk to us about how to fix their problem.
 /^postmaster@.*$/                      OK
 
index cc8c214bb0a15a9a6d52882a44fdb316fbdfcc74..4381939fb2e2b72f442312bdda6959dddd843e22 100644 (file)
@@ -189,6 +189,7 @@ smtpd_sender_restrictions =
 #   reject_unknown_hostname: reject HELO hostname without DNS A or MX record.
 #   reject_unknown_sender_domain: reject sender domain without A or MX record.
 #   check_relay_domains: permit only mail from/to domains in $relay_domains.
+#   reject_unauth_destination: reject mail not to domains in $relay_domains.
 #   permit_mx_backup: accept mail for sites that list me as MX host.
 #   reject_unknown_recipient_domain: reject domains without A or MX record.
 #   check_recipient_access maptype:mapname
index 26bf297d30cde24478aff749e515dd473d4268f5..9aca6d1f78145c8b2f8cb5ebda57cd2e1903257d 100644 (file)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+PATH=/usr/bin:/sbin:/usr/sbin
+
 # Create chroot'd area under Solaris 2.5.1 for postfix.
 #
 # Dug Song <dugsong@UMICH.EDU>
index 887f2af4133b7634cbb5204203bffcff4f471ed2..25c29af3b1bd85bafca416cd6c3c17a508b06e1a 100644 (file)
@@ -314,6 +314,7 @@ deliver_request.o: ../include/vbuf.h
 deliver_request.o: ../include/vstring.h
 deliver_request.o: ../include/mymalloc.h
 deliver_request.o: ../include/iostuff.h
+deliver_request.o: ../include/myflock.h
 deliver_request.o: mail_queue.h
 deliver_request.o: mail_proto.h
 deliver_request.o: mail_open_ok.h
index 0bf3319ccfd0d3578dddfec2ddd6451eab5c216e..ff361736eafe25b68cc8fbb0f3948a118ddc2c99 100644 (file)
@@ -8,6 +8,7 @@
 /*
 /*     typedef struct DELIVER_REQUEST {
 /* .in +5
+/*             VSTREAM *fp;
 /*             char    *queue_name;
 /*             char    *queue_id;
 /*             long    data_offset;
@@ -34,7 +35,8 @@
 /*     to delivery agent' protocol. In this game, the queue manager is
 /*     the client, while the delivery agent is the server.
 /*
-/*     deliver_request_read() reads a client message delivery request.
+/*     deliver_request_read() reads a client message delivery request,
+/*     opens the queue file, and acquires a shared lock.
 /*     A null result means that the client sent bad information or that
 /*     it went away unexpectedly.
 /*
@@ -46,6 +48,7 @@
 /*
 /*     deliver_request_done() reports the delivery status back to the
 /*     client, including the optional \fIhop_status\fR information,
+/*     closes the queue file,
 /*     and destroys the DELIVER_REQUEST structure. The result is
 /*     non-zero when the status could not be reported to the client.
 /* DIAGNOSTICS
@@ -78,6 +81,7 @@
 #include <vstring.h>
 #include <mymalloc.h>
 #include <iostuff.h>
+#include <myflock.h>
 
 /* Global library. */
 
@@ -141,6 +145,7 @@ static int deliver_request_final(VSTREAM *stream, char *reason, int status)
 
 static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request)
 {
+    char   *myname = "deliver_request_get";
     const char *path;
     struct stat st;
     static VSTRING *queue_name;
@@ -177,6 +182,7 @@ static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request)
     if (mail_open_ok(vstring_str(queue_name),
                     vstring_str(queue_id), &st, &path) == 0)
        return (-1);
+
     request->queue_name = mystrdup(vstring_str(queue_name));
     request->queue_id = mystrdup(vstring_str(queue_id));
     request->nexthop = mystrdup(vstring_str(nexthop));
@@ -196,6 +202,29 @@ static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request)
            return (-1);
        recipient_list_add(&request->rcpt_list, offset, vstring_str(address));
     }
+
+    /*
+     * Open the queue file and set a shared lock, in order to prevent
+     * duplicate deliveries when the queue is flushed immediately after queue
+     * manager restart.
+     * 
+     * Opening the queue file can fail for a variety of reasons, such as the
+     * system running out of resources. Instead of throwing away mail, we're
+     * raising a fatal error which forces the mail system to back off, and
+     * retry later.
+     */
+#define DELIVER_LOCK_MODE (MYFLOCK_SHARED | MYFLOCK_NOWAIT)
+
+    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 (msg_verbose)
+       msg_info("%s: file %s", myname, VSTREAM_PATH(request->fp));
+    if (myflock(vstream_fileno(request->fp), DELIVER_LOCK_MODE) < 0)
+       msg_fatal("shared lock %s: %m", VSTREAM_PATH(request->fp));
+    close_on_exec(vstream_fileno(request->fp), CLOSE_ON_EXEC);
+
     return (0);
 }
 
@@ -206,6 +235,7 @@ static DELIVER_REQUEST *deliver_request_alloc(void)
     DELIVER_REQUEST *request;
 
     request = (DELIVER_REQUEST *) mymalloc(sizeof(*request));
+    request->fp = 0;
     request->queue_name = 0;
     request->queue_id = 0;
     request->nexthop = 0;
@@ -223,6 +253,8 @@ static DELIVER_REQUEST *deliver_request_alloc(void)
 
 static void deliver_request_free(DELIVER_REQUEST *request)
 {
+    if (request->fp)
+       vstream_fclose(request->fp);
     if (request->queue_name)
        myfree(request->queue_name);
     if (request->queue_id)
index 695110fdc5dd45a1b73ac8f43d2e6b73aa7c6bcc..34ab16af96dce71cd271aea02e1a376071534c98 100644 (file)
@@ -26,6 +26,7 @@
   * Structure of a server mail delivery request.
   */
 typedef struct DELIVER_REQUEST {
+    VSTREAM *fp;                       /* stream, shared lock */
     char   *queue_name;                        /* message queue name */
     char   *queue_id;                  /* message queue id */
     long    data_offset;               /* offset to message */
index 3de429326e14809efff738dcabcdc96f72d8d5de..61309c741da0bba84d06bcfa6bb43fca8a68a4bd 100644 (file)
@@ -109,9 +109,15 @@ VSTREAM *mail_connect_wait(const char *class, const char *name)
      * XXX Solaris workaround for ECONNREFUSED on a busy socket.
      */
     while ((stream = mail_connect(class, name, BLOCKING)) == 0) {
-       if (errno == ECONNREFUSED || errno == ENOENT)
-           (count++ >= 10 ? msg_fatal : msg_warn)
-               ("connect #%d to subsystem %s/%s: %m", count, class, name);
+       if (errno == ECONNREFUSED || errno == ENOENT) {
+           if (count++ >= 10) {
+               msg_fatal("connect #%d to subsystem %s/%s: %m",
+                         count, class, name);
+           } else {
+               msg_warn("connect #%d to subsystem %s/%s: %m",
+                        count, class, name);
+           }
+       }
        sleep(10);                              /* XXX make configurable */
     }
     return (stream);
index ca210bf3cdc6ad5779f96da553dfb3db7d19f03f..cec982f929b3b262deedb2920cf88275a365dc9c 100644 (file)
@@ -342,6 +342,12 @@ abcdefghijklmnopqrstuvwxyz\
 ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 extern char *var_cmd_exp_filter;
 
+#define VAR_FWD_EXP_FILTER     "forward_expansion_filter"
+#define DEF_FWD_EXP_FILTER     "1234567890!@%-_=+:,.\
+abcdefghijklmnopqrstuvwxyz\
+ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+extern char *var_fwd_exp_filter;
+
 #define VAR_DELIVER_HDR                "prepend_delivered_header"
 #define DEF_DELIVER_HDR                "command, file, forward"
 extern char *var_deliver_hdr;
@@ -756,6 +762,7 @@ extern int var_non_fqdn_code;
 #define DEF_UNK_ADDR_CODE      450
 extern int var_unk_addr_code;
 
+#define REJECT_UNAUTH_DEST     "reject_unauth_destination"
 #define CHECK_RELAY_DOMAINS    "check_relay_domains"
 #define VAR_RELAY_CODE         "relay_domains_reject_code"
 #define DEF_RELAY_CODE         554
index 1533094f15ba6a1cc12d8cef341928ff24fc473c..f2d3dfc06420d5cae5910d8144e44a4e7e86d8fc 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-19990627"
+#define DEF_MAIL_VERSION       "Snapshot-19990831"
 extern char *var_mail_version;
 
 /* LICENSE
index 26e41b755783a5ace56b08a95efe86ef24b09faf..e6fd5ecc7a0a5065b47a41e23fe87eef4b7c6b96 100644 (file)
@@ -148,6 +148,13 @@ const char *maps_find(MAPS *maps, const char *name, int flags)
     const char *expansion;
     DICT   *dict;
 
+    /*
+     * Temp. workaround, for buggy callers that pass zero-length keys when
+     * given partial addresses.
+     */
+    if (*name == 0)
+       return (0);
+
     for (map_name = maps->argv->argv; *map_name; map_name++) {
        if ((dict = dict_handle(*map_name)) == 0)
            msg_panic("%s: dictionary not found: %s", myname, *map_name);
index 70c8290a96aaa23f5f82055882e576c0ece4a8ec..24150028fe69dee068bc263b8cd6937d3cd97e1f 100644 (file)
@@ -85,13 +85,17 @@ CLEANUP(8)                                             CLEANUP(8)
        command after a configuration change.
 
 <b>Miscellaneous</b>
+       <b>always</b><i>_</i><b>bcc</b>
+              Address to send a copy of each message that  enters
+              the system.
+
        <b>hopcount</b><i>_</i><b>limit</b>
               Limit the number of <b>Received:</b> message headers.
 
 <b>Address</b> <b>transformations</b>
        <b>empty</b><i>_</i><b>address</b><i>_</i><b>recipient</b>
-              The destination for  undeliverable  mail  from  &lt;&gt;.
-              This  substitution is done before all other address
+              The  destination  for  undeliverable  mail from &lt;&gt;.
+              This substitution is done before all other  address
               rewriting.
 
        <b>canonical</b><i>_</i><b>maps</b>
@@ -107,11 +111,11 @@ CLEANUP(8)                                             CLEANUP(8)
               header sender addresses.
 
        <b>masquerade</b><i>_</i><b>domains</b>
-              List  of  domains  that hide their subdomain struc-
+              List of domains that hide  their  subdomain  struc-
               ture.
 
        <b>masquerade</b><i>_</i><b>exceptions</b>
-              List of user names that are not subject to  address
+              List  of user names that are not subject to address
               masquerading.
 
        <b>virtual</b><i>_</i><b>maps</b>
@@ -120,11 +124,7 @@ CLEANUP(8)                                             CLEANUP(8)
 
 <b>Resource</b> <b>controls</b>
        <b>duplicate</b><i>_</i><b>filter</b><i>_</i><b>limit</b>
-              Limit the number of envelope  recipients  that  are
-              remembered.
-
-       <b>header</b><i>_</i><b>size</b><i>_</i><b>limit</b>
-              Limit the amount of memory in bytes used to process
+              Limit  the  number  of envelope recipients that are
 
 
 
@@ -137,6 +137,10 @@ CLEANUP(8)                                             CLEANUP(8)
 CLEANUP(8)                                             CLEANUP(8)
 
 
+              remembered.
+
+       <b>header</b><i>_</i><b>size</b><i>_</i><b>limit</b>
+              Limit the amount of memory in bytes used to process
               a message header.
 
 <b>SEE</b> <b>ALSO</b>
@@ -151,7 +155,7 @@ CLEANUP(8)                                             CLEANUP(8)
        /etc/postfix/virtual*, virtual mapping table
 
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>AUTHOR(S)</b>
@@ -185,10 +189,6 @@ CLEANUP(8)                                             CLEANUP(8)
 
 
 
-
-
-
-
 
 
 
index d942cb7afffb0614f232fff49608cd7b51a7de25..cd2f6d58d5e90e309d4745828bf3cd3136eb89d9 100644 (file)
@@ -30,6 +30,8 @@
 
 <li><a href="#local">Delivering some users locally while sending mail as user@domain</a>
 
+<li><a href="#scanning">Support for virus scanning</a>
+
 <li><a href="#maildir">Support for maildir-style mailboxes</a>
 
 <li><a href="#procmail">Using Procmail for local delivery</a>
@@ -323,9 +325,10 @@ that are disconnected most of the time)
 
 <p>
 
-<i> When you disable DNS lookups, you must specify a</i> <b>relayhost</b>
-<i> as either a numeric IP address, or as a hostname that appears
-in</i> <b>/etc/hosts</b>.
+<i> When you disable DNS lookups, you must specify the</i>
+<b>relayhost</b> <i> as either a numeric IP address, or as a hostname
+that resolves to one or more IP addresses (Postfix does no</i>
+<b>MX</b> lookup).
 
 <p>
 
@@ -418,6 +421,49 @@ effective.
 
 <hr>
 
+<a name="scanning"><h2>Support for virus scanning</h2> </a>
+
+Would not it be great if operating systems and applications actually
+worked the way they are supposed to, instead of being as fragile
+as today's products? Well, we can solve only one problem at a time.
+
+<p>
+
+Currently, Postfix has no hooks to let other programs inspect every
+message, so the scanning has to be done before mail enters Postfix
+or while mail leaves Postfix, for example at mailbox delivery time.
+
+<p>
+
+<dl>
+
+<dt>Examples:
+
+<dl>
+
+<dt><b>mailbox_command = </b><i>/some/program ...</i>
+
+<dd>specifies a command that runs whenever mail is delivered to
+mailbox.  See the sample <b>main.cf</b> file for examples. In
+<b>/etc/aliases</i>, you must specify an alias for <b>root</b> that
+directs mail to a real person, otherwise funny things happen with
+mail sent to <b>root</b>.
+
+<p>
+
+<dt><b> mailbox_transport = </b><i>foo</i>
+
+<dd>delegates local mailbox delivery to the transport <i>foo</i> as
+configured in <b>/etc/postfix/master.cf</b>. If you follow this
+route you will build something around the pipe mailer. See examples
+in <b>master.cf</b>.
+
+</dl>
+
+</dl>
+
+<hr>
+
 <a name="maildir"><h2>Support for maildir-style mailboxes</h2> </a>
 
 <b>Maildir</b> is a specific one-file-per-message organization that
@@ -570,9 +616,9 @@ expression-based filter at the SMTP port:
 
 <dl>
 
-<dt><tt>smtpd_recipients = ... regexp:/etc/postfix/access_regexp ...</tt>
+<dt><tt>smtpd_recipient_restrictions = ... regexp:/etc/postfix/access_regexp ...</tt>
 
-<dt><tt>smtpd_recipients = ... pcre:/etc/postfix/access_regexp ...</tt>
+<dt><tt>smtpd_recipient_restrictions = ... pcre:/etc/postfix/access_regexp ...</tt>
 
 </dl>
 
index 11f21fcc39be0f4080cf8cb82be1c6e9bb37ba68..2711c48eeb2573601839d99d98c5ca31dcecdd1b 100644 (file)
@@ -44,7 +44,11 @@ LOCAL(8)                                                 LOCAL(8)
        address  extension),  <b>$domain</b>  (recipient  domain),  <b>local</b>
        (entire recipient address localpart) and <b>$recipient</b><i>_</i><b>delim-</b>
        <b>iter.</b>  The  forms  <i>${name?value}</i>  and <i>${name:value}</i> expand
-       conditionally to <i>value</i> when <i>$name</i> is (is not) defined.
+       conditionally to <i>value</i> when <i>$name</i>  is  (is  not)  defined.
+       Characters  that  may have special meaning to the shell or
+       file system are replaced  by  underscores.   The  list  of
+       acceptable characters is specified with the <b>forward</b><i>_</i><b>expan-</b>
+       <b>sion</b><i>_</i><b>filter</b> configuration
 
        An alias or ~/.<b>forward</b> file may list  any  combination  of
        external   commands,  destination  file  names,  <b>:include:</b>
@@ -55,10 +59,6 @@ LOCAL(8)                                                 LOCAL(8)
        When an address is  found  in  its  own  alias  expansion,
        delivery  is  made  to  the  user  instead. When a user is
        listed in the user's own ~/.<b>forward</b> file, delivery is made
-       to  the  user's mailbox instead.  An empty ~/.<b>forward</b> file
-       means do not forward mail.
-
-       In  order  to  prevent  the  mail  system  from  using  up
 
 
 
@@ -71,7 +71,11 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
-       unreasonable  amounts  of  memory, input records read from
+       to  the  user's mailbox instead.  An empty ~/.<b>forward</b> file
+       means do not forward mail.
+
+       In order to prevent the mail system from using  up  unrea-
+       sonable   amounts  of  memory,  input  records  read  from
        <b>:include:</b> or from ~/.<b>forward</b>  files  are  broken  up  into
        chunks of length <b>line</b><i>_</i><b>length</b><i>_</i><b>limit</b>.
 
@@ -86,9 +90,10 @@ LOCAL(8)                                                 LOCAL(8)
        rate on-file delivery status record.
 
        In order to stop mail forwarding loops early, the software
-       adds  a  <b>Delivered-To:</b>  header with the envelope recipient
-       address. If mail arrives for a recipient that  is  already
-       listed  in a <b>Delivered-To:</b> header, the message is bounced.
+       adds  an  optional  <b>Delivered-To:</b> header with the envelope
+       recipient address. If mail arrives for a recipient that is
+       already  listed  in a <b>Delivered-To:</b> header, the message is
+       bounced.
 
 <b>MAILBOX</b> <b>DELIVERY</b>
        The default per-user mailbox is a file in  the  UNIX  mail
@@ -120,11 +125,6 @@ LOCAL(8)                                                 LOCAL(8)
 
        In the case of UNIX-style mailbox delivery, the <b>local</b> dae-
        mon prepends a "<b>From</b> <i>sender</i> <i>time_stamp</i>" envelope header to
-       each  message,  prepends  an optional <b>Delivered-To:</b> header
-       with the envelope recipient address,  prepends  a  <b>Return-</b>
-       <b>Path:</b>  header with the envelope sender address, prepends a
-       &gt; character to lines beginning with "<b>From</b> ",  and  appends
-       an empty line.  The mailbox is locked for exclusive access
 
 
 
@@ -137,6 +137,11 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
+       each  message,  prepends  an optional <b>Delivered-To:</b> header
+       with the envelope recipient address,  prepends  a  <b>Return-</b>
+       <b>Path:</b>  header with the envelope sender address, prepends a
+       &gt; character to lines beginning with "<b>From</b> ",  and  appends
+       an empty line.  The mailbox is locked for exclusive access
        while delivery is in progress. In  case  of  problems,  an
        attempt  is  made  to truncate the mailbox to its original
        length.
@@ -187,11 +192,6 @@ LOCAL(8)                                                 LOCAL(8)
        <b>LOCAL</b>  The entire recipient address localpart (text to the
               left of the rightmost @ character).
 
-       <b>RECIPIENT</b>
-              The entire recipient address.
-
-       The <b>PATH</b> environment variable is always reset to a system-
-
 
 
                                                                 3
@@ -203,6 +203,10 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
+       <b>RECIPIENT</b>
+              The entire recipient address.
+
+       The <b>PATH</b> environment variable is always reset to a system-
        dependent default path, and the <b>TZ</b> (time zone) environment
        variable is always passed on without change.
 
@@ -253,10 +257,6 @@ LOCAL(8)                                                 LOCAL(8)
 
 <b>DELIVERY</b> <b>RIGHTS</b>
        Deliveries  to  external  files  and external commands are
-       made with the rights of the receiving user on whose behalf
-       the  delivery  is made.  In the absence of a user context,
-       the <b>local</b> daemon uses the owner rights  of  the  <b>:include:</b>
-       file or alias database.  When those files are owned by the
 
 
 
@@ -269,6 +269,10 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
+       made with the rights of the receiving user on whose behalf
+       the  delivery  is made.  In the absence of a user context,
+       the <b>local</b> daemon uses the owner rights  of  the  <b>:include:</b>
+       file or alias database.  When those files are owned by the
        superuser, delivery is made with the rights specified with
        the <b>default</b><i>_</i><b>privs</b> configuration parameter.
 
@@ -318,11 +322,7 @@ LOCAL(8)                                                 LOCAL(8)
        <b>local</b><i>_</i><b>command</b><i>_</i><b>shell</b>
               Shell to use for external  command  execution  (for
               example,  /some/where/smrsh  -c).   When a shell is
-              specified, it is invoked even when the command con-
-              tains  no  shell  built-in commands or meta charac-
-              ters.
-
-
+              specified, it is  invoked  even  when  the  command
 
 
 
@@ -335,17 +335,20 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
-       <b>prepend</b><i>_</i><b>delivered</b><i>_</i><b>header</b>
-              Prepend  an  optional  <b>Delivered-To:</b>  header   upon
-              external  forwarding,  delivery to command or file.
-              Specify zero or more of:  <b>command,</b>  <b>file,</b>  <b>forward</b>.
-              Turning  off  <b>Delivered-To:</b> when forwarding mail is
-              not recommended.
+              contains no shell built-in commands or meta charac-
+              ters.
 
        <b>owner</b><i>_</i><b>request</b><i>_</i><b>special</b>
               Give special treatment to <b>owner-</b><i>xxx</i> and <i>xxx</i><b>-request</b>
               addresses.
 
+       <b>prepend</b><i>_</i><b>delivered</b><i>_</i><b>header</b>
+              Prepend   an  optional  <b>Delivered-To:</b>  header  upon
+              external forwarding, delivery to command  or  file.
+              Specify  zero  or  more of: <b>command,</b> <b>file,</b> <b>forward</b>.
+              Turning off <b>Delivered-To:</b> when forwarding  mail  is
+              not recommended.
+
        <b>recipient</b><i>_</i><b>delimiter</b>
               Separator between username and address extension.
 
@@ -387,9 +390,6 @@ LOCAL(8)                                                 LOCAL(8)
               Limit  the  number of attempts to acquire an exclu-
               sive lock on a mailbox or external file.
 
-       <b>deliver</b><i>_</i><b>lock</b><i>_</i><b>delay</b>
-              Time in  seconds  between  successive  attempts  to
-
 
 
                                                                 6
@@ -401,6 +401,8 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
+       <b>deliver</b><i>_</i><b>lock</b><i>_</i><b>delay</b>
+              Time in  seconds  between  successive  attempts  to
               acquire an exclusive lock.
 
        <b>stale</b><i>_</i><b>lock</b><i>_</i><b>time</b>
@@ -447,12 +449,10 @@ LOCAL(8)                                                 LOCAL(8)
               Default  rights  for  delivery  to external file or
               command.
 
-<b>HISTORY</b>
-       The <b>Delivered-To:</b> header appears in the  <b>qmail</b>  system  by
-       Daniel Bernstein.
-
-       The  <i>maildir</i>  structure  appears  in  the  <b>qmail</b> system by
-       Daniel Bernstein.
+       <b>forward</b><i>_</i><b>expansion</b><i>_</i><b>filter</b>
+              What characters are  allowed  to  appear  in  $name
+              expansions  of forward_path. Illegal characters are
+              replaced by underscores.
 
 
 
@@ -467,6 +467,13 @@ LOCAL(8)                                                 LOCAL(8)
 LOCAL(8)                                                 LOCAL(8)
 
 
+<b>HISTORY</b>
+       The <b>Delivered-To:</b> header appears in the  <b>qmail</b>  system  by
+       Daniel Bernstein.
+
+       The  <i>maildir</i>  structure  appears  in  the  <b>qmail</b> system by
+       Daniel Bernstein.
+
 <b>SEE</b> <b>ALSO</b>
        <a href="aliases.5.html">aliases(5)</a> format of alias database
        <a href="bounce.8.html">bounce(8)</a> non-delivery status reports
@@ -509,13 +516,6 @@ LOCAL(8)                                                 LOCAL(8)
 
 
 
-
-
-
-
-
-
-
 
 
 
index af47d38973227bfd9503bfa894d51cb4aaabd911..76db05a8fd96c301bcd153a9c227c451733a4a46 100644 (file)
@@ -9,8 +9,8 @@ POSTALIAS(1)                                         POSTALIAS(1)
        postalias - Postfix alias database maintenance
 
 <b>SYNOPSIS</b>
-       <b>postalias</b> [<b>-c</b> <i>config_dir</i>] [<b>-i</b>] [<b>-v</b>] [<i>file_type</i>:]<i>file_name</i>
-       ...
+       <b>postalias</b> [<b>-c</b> <i>config_dir</i>] [<b>-i</b>] [<b>-v</b>] [<b>-w</b>]
+       [<i>file_type</i>:]<i>file_name</i> ...
 
 <b>DESCRIPTION</b>
        The  <b>postalias</b>  command  creates  a  new   Postfix   alias
index 84f33515b6975987ec0a7e06ab360c0a73b7b133..a9351d848a13c234ab2e417a4f6ffa1596b7a6c9 100644 (file)
@@ -9,19 +9,24 @@ POSTCONF(1)                                           POSTCONF(1)
        postconf - Postfix configuration utility
 
 <b>SYNOPSIS</b>
-       <b>postconf</b> [<b>-d</b>] [<b>-h</b>] [<b>-n</b>] [<b>-v</b>] [<i>parameter</i> <i>...</i>]
+       <b>postconf</b> [<b>-c</b> <i>config_dir</i>] [<b>-d</b>] [<b>-h</b>] [<b>-n</b>] [<b>-v</b>] [<i>parameter</i>
+       <i>...</i>]
 
 <b>DESCRIPTION</b>
-       The  <b>postconf</b> command prints the actual value of <i>parameter</i>
+       The <b>postconf</b> command prints the actual value of  <i>parameter</i>
        (all known parameters by default), one parameter per line.
 
        Options:
 
+       <b>-c</b> <i>config_dir</i>
+              The <b>main.cf</b> configuration  file  is  in  the  named
+              directory.
+
        <b>-d</b>     Print  default parameter settings instead of actual
               settings.
 
-       <b>-h</b>     Show parameter values only, not the <i>name</i> <i>=</i> informa-
-              tion that normally precedes the value.
+       <b>-h</b>     Show parameter values  only,  not  the  ``name  =''
+              label that normally precedes the value.
 
        <b>-n</b>     Print non-default parameter settings only.
 
@@ -30,7 +35,9 @@ POSTCONF(1)                                           POSTCONF(1)
               bose.
 
 <b>DIAGNOSTICS</b>
-       Problems are reported to the standard error stream.
+       Problems are reported to the standard error stream.  Fatal
+       error: out of memory,  file  not  found,  invalid  <b>main.cf</b>
+       parameter syntax.
 
 <b>LICENSE</b>
        The  Secure  Mailer  license must be distributed with this
@@ -54,13 +61,6 @@ POSTCONF(1)                                           POSTCONF(1)
 
 
 
-
-
-
-
-
-
-
 
                                                                 1
 
index 0ba4489f28a091074f5f62b96d119e69696c7d59..d87928ff5abbbb3455137ed052a407bec45e3bbd 100644 (file)
@@ -38,13 +38,15 @@ POSTLOCK(1)                                           POSTLOCK(1)
               command interpreter.
 
 <b>DIAGNOSTICS</b>
-       The result status is 255 (on some systems: -1) when  <b>post-</b>
-       <b>lock</b>  could  not  perform the requested operation.  Other-
-       wise, the exit status is the exit status from the command.
+       The result status is 75 (EX_TEMPFAIL)  when  the  file  is
+       locked  by another process, 255 (on some systems: -1) when
+       <b>postlock</b> could not perform the requested operation.   Oth-
+       erwise,  the  exit status is the exit status from the com-
+       mand.
 
 <b>BUGS</b>
-       With  remote  file  systems, the ability to acquire a lock
-       does not necessarily  eliminate  access  conflicts.  Avoid
+       With remote file systems, the ability to  acquire  a  lock
+       does  not  necessarily  eliminate  access conflicts. Avoid
        file access by processes running on different machines.
 
 <b>ENVIRONMENT</b>
@@ -55,10 +57,8 @@ POSTLOCK(1)                                           POSTLOCK(1)
               Enable verbose logging.
 
 <b>CONFIGURATION</b> <b>PARAMETERS</b>
-       The  following  <b>main.cf</b> parameters are especially relevant
-       to this program. See the Postfix <b>main.cf</b> file  for  syntax
-       details and for default values.
-
+       The following <b>main.cf</b> parameters are  especially  relevant
+       to  this  program. See the Postfix <b>main.cf</b> file for syntax
 
 
 
@@ -71,13 +71,15 @@ POSTLOCK(1)                                           POSTLOCK(1)
 POSTLOCK(1)                                           POSTLOCK(1)
 
 
+       details and for default values.
+
 <b>Locking</b> <b>controls</b>
        <b>deliver</b><i>_</i><b>lock</b><i>_</i><b>attempts</b>
-              Limit  the  number of attempts to acquire an exclu-
+              Limit the number of attempts to acquire  an  exclu-
               sive lock.
 
        <b>deliver</b><i>_</i><b>lock</b><i>_</i><b>delay</b>
-              Time in  seconds  between  successive  attempts  to
+              Time  in  seconds  between  successive  attempts to
               acquire an exclusive lock.
 
        <b>stale</b><i>_</i><b>lock</b><i>_</i><b>time</b>
@@ -85,15 +87,15 @@ POSTLOCK(1)                                           POSTLOCK(1)
 
 <b>Resource</b> <b>controls</b>
        <b>fork</b><i>_</i><b>attempts</b>
-              Number of attempts to <b>fork</b>() a process before  giv-
+              Number  of attempts to <b>fork</b>() a process before giv-
               ing up.
 
        <b>fork</b><i>_</i><b>delay</b>
-              Delay   in   seconds   between   successive  <b>fork</b>()
+              Delay  in   seconds   between   successive   <b>fork</b>()
               attempts.
 
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>AUTHOR(S)</b>
@@ -123,8 +125,6 @@ POSTLOCK(1)                                           POSTLOCK(1)
 
 
 
-
-
 
 
 
index 9b01928dcf07b607e517012b38ecb6f84593fdfc..7855930a32c81726b7b2bfae08c6b78b5049262e 100644 (file)
@@ -9,56 +9,56 @@ POSTMAP(1)                                             POSTMAP(1)
        postmap - Postfix lookup table management
 
 <b>SYNOPSIS</b>
-       <b>postmap</b> [<b>-c</b> <i>config_dir</i>] [<b>-i</b>] [<b>-v</b>] [<i>file_type</i>:]<i>file_name</i>
+       <b>postmap</b> [<b>-c</b> <i>config_dir</i>] [<b>-i</b>] [<b>-v</b>] [<b>-w</b>]
+       [<i>file_type</i>:]<i>file_name</i>
 
 <b>DESCRIPTION</b>
        The <b>postmap</b> command creates a new Postfix lookup table, or
-       updates an existing one. The input and output formats  are
+       updates  an existing one. The input and output formats are
        expected to be compatible with:
 
            <b>makemap</b> <i>file_type</i> <i>file_name</i> &lt; <i>file_name</i>
 
-       While  the table update is in progress, signal delivery is
-       postponed, and an exclusive, advisory, lock is  placed  on
+       While the table update is in progress, signal delivery  is
+       postponed,  and  an exclusive, advisory, lock is placed on
        the entire table, in order to avoid surprises in spectator
        programs.
 
        The format of a lookup table input file is as follows:
 
-       <b>o</b>      Blank lines are ignored.  So  are  lines  beginning
+       <b>o</b>      Blank  lines  are  ignored.  So are lines beginning
               with `#'.
 
        <b>o</b>      A table entry has the form
 
                    <i>key</i> whitespace <i>value</i>
 
-       <b>o</b>      A  line  that  starts with whitespace continues the
+       <b>o</b>      A line that starts with  whitespace  continues  the
               preceding line.
 
-       The <i>key</i> and <i>value</i> are processed as is,  except  that  sur-
-       rounding  white space is stripped off. Unlike with Postfix
-       alias databases, quotes cannot be used to  protect  lookup
-       keys  that  contain  special  characters  such  as  `#' or
+       The  <i>key</i>  and  <i>value</i> are processed as is, except that sur-
+       rounding white space is stripped off. Unlike with  Postfix
+       alias  databases,  quotes cannot be used to protect lookup
+       keys that  contain  special  characters  such  as  `#'  or
        whitespace. The <i>key</i> is mapped to lowercase to make mapping
        lookups case insensitive.
 
        Options:
 
        <b>-c</b> <i>config_dir</i>
-              Read  the  <b>main.cf</b>  configuration file in the named
+              Read the <b>main.cf</b> configuration file  in  the  named
               directory.
 
-       <b>-i</b>     Incremental mode. Read entries from standard  input
+       <b>-i</b>     Incremental  mode. Read entries from standard input
               and  do  not  truncate  an  existing  database.  By
-              default, <b>postmap</b> creates a new  database  from  the
+              default,  <b>postmap</b>  creates  a new database from the
               entries in <b>file</b><i>_</i><b>name</b>.
 
        <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-w    Do  not  warn  about  duplicate  entries;  silently
-              ignore them.
 
 
 
@@ -71,30 +71,32 @@ POSTMAP(1)                                             POSTMAP(1)
 POSTMAP(1)                                             POSTMAP(1)
 
 
+              ignore them.
+
        Arguments:
 
        <i>file_type</i>
               The type of database to be produced.
 
-              <b>btree</b>  The output  file  is  a  btree  file,  named
-                     <i>file_name</i><b>.db</b>.   This  is  available  only on
+              <b>btree</b>  The  output  file  is  a  btree  file, named
+                     <i>file_name</i><b>.db</b>.  This  is  available  only  on
                      systems with support for <b>db</b> databases.
 
-              <b>dbm</b>    The output  consists  of  two  files,  named
-                     <i>file_name</i><b>.pag</b>  and  <i>file_name</i><b>.dir</b>.   This is
-                     available only on systems with  support  for
+              <b>dbm</b>    The  output  consists  of  two  files, named
+                     <i>file_name</i><b>.pag</b> and  <i>file_name</i><b>.dir</b>.   This  is
+                     available  only  on systems with support for
                      <b>dbm</b> databases.
 
-              <b>hash</b>   The  output  file  is  a  hashed file, named
-                     <i>file_name</i><b>.db</b>.  This  is  available  only  on
+              <b>hash</b>   The output file  is  a  hashed  file,  named
+                     <i>file_name</i><b>.db</b>.   This  is  available  only on
                      systems with support for <b>db</b> databases.
 
-              When  no  <i>file_type</i> is specified, the software uses
-              the database type specified via  the  <b>database</b><i>_</i><b>type</b>
+              When no <i>file_type</i> is specified, the  software  uses
+              the  database  type specified via the <b>database</b><i>_</i><b>type</b>
               configuration parameter.
 
        <i>file_name</i>
-              The  name  of  the  lookup  table  source file when
+              The name of  the  lookup  table  source  file  when
               rebuilding a database.
 
 <b>DIAGNOSTICS</b>
@@ -111,24 +113,88 @@ POSTMAP(1)                                             POSTMAP(1)
 
 <b>CONFIGURATION</b> <b>PARAMETERS</b>
        <b>database</b><i>_</i><b>type</b>
-              Default output database type.  On  many  UNIX  sys-
-              tems,  the  default database type is either <b>hash</b> or
+              Default  output  database  type.  On many UNIX sys-
+              tems, the default database type is either  <b>hash</b>  or
               <b>dbm</b>.
 
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>AUTHOR(S)</b>
        Wietse Venema
        IBM T.J. Watson Research
        P.O. Box 704
+
+
+
+                                                                2
+
+
+
+
+
+POSTMAP(1)                                             POSTMAP(1)
+
+
        Yorktown Heights, NY 10598, USA
 
 
 
 
-                                                                2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                                                                3
 
 
 </pre> </body> </html>
index a4654e46dbd7db62c6db26a045e3f6489057508e..42a5ddbb147fe5808cc7b3e1bb4b898c81d8c174 100644 (file)
@@ -510,6 +510,9 @@ on the client hostname or network address.
 <dd> <b>smtpd_recipient_restrictions = permit_mynetworks,
 check_relay_domains</b>
 
+<dd> <b>smtpd_recipient_restrictions = permit_mynetworks,
+reject_unauth_destination</b>
+
 <p>
 
 <dt> Restrictions:
@@ -527,6 +530,16 @@ parameter specifies the response code for rejected requests (default:
 
 <p>
 
+<a name="reject_unauth_destination">
+
+<dt> <b>reject_unauth_destination</b> <dd> Ignore the client
+hostname.  Permit the request when the resolved destination address
+matches <a href="#relay_domains"> $relay_domains</a>, otherwise
+reject.  The <b>relay_domains_reject_code</b> parameter specifies
+the response code for rejected requests (default:  <b>554</b>).
+
+<p>
+
 <a name="permit_mx_backup">
 
 <dt> <b>permit_mx_backup</b> <dd> Permit the request when the local
@@ -784,8 +797,10 @@ subdomain under any of the domains listed in <b>$maps_rbl_domains.</b>
 <dt> <b>relay_domains</b>
 
 <dd> This parameter controls the behavior of the <a
-href="#check_relay_domains"> check_relay_domains</a> restriction
-that can appear as part of a recipient address restriction list.
+href="#check_relay_domains"> check_relay_domains</a> and a
+href="#reject_unauth_destination"> reject_unauth_destination</a>
+restrictions that can appear as part of a recipient address
+restriction list.
 
 <p>
 
index 44ebc090a0e8624f6f86344b5e57d8910f886df5..738d12e57754869142b87651d82d251567a853c0 100644 (file)
@@ -201,7 +201,6 @@ forward.o: ../include/vstring_vstream.h
 forward.o: ../include/iostuff.h
 forward.o: ../include/stringops.h
 forward.o: ../include/mail_proto.h
-forward.o: ../include/mail_queue.h
 forward.o: ../include/cleanup_user.h
 forward.o: ../include/sent.h
 forward.o: ../include/record.h
@@ -265,7 +264,6 @@ local.o: ../include/iostuff.h
 local.o: ../include/name_mask.h
 local.o: ../include/set_eugid.h
 local.o: ../include/dict.h
-local.o: ../include/mail_queue.h
 local.o: ../include/recipient_list.h
 local.o: ../include/deliver_request.h
 local.o: ../include/deliver_completed.h
index ee1c843087f51eb4f71e668166c4ecaa37939f4a..a261497b03f08c6f51c9f517fa42d2032b7e687d 100644 (file)
@@ -17,7 +17,7 @@
 /*     Duplicate commands for the same recipient are suppressed.
 /*     A limited amount of information is exported via the environment:
 /*     HOME, SHELL, LOGNAME, USER, EXTENSION, DOMAIN, RECIPIENT (entire
-/*     address) and LOCAL (just the local part). The exported
+/*     address) LOCAL (just the local part) and SENDER. The exported
 /*     information is censored with var_cmd_filter.
 /*
 /*     Arguments:
@@ -150,6 +150,7 @@ int     deliver_command(LOCAL_STATE state, USER_ATTR usr_attr, char *command)
     argv_add(env,
             "LOGNAME", state.msg_attr.user,
             "USER", state.msg_attr.user,
+            "SENDER", state.msg_attr.sender,
             "RECIPIENT", state.msg_attr.recipient,
             "LOCAL", state.msg_attr.local,
             ARGV_END);
index 51568bbf7ed737c2694b7d4bfbdb09679b68f1fc..b65877f8664b271c120db32cc26533568a65aa4b 100644 (file)
@@ -15,7 +15,8 @@
 /*     listed in a recipient's .forward file(s) as specified through
 /*     the forward_path configuration parameter.  The result is
 /*     zero when no acceptable .forward file was found, or when
-/*     a recipient is listed in her own .forward file.
+/*     a recipient is listed in her own .forward file. Expansions
+/*     are scrutinized with the forward_expansion_filter parameter.
 /*
 /*     Arguments:
 /* .IP state
@@ -112,7 +113,7 @@ int     deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp)
        MSG_LOG_STATE(myname, state);
 
     /*
-     * Skip this module if per-user forwarding is disabled. 
+     * Skip this module if per-user forwarding is disabled.
      */
     if (*var_forward_path == 0)
        return (NO);
@@ -147,7 +148,7 @@ int     deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp)
      * these are the rights of root, the /file and |command delivery routines
      * will use unprivileged default rights instead. Better safe than sorry.
      */
-       SET_USER_ATTR(usr_attr, mypwd, state.level);
+    SET_USER_ATTR(usr_attr, mypwd, state.level);
 
     /*
      * DELIVERY POLICY
@@ -182,7 +183,8 @@ int     deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp)
     lookup_status = -1;
 
     while ((lhs = mystrtok(&next, ", \t\r\n")) != 0) {
-       expand_status = local_expand(path, lhs, &state, &usr_attr, (char *) 0);
+       expand_status = local_expand(path, lhs, &state, &usr_attr,
+                                    var_fwd_exp_filter);
        if ((expand_status & (MAC_PARSE_ERROR | MAC_PARSE_UNDEF)) == 0) {
            lookup_status =
                lstat_as(STR(path), &st, usr_attr.uid, usr_attr.gid);
index 3d66a8cff5c61e3527009fc06ff33126da5354ef..91f239348d620f171a133c2107f54cc315b95070 100644 (file)
@@ -70,7 +70,6 @@
 /* Global library. */
 
 #include <mail_proto.h>
-#include <mail_queue.h>
 #include <cleanup_user.h>
 #include <sent.h>
 #include <record.h>
index e75c9a149630cc31b3f140f89feac91da646425b..d42223b5193c0db2fae9a50b0222bc66600d30b8 100644 (file)
@@ -40,6 +40,9 @@
 /*     \fB$recipient_delimiter.\fR The forms \fI${name?value}\fR and
 /*     \fI${name:value}\fR expand conditionally to \fIvalue\fR when
 /*     \fI$name\fR is (is not) defined.
+/*     Characters that may have special meaning to the shell or file system
+/*     are replaced by underscores.  The list of acceptable characters
+/*     is specified with the \fBforward_expansion_filter\fR configuration
 /*
 /*     An alias or ~/.\fBforward\fR file may list any combination of external
 /*     commands, destination file names, \fB:include:\fR directives, or
@@ -69,7 +72,8 @@
 /*     a new message, so that each recipient has a separate on-file
 /*     delivery status record.
 /*
-/*     In order to stop mail forwarding loops early, the software adds a
+/*     In order to stop mail forwarding loops early, the software adds an
+/*     optional
 /*     \fBDelivered-To:\fR header with the envelope recipient address. If
 /*     mail arrives for a recipient that is already listed in a
 /*     \fBDelivered-To:\fR header, the message is bounced.
 /*     /some/where/smrsh -c).
 /*     When a shell is specified, it is invoked even when the command
 /*     contains no shell built-in commands or meta characters.
+/* .IP \fBowner_request_special\fR
+/*     Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
+/*     addresses.
 /* .IP \fBprepend_delivered_header\fR
 /*     Prepend an optional \fBDelivered-To:\fR header upon external
 /*     forwarding, delivery to command or file. Specify zero or more of:
 /*     \fBcommand, file, forward\fR. Turning off \fBDelivered-To:\fR when
 /*     forwarding mail is not recommended.
-/* .IP \fBowner_request_special\fR
-/*     Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
-/*     addresses.
 /* .IP \fBrecipient_delimiter\fR
 /*     Separator between username and address extension.
 /* .SH Mailbox delivery
 /*     mailbox_command. Illegal characters are replaced by underscores.
 /* .IP \fBdefault_privs\fR
 /*     Default rights for delivery to external file or command.
+/* .IP \fBforward_expansion_filter\fR
+/*     What characters are allowed to appear in $name expansions of
+/*     forward_path. Illegal characters are replaced by underscores.
 /* HISTORY
 /* .ad
 /* .fi
 
 /* Global library. */
 
-#include <mail_queue.h>
 #include <recipient_list.h>
 #include <deliver_request.h>
 #include <deliver_completed.h>
@@ -428,6 +434,7 @@ char   *var_mailbox_transport;
 char   *var_fallback_transport;
 char   *var_forward_path;
 char   *var_cmd_exp_filter;
+char   *var_fwd_exp_filter;
 char   *var_prop_extension;
 int     var_exp_own_alias;
 char   *var_deliver_hdr;
@@ -470,11 +477,7 @@ static int local_deliver(DELIVER_REQUEST *rqst, char *service)
     deliver_attr_init(&state.msg_attr);
     state.msg_attr.queue_name = rqst->queue_name;
     state.msg_attr.queue_id = rqst->queue_id;
-    state.msg_attr.fp =
-       mail_queue_open(rqst->queue_name, rqst->queue_id, O_RDWR, 0);
-    if (state.msg_attr.fp == 0)
-       msg_fatal("open file %s %s: %m", rqst->queue_name, rqst->queue_id);
-    close_on_exec(vstream_fileno(state.msg_attr.fp), CLOSE_ON_EXEC);
+    state.msg_attr.fp = rqst->fp;
     state.msg_attr.offset = rqst->data_offset;
     state.msg_attr.sender = rqst->sender;
     state.msg_attr.relay = service;
@@ -506,7 +509,6 @@ static int local_deliver(DELIVER_REQUEST *rqst, char *service)
      * Clean up.
      */
     delivered_free(state.loop_info);
-    vstream_fclose(state.msg_attr.fp);
 
     return (msg_stat);
 }
@@ -607,6 +609,7 @@ int     main(int argc, char **argv)
        VAR_MAILBOX_TRANSP, DEF_MAILBOX_TRANSP, &var_mailbox_transport, 0, 0,
        VAR_FALLBACK_TRANSP, DEF_FALLBACK_TRANSP, &var_fallback_transport, 0, 0,
        VAR_CMD_EXP_FILTER, DEF_CMD_EXP_FILTER, &var_cmd_exp_filter, 1, 0,
+       VAR_FWD_EXP_FILTER, DEF_FWD_EXP_FILTER, &var_fwd_exp_filter, 1, 0,
        VAR_PROP_EXTENSION, DEF_PROP_EXTENSION, &var_prop_extension, 0, 0,
        VAR_DELIVER_HDR, DEF_DELIVER_HDR, &var_deliver_hdr, 0, 0,
        0,
index 8800b4e0e5bee56f6c8a130266112e27224c90e1..61806c96b5affabdac6bebc9d8040450953ef586 100644 (file)
@@ -103,7 +103,7 @@ static const char *local_expand_lookup(const char *name, int mode, char *ptr)
 #define STREQ(x,y) (*(x) == *(y) && strcmp((x), (y)) == 0)
 
     if (STREQ(name, "user")) {
-       return (local->usr_attr->logname);
+       return (local->state->msg_attr.user);
     } else if (STREQ(name, "home")) {
        return (local->usr_attr->home);
     } else if (STREQ(name, "shell")) {
index dbdd3b3e5d5903903df030a684e445d4bafa65bb..21b7b33bd81e2367a4513981e76e290a1aa888d0 100644 (file)
@@ -102,7 +102,7 @@ case "$SYSTEM.$RELEASE" in
                RANLIB=echo
                SYSLIBS="-lresolv -lsocket -lnsl"
                case $RELEASE in
-                   5.[0-4]) CCARGS="$CCARGS -Dusleep=doze";;
+                   5.[0-4]) CCARGS="$CCARGS -DMISSING_USLEEP";;
                          *) CCARGS="$CCARGS -DHAS_POSIX_REGEXP";;
                esac
                # Avoid common types of braindamage
@@ -170,7 +170,7 @@ case "$SYSTEM.$RELEASE" in
                ;;
 HP-UX.A.09.*)  SYSTYPE=HPUX9
                SYSLIBS=-ldbm
-               CCARGS="$CCARGS -Dusleep=doze"
+               CCARGS="$CCARGS -DMISSING_USLEEP"
                if [ -f /usr/lib/libdb.a ]; then
                    CCARGS="$CCARGS -DHAS_DB"
                    SYSLIBS="$SYSLIBS -ldb"
@@ -178,7 +178,7 @@ HP-UX.A.09.*)       SYSTYPE=HPUX9
                ;;
 HP-UX.B.10.*)  SYSTYPE=HPUX10
                CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null |
-                   (grep usleep >/dev/null || echo '-Dusleep=doze')`"
+                   (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`"
                if [ -f /usr/lib/libdb.a ]; then
                    CCARGS="$CCARGS -DHAS_DB"
                    SYSLIBS=-ldb
@@ -196,6 +196,9 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
                SYSLIBS="-lresolv -lsocket -lnsl"
                ;;
  Rhapsody.5*)  SYSTYPE=RHAPSODY5
+               # Use the native compiler by default
+               : ${CC=cc}
+               AWK=gawk
                ;;
         ".")   if [ -d /NextApps ]; then
                    SYSTYPE=`hostinfo | sed -n \
@@ -204,6 +207,7 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
                        SYSTYPE=`hostinfo | sed -n \
                            's/^.*NeXT Mach 4.*$/OPENSTEP4/;/OPENSTEP4/{p;q;}'`
                    fi
+                   : ${CC=cc}
                    RANLIB="sleep 5; ranlib"
                else
                    echo "Unable to determine your system type." 1>&2; exit 1
@@ -226,9 +230,9 @@ case "$CC" in
         *) : ${OPT='-O'};;
 esac
 
-: ${CC='gcc $(WARN)'} ${OPT='-O'} ${DEBUG='-g'}
+: ${CC='gcc $(WARN)'} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk}
 
-export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG OPTS
+export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS
 
 sed 's/  / /g' <<EOF
 SYSTYPE        = $SYSTYPE
@@ -239,4 +243,5 @@ SYSLIBS     = $AUXLIBS $SYSLIBS
 CC     = $CC $CCARGS
 OPT    = $OPT
 DEBUG  = $DEBUG
+AWK    = $AWK
 EOF
index e81b4d17f4c463ce4a77d4007a80dc28ca76fc9a..147d899e43e7713e3073aea148712cb25d04cbe7 100644 (file)
@@ -10,7 +10,7 @@ Postfix alias database maintenance
 .nf
 .fi
 \fBpostalias\fR [\fB-c \fIconfig_dir\fR] [\fB-i\fR] [\fB-v\fR]
-[\fIfile_type\fR:]\fIfile_name\fR ...
+[\fB-w\fR] [\fIfile_type\fR:]\fIfile_name\fR ...
 .SH DESCRIPTION
 .ad
 .fi
index 4f386a6d3f6e46962aea24331a22e16a8bdbeb77..e5d97f2211742b1b66a7a176a7878da914148284 100644 (file)
@@ -9,8 +9,8 @@ Postfix configuration utility
 .na
 .nf
 .fi
-\fBpostconf\fR [\fB-d\fR] [\fB-h\fR] [\fB-n\fR] [\fB-v\fR]
-[\fIparameter ...\fR]
+\fBpostconf\fR [\fB-c \fIconfig_dir\fR] [\fB-d\fR] [\fB-h\fR]
+[\fB-n\fR] [\fB-v\fR] [\fIparameter ...\fR]
 .SH DESCRIPTION
 .ad
 .fi
@@ -19,10 +19,12 @@ The \fBpostconf\fR command prints the actual value of
 parameter per line.
 
 Options:
+.IP "\fB-c \fIconfig_dir\fR"
+The \fBmain.cf\fR configuration file is in the named directory.
 .IP \fB-d\fR
 Print default parameter settings instead of actual settings.
 .IP \fB-h\fR
-Show parameter values only, not the \fIname =\fR information
+Show parameter values only, not the ``name ='' label
 that normally precedes the value.
 .IP \fB-n\fR
 Print non-default parameter settings only.
@@ -33,6 +35,8 @@ options make the software increasingly verbose.
 .ad
 .fi
 Problems are reported to the standard error stream.
+Fatal error: out of memory, file not found, invalid \fBmain.cf\fR
+parameter syntax.
 .SH LICENSE
 .na
 .nf
index 36c300e2e828cd22eec545b841f0169b5c81c3a9..4f7022029d37f0526e9ef822a5afcc4d218920d4 100644 (file)
@@ -36,7 +36,8 @@ interpretation by a shell command interpreter.
 .SH DIAGNOSTICS
 .ad
 .fi
-The result status is 255 (on some systems: -1) when \fBpostlock\fR
+The result status is 75 (EX_TEMPFAIL) when the file is locked by
+another process, 255 (on some systems: -1) when \fBpostlock\fR
 could not perform the requested operation.  Otherwise, the
 exit status is the exit status from the command.
 .SH BUGS
index a70be1401bc7de4247daa0005f88e3b83a8e2502..205d4b98ae60c33c79948994ca6b532b29c6dad9 100644 (file)
@@ -10,7 +10,7 @@ Postfix lookup table management
 .nf
 .fi
 \fBpostmap\fR [\fB-c \fIconfig_dir\fR] [\fB-i\fR] [\fB-v\fR]
-[\fIfile_type\fR:]\fIfile_name\fR
+[\fB-w\fR] [\fIfile_type\fR:]\fIfile_name\fR
 .SH DESCRIPTION
 .ad
 .fi
index 666754fba7c60c548d32fefe8db9e9ca47727335..b73d333290e0db7bb4a36bd0bc9617a79583beb6 100644 (file)
@@ -77,6 +77,8 @@ a configuration change.
 .SH Miscellaneous
 .ad
 .fi
+.IP \fBalways_bcc\fR
+Address to send a copy of each message that enters the system.
 .IP \fBhopcount_limit\fR
 Limit the number of \fBReceived:\fR message headers.
 .SH "Address transformations"
index b0b165d6d2feacf34fcc6be855184301f8fb6310..f6b73db65f142a86225f36044e268bf942b30e30 100644 (file)
@@ -48,6 +48,9 @@ extension), \fB$domain\fR (recipient domain), \fBlocal\fR
 \fB$recipient_delimiter.\fR The forms \fI${name?value}\fR and
 \fI${name:value}\fR expand conditionally to \fIvalue\fR when
 \fI$name\fR is (is not) defined.
+Characters that may have special meaning to the shell or file system
+are replaced by underscores.  The list of acceptable characters
+is specified with the \fBforward_expansion_filter\fR configuration
 
 An alias or ~/.\fBforward\fR file may list any combination of external
 commands, destination file names, \fB:include:\fR directives, or
@@ -79,7 +82,8 @@ For the sake of reliability, forwarded mail is re-submitted as
 a new message, so that each recipient has a separate on-file
 delivery status record.
 
-In order to stop mail forwarding loops early, the software adds a
+In order to stop mail forwarding loops early, the software adds an
+optional
 \fBDelivered-To:\fR header with the envelope recipient address. If
 mail arrives for a recipient that is already listed in a
 \fBDelivered-To:\fR header, the message is bounced.
@@ -291,14 +295,14 @@ Shell to use for external command execution (for example,
 /some/where/smrsh -c).
 When a shell is specified, it is invoked even when the command
 contains no shell built-in commands or meta characters.
+.IP \fBowner_request_special\fR
+Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
+addresses.
 .IP \fBprepend_delivered_header\fR
 Prepend an optional \fBDelivered-To:\fR header upon external
 forwarding, delivery to command or file. Specify zero or more of:
 \fBcommand, file, forward\fR. Turning off \fBDelivered-To:\fR when
 forwarding mail is not recommended.
-.IP \fBowner_request_special\fR
-Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
-addresses.
 .IP \fBrecipient_delimiter\fR
 Separator between username and address extension.
 .SH Mailbox delivery
@@ -368,6 +372,9 @@ What characters are allowed to appear in $name expansions of
 mailbox_command. Illegal characters are replaced by underscores.
 .IP \fBdefault_privs\fR
 Default rights for delivery to external file or command.
+.IP \fBforward_expansion_filter\fR
+What characters are allowed to appear in $name expansions of
+forward_path. Illegal characters are replaced by underscores.
 .SH HISTORY
 .na
 .nf
index c7c6f5ff3f11aac9ad0a43343cb03aa28ab1b28b..c074ae27bc01158f2f1c0c4638d80659e9cad8b2 100644 (file)
@@ -115,6 +115,7 @@ typedef struct {
     struct stat st;                    /* queue file status */
     char   *path;                      /* name for open/remove */
     char   *sender;                    /* sender address */
+    char   *rcpt;                      /* recipient address */
 } PICKUP_INFO;
 
  /*
@@ -167,6 +168,9 @@ static int copy_segment(VSTREAM *qfile, VSTREAM *cleanup, PICKUP_INFO *info,
        if (type == REC_TYPE_FROM)
            if (info->sender == 0)
                info->sender = mystrdup(vstring_str(buf));
+       if (type == REC_TYPE_RCPT)
+           if (info->rcpt == 0)
+               info->rcpt = mystrdup(vstring_str(buf));
        if (type == REC_TYPE_TIME)
            continue;
        else {
@@ -223,8 +227,12 @@ static int pickup_copy(VSTREAM *qfile, VSTREAM *cleanup,
      * Copy the message envelope segment. Allow only those records that we
      * expect to see in the envelope section. The envelope segment must
      * contain an envelope sender address.
+     * 
+     * If the segment contains a recipient address, include the optional
+     * always_bcc recipient.
      */
     info->sender = 0;
+    info->rcpt = 0;
     if ((status = copy_segment(qfile, cleanup, info, buf, REC_TYPE_ENVELOPE)) != 0)
        return (status);
     if (info->sender == 0) {
@@ -235,8 +243,11 @@ static int pickup_copy(VSTREAM *qfile, VSTREAM *cleanup,
             (int) info->st.st_uid, info->sender);
     myfree(info->sender);
 
-    if (*var_always_bcc)
-       rec_fputs(cleanup, REC_TYPE_RCPT, var_always_bcc);
+    if (info->rcpt) {
+       if (*var_always_bcc)
+           rec_fputs(cleanup, REC_TYPE_RCPT, var_always_bcc);
+       myfree(info->rcpt);
+    }
 
     /*
      * Message content segment. Send a dummy message length. Prepend a
index f58fbf0453bac96b5cfe0a5f96c9a352f83b71b7..aebfd7435aa4779b6076daf7e2361a1f007cec47 100644 (file)
@@ -70,7 +70,6 @@ pipe.o: ../include/split_at.h
 pipe.o: ../include/stringops.h
 pipe.o: ../include/recipient_list.h
 pipe.o: ../include/deliver_request.h
-pipe.o: ../include/mail_queue.h
 pipe.o: ../include/mail_params.h
 pipe.o: ../include/mail_conf.h
 pipe.o: ../include/bounce.h
index 4aa7bbdbd38242ef4af5a3f2d99be3c5c014ee61..ed9f8af8a998cc595be5775c7f4a89f49e21a25b 100644 (file)
 
 #include <recipient_list.h>
 #include <deliver_request.h>
-#include <mail_queue.h>
 #include <mail_params.h>
 #include <mail_conf.h>
 #include <bounce.h>
@@ -561,7 +560,6 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv)
     char   *myname = "deliver_message";
     static PIPE_PARAMS conf;
     static PIPE_ATTR attr;
-    VSTREAM *src;
     RECIPIENT_LIST *rcpt_list = &request->rcpt_list;
     VSTRING *why = vstring_alloc(100);
     VSTRING *buf;
@@ -603,35 +601,20 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv)
        get_service_attr(&attr, argv);
     }
 
-    /*
-     * Open the queue file. Opening the file can fail for a variety of
-     * reasons, such as the system running out of resources. Instead of
-     * throwing away mail, we're raising a fatal error which forces the mail
-     * system to back off, and retry later. XXX deliver_request() should
-     * pre-open the queue file while it does all its sanity checks.
-     */
-    src = mail_queue_open(request->queue_name, request->queue_id, O_RDWR, 0);
-    if (src == 0)
-       msg_fatal("%s: open %s %s: %m", myname,
-                 request->queue_name, request->queue_id);
-    if (msg_verbose)
-       msg_info("%s: file %s", myname, VSTREAM_PATH(src));
-    close_on_exec(vstream_fileno(src), CLOSE_ON_EXEC);
-
     /*
      * Deliver. Set the nexthop and sender variables, and expand the command
      * argument vector. Recipients will be expanded on the fly. XXX Rewrite
      * envelope and header addresses according to transport-specific
      * rewriting rules.
      */
-    if (vstream_fseek(src, request->data_offset, SEEK_SET) < 0)
-       msg_fatal("seek queue file %s: %m", VSTREAM_PATH(src));
+    if (vstream_fseek(request->fp, request->data_offset, SEEK_SET) < 0)
+       msg_fatal("seek queue file %s: %m", VSTREAM_PATH(request->fp));
 
     dict_update(PIPE_DICT_TABLE, PIPE_DICT_SENDER, request->sender);
     dict_update(PIPE_DICT_TABLE, PIPE_DICT_NEXTHOP, request->nexthop);
     expanded_argv = expand_argv(attr.command, rcpt_list);
 
-    command_status = pipe_command(src, why,
+    command_status = pipe_command(request->fp, why,
                                  PIPE_CMD_UID, attr.uid,
                                  PIPE_CMD_GID, attr.gid,
                                  PIPE_CMD_SENDER, request->sender,
@@ -641,14 +624,11 @@ static int deliver_message(DELIVER_REQUEST *request, char *service, char **argv)
                                  PIPE_CMD_END);
 
     deliver_status = eval_command_status(command_status, service, request,
-                                        src, vstring_str(why));
+                                        request->fp, vstring_str(why));
 
     /*
      * Clean up.
      */
-    if (vstream_fclose(src))
-       msg_warn("close %s %s: %m", request->queue_name, request->queue_id);
-
     vstring_free(why);
     argv_free(expanded_argv);
 
index d912c6750a4545d9e53935e3e8afc0ea234e16ec..a80d8262d1367f2f88d5c30d33a2390483b21853 100644 (file)
@@ -6,7 +6,7 @@
 /* SYNOPSIS
 /* .fi
 /*     \fBpostalias\fR [\fB-c \fIconfig_dir\fR] [\fB-i\fR] [\fB-v\fR]
-/*             [\fIfile_type\fR:]\fIfile_name\fR ...
+/*             [\fB-w\fR] [\fIfile_type\fR:]\fIfile_name\fR ...
 /* DESCRIPTION
 /*     The \fBpostalias\fR command creates a new Postfix alias database,
 /*     or updates an existing one. The input and output file formats
index 187178306910d5777770394e9ca5d9a623252ada..7d5fba67bf32be6f9080abb39ec027d5e7cc98a9 100644 (file)
@@ -36,7 +36,7 @@ update: ../bin/$(PROG) $(SAMPLES)
        cp $(PROG) ../bin
 
 $(MAKES): $(INC_DIR)/mail_params.h
-       sh extract.sh ../*/*.c
+       $(AWK) -f extract.awk ../*/*.c
 
 printfck: $(OBJS) $(PROG)
        rm -rf printfck
similarity index 96%
rename from postfix/postconf/extract.sh
rename to postfix/postconf/extract.awk
index 69323b48404fc50c70a77e37f122c55103610e94..9d3a33635e6696e2d6f2cb87a72d9120f546b9ee 100644 (file)
@@ -1,8 +1,5 @@
-#!/bin/sh
-
 # Extract initialization tables from actual source code.
 
-awk '
 /static CONFIG_INT_TABLE/,/};/ { 
     if ($1 ~ /VAR/) {
        print "int " substr($3,2,length($3)-2) ";" > "int_vars.h"
@@ -21,4 +18,3 @@ awk '
        print | "sort -u >bool_table.h" 
     }
 }
-' $*
index e681dcea36112e24cdafb0185343e142a46408e3..762f23b39cbb1460e3a57771edb670228e1f7607 100644 (file)
@@ -5,18 +5,20 @@
 /*     Postfix configuration utility
 /* SYNOPSIS
 /* .fi
-/*     \fBpostconf\fR [\fB-d\fR] [\fB-h\fR] [\fB-n\fR] [\fB-v\fR]
-/*             [\fIparameter ...\fR]
+/*     \fBpostconf\fR [\fB-c \fIconfig_dir\fR] [\fB-d\fR] [\fB-h\fR]
+/*             [\fB-n\fR] [\fB-v\fR] [\fIparameter ...\fR]
 /* DESCRIPTION
 /*     The \fBpostconf\fR command prints the actual value of
 /*     \fIparameter\fR (all known parameters by default), one
 /*     parameter per line.
 /*
 /*     Options:
+/* .IP "\fB-c \fIconfig_dir\fR"
+/*     The \fBmain.cf\fR configuration file is in the named directory.
 /* .IP \fB-d\fR
 /*     Print default parameter settings instead of actual settings.
 /* .IP \fB-h\fR
-/*     Show parameter values only, not the \fIname =\fR information
+/*     Show parameter values only, not the ``name ='' label
 /*     that normally precedes the value.
 /* .IP \fB-n\fR
 /*     Print non-default parameter settings only.
@@ -25,6 +27,8 @@
 /*     options make the software increasingly verbose.
 /* DIAGNOSTICS
 /*     Problems are reported to the standard error stream.
+/*     Fatal error: out of memory, file not found, invalid \fBmain.cf\fR
+/*     parameter syntax.
 /* LICENSE
 /* .ad
 /* .fi
@@ -289,6 +293,8 @@ static void print_bool(int mode, CONFIG_BOOL_TABLE *cbt)
        show_strval(mode, cbt->name, cbt->defval ? "yes" : "no");
     } else {
        value = dict_lookup(CONFIG_DICT, cbt->name);
+       if (value)
+           (void) get_mail_conf_bool(cbt->name, cbt->defval);
        if ((mode & SHOW_NONDEF) == 0) {
            if (value == 0) {
                show_strval(mode, cbt->name, cbt->defval ? "yes" : "no");
@@ -312,6 +318,8 @@ static void print_int(int mode, CONFIG_INT_TABLE *cit)
        show_intval(mode, cit->name, cit->defval);
     } else {
        value = dict_lookup(CONFIG_DICT, cit->name);
+       if (value)
+           (void) get_mail_conf_int(cit->name, cit->defval, cit->min, cit->max);
        if ((mode & SHOW_NONDEF) == 0) {
            if (value == 0) {
                show_intval(mode, cit->name, cit->defval);
@@ -335,6 +343,8 @@ static void print_str(int mode, CONFIG_STR_TABLE *cst)
        show_strval(mode, cst->name, cst->defval);
     } else {
        value = dict_lookup(CONFIG_DICT, cst->name);
+       if (value)
+           (void) get_mail_conf_str(cst->name, cst->defval, cst->min, cst->max);
        if ((mode & SHOW_NONDEF) == 0) {
            if (value == 0) {
                show_strval(mode, cst->name, cst->defval);
@@ -487,8 +497,12 @@ int     main(int argc, char **argv)
     /*
      * Parse JCL.
      */
-    while ((ch = GETOPT(argc, argv, "dhnv")) > 0) {
+    while ((ch = GETOPT(argc, argv, "c:dhnv")) > 0) {
        switch (ch) {
+       case 'c':
+           if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
+               msg_fatal("out of memory");
+           break;
        case 'd':
            if (mode & SHOW_NONDEF)
                msg_fatal("specify one of -d and -n");
@@ -506,7 +520,7 @@ int     main(int argc, char **argv)
            msg_verbose++;
            break;
        default:
-           msg_fatal("usage: %s [-d (defaults)] [-h (no names)] [-n (non-defaults)] [-v] name...", argv[0]);
+           msg_fatal("usage: %s [-c config_directory] [-d (defaults)] [-h (no names)] [-n (non-defaults)] [-v] name...", argv[0]);
        }
     }
 
index 9d728d4d4c03f9b6c0b66acf2e91e90beed91dc4..44b2ad14293e461073c1fec7aa97326e2133dcdf 100644 (file)
@@ -28,7 +28,8 @@
 /*     access.  The command is executed directly, i.e. without
 /*     interpretation by a shell command interpreter.
 /* DIAGNOSTICS
-/*     The result status is 255 (on some systems: -1) when \fBpostlock\fR
+/*     The result status is 75 (EX_TEMPFAIL) when the file is locked by
+/*     another process, 255 (on some systems: -1) when \fBpostlock\fR
 /*     could not perform the requested operation.  Otherwise, the
 /*     exit status is the exit status from the command.
 /* BUGS
@@ -84,6 +85,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <errno.h>
+#include <sysexits.h>
 
 /* Utility library. */
 
@@ -109,7 +112,7 @@ static NORETURN usage(char *myname)
     msg_fatal("usage: %s [-c config_dir] [-v] folder command...", myname);
 }
 
-/* fatal_exit - as promised, return 255 in case of locking problems */
+/* fatal_exit - as promised, return 255 in case of unexpected problems */
 
 static void fatal_exit(void)
 {
@@ -195,11 +198,24 @@ int     main(int argc, char **argv)
     close_on_exec(fd, CLOSE_ON_EXEC);
     why = vstring_alloc(1);
 #ifdef USE_DOT_LOCK
-    if (dot_lockfile(folder, why) < 0)
+    if (dot_lockfile(folder, why) < 0) {
+       if (errno == EEXIST) {
+           msg_warn("dotlock file %s: %s", folder, vstring_str(why));
+           exit(EX_TEMPFAIL);
+       }
        msg_fatal("dotlock file %s: %s", folder, vstring_str(why));
+    }
 #endif
-    if (deliver_flock(fd, why) < 0)
+    if (deliver_flock(fd, why) < 0) {
+       if (errno == EAGAIN) {
+           msg_warn("lock %s: %s", folder, vstring_str(why));
+#ifdef USE_DOT_LOCK
+           dot_unlockfile(folder);
+#endif
+           exit(EX_TEMPFAIL);
+       }
        msg_fatal("lock %s: %s", folder, vstring_str(why));
+    }
 
     /*
      * Run the command. Remove the lock after completion.
index b50bd6c846b8245f21812c2c224d7d7a080cde08..5227bece2c20eb05c0bc6dcb3a8aad32134a11c3 100644 (file)
@@ -6,7 +6,7 @@
 /* SYNOPSIS
 /* .fi
 /*     \fBpostmap\fR [\fB-c \fIconfig_dir\fR] [\fB-i\fR] [\fB-v\fR]
-/*             [\fIfile_type\fR:]\fIfile_name\fR
+/*             [\fB-w\fR] [\fIfile_type\fR:]\fIfile_name\fR
 /* DESCRIPTION
 /*     The \fBpostmap\fR command creates a new Postfix lookup table,
 /*     or updates an existing one. The input and output formats are
index 7660e4671554699e63ac5427c40d9205879b2485..b8e0ae6d7f232790ceb7052d756022f06bbc1d36 100644 (file)
@@ -234,6 +234,8 @@ struct QMGR_MESSAGE {
     QMGR_RCPT_LIST rcpt_list;          /* complete addresses */
 };
 
+#define QMGR_MESSAGE_LOCKED    ((QMGR_MESSAGE *) 1)
+
 extern int qmgr_message_count;
 extern int qmgr_recipient_count;
 extern MAPS *qmgr_relocated;
index bd7b17bdb29612439d96f88b9d270e8dba40f647..d023ae31a51015a178a12178119293a5444d2a32 100644 (file)
@@ -125,6 +125,34 @@ static void qmgr_active_corrupt(const char *queue_id)
     }
 }
 
+/* qmgr_active_defer - defer queue file */
+
+static void qmgr_active_defer(QMGR_MESSAGE *message, time_t delay)
+{
+    char   *myname = "qmgr_active_defer";
+    const char *path;
+    struct utimbuf tbuf;
+
+    if (msg_verbose)
+       msg_info("wakeup %s after %ld secs", message->queue_id, (long) delay);
+
+    tbuf.actime = tbuf.modtime = event_time() + delay;
+    path = mail_queue_path((VSTRING *) 0, message->queue_name,
+                          message->queue_id);
+    if (utime(path, &tbuf) < 0)
+       msg_fatal("%s: update %s time stamps: %m", myname, path);
+    if (mail_queue_rename(message->queue_id, message->queue_name,
+                         MAIL_QUEUE_DEFERRED)) {
+       if (errno != ENOENT)
+           msg_fatal("%s: rename %s from %s to %s: %m", myname,
+              message->queue_id, message->queue_name, MAIL_QUEUE_DEFERRED);
+       msg_warn("%s: rename %s from %s to %s: %m", myname,
+              message->queue_id, message->queue_name, MAIL_QUEUE_DEFERRED);
+    } else if (msg_verbose) {
+       msg_info("%s: defer %s", myname, message->queue_id);
+    }
+}
+
 /* qmgr_active_feed - feed one message into active queue */
 
 void    qmgr_active_feed(QMGR_SCAN *scan_info, const char *queue_id)
@@ -172,14 +200,6 @@ void    qmgr_active_feed(QMGR_SCAN *scan_info, const char *queue_id)
        return;
     }
 
-    /*
-     * Reset the defer log. Leave the bounce log alone; if it is still
-     * around, something did not send it previously.
-     */
-    if (mail_queue_remove(MAIL_QUEUE_DEFER, queue_id) && errno != ENOENT)
-       msg_fatal("%s: %s: remove %s %s: %m", myname,
-                 queue_id, MAIL_QUEUE_DEFER, queue_id);
-
     /*
      * Extract envelope information: sender and recipients. At this point,
      * mail addresses have been processed by the cleanup service so they
@@ -189,11 +209,30 @@ void    qmgr_active_feed(QMGR_SCAN *scan_info, const char *queue_id)
      * Throwing away queue files seems bad, especially when they made it this
      * far into the mail system. Therefore we save bad files to a separate
      * directory for further inspection.
+     * 
+     * After queue manager restart it is possible that a queue file is still
+     * being delivered. In that case (the file is locked), defer delivery by
+     * a minimal amount of time.
      */
     if ((message = qmgr_message_alloc(MAIL_QUEUE_ACTIVE, queue_id,
                                      scan_info->flags)) == 0) {
        qmgr_active_corrupt(queue_id);
+    } else if (message == QMGR_MESSAGE_LOCKED) {
+       qmgr_active_defer(message, (time_t) var_min_backoff_time);
     } else {
+
+       /*
+        * Reset the defer log. Leave the bounce log alone; if it is still
+        * around, something did not send it previously.
+        */
+       if (mail_queue_remove(MAIL_QUEUE_DEFER, queue_id) && errno != ENOENT)
+           msg_fatal("%s: %s: remove %s %s: %m", myname,
+                     queue_id, MAIL_QUEUE_DEFER, queue_id);
+
+       /*
+        * Special case if all recipients were already delivered. Send any
+        * bounces and clean up.
+        */
        if (message->refcount == 0)
            qmgr_active_done(message);
     }
@@ -206,7 +245,6 @@ void    qmgr_active_done(QMGR_MESSAGE *message)
     char   *myname = "qmgr_active_done";
     struct stat st;
     const char *path;
-    struct utimbuf tbuf;
     time_t  delay;
 
     if (msg_verbose)
@@ -292,9 +330,9 @@ void    qmgr_active_done(QMGR_MESSAGE *message)
            if (msg_verbose)
                msg_info("%s: sending defer warning for %s", myname, message->queue_id);
            if (defer_warn(BOUNCE_FLAG_KEEP,
-                           message->queue_name,
-                           message->queue_id,
-                           message->errors_to) == 0) {
+                          message->queue_name,
+                          message->queue_id,
+                          message->errors_to) == 0) {
                qmgr_message_update_warn(message);
            }
        }
@@ -321,23 +359,7 @@ void    qmgr_active_done(QMGR_MESSAGE *message)
        } else {
            delay = var_min_backoff_time;
        }
-       if (msg_verbose)
-           msg_info("wakeup %s after %ld secs", message->queue_id, delay);
-       tbuf.actime = tbuf.modtime = event_time() + delay;
-       path = mail_queue_path((VSTRING *) 0, message->queue_name,
-                              message->queue_id);
-       if (utime(path, &tbuf) < 0)
-           msg_fatal("%s: update %s time stamps: %m", myname, path);
-       if (mail_queue_rename(message->queue_id, message->queue_name,
-                             MAIL_QUEUE_DEFERRED)) {
-           if (errno != ENOENT)
-               msg_fatal("%s: rename %s from %s to %s: %m", myname,
-               message->queue_id, message->queue_name, MAIL_QUEUE_DEFERRED);
-           msg_warn("%s: rename %s from %s to %s: %m", myname,
-              message->queue_id, message->queue_name, MAIL_QUEUE_DEFERRED);
-       } else if (msg_verbose) {
-           msg_info("%s: defer %s", myname, message->queue_id);
-       }
+       qmgr_active_defer(message, delay);
     }
 
     /*
index ec928ea8019870092cb505e08f6d4a655465027d..1e6ec2e25b844996d4cb54d10e8e1bb778741bd8 100644 (file)
 /*     qmgr_message_alloc() creates an in-core message structure
 /*     with sender and recipient information taken from the named queue
 /*     file. A null result means the queue file could not be read or
-/*     that the queue file contained incorrect information. The number
+/*     that the queue file contained incorrect information. A result
+/*     QMGR_MESSAGE_LOCKED means delivery must be deferred. The number
 /*     of recipients read from a queue file is limited by the global
 /*     var_qmgr_rcpt_limit configuration parameter. When the limit
 /*     is reached, the \fIrcpt_offset\fR structure member is set to
 /*     the position where the read was terminated. Recipients are
-/*     ru through the resolver, and are assigned to destination
+/*     run through the resolver, and are assigned to destination
 /*     queues. Recipients that cannot be assigned are deferred or
 /*     bounced. Mail that has bounced twice is silently absorbed.
 /*
@@ -95,6 +96,7 @@
 #include <valid_hostname.h>
 #include <argv.h>
 #include <stringops.h>
+#include <myflock.h>
 
 /* Global library. */
 
@@ -663,10 +665,17 @@ QMGR_MESSAGE *qmgr_message_alloc(const char *queue_name, const char *queue_id,
      * Extract message envelope information: time of arrival, sender address,
      * recipient addresses. Skip files with malformed envelope information.
      */
+#define QMGR_LOCK_MODE (MYFLOCK_EXCLUSIVE | MYFLOCK_NOWAIT)
+
     if (qmgr_message_open(message) < 0) {
        qmgr_message_free(message);
        return (0);
     }
+    if (myflock(vstream_fileno(message->fp), QMGR_LOCK_MODE) < 0) {
+       qmgr_message_close(message);
+       qmgr_message_free(message);
+       return (QMGR_MESSAGE_LOCKED);
+    }
     if (qmgr_message_read(message) < 0) {
        qmgr_message_close(message);
        qmgr_message_free(message);
index a6b41020eae24d026e55093780271c5f95b8d1e3..ae44fb041c2a2d766d4e8c590e63bce241bd6fd2 100644 (file)
@@ -595,6 +595,18 @@ int     main(int argc, char **argv)
     msg_syslog_init(mail_task("sendmail"), LOG_PID, LOG_FACILITY);
     set_mail_conf_str(VAR_PROCNAME, var_procname = mystrdup(argv[0]));
 
+    /*
+     * Do not set[e]uid(getuid()). This allows the real user to manipulate
+     * the process, which is dangerous, because some systems do not reset the
+     * saved set-userid unless euid == 0.
+     */
+#ifdef WARN_SETXID_SENDMAIL
+    if (geteuid() != getuid())
+       msg_warn("sendmail is set-uid or is run from a set-uid process");
+    if (getegid() != getgid())
+       msg_warn("sendmail is set-gid or is run from a set-gid process");
+#endif
+
     mail_conf_read();
     if (chdir(var_queue_dir))
        msg_fatal("chdir %s: %m", var_queue_dir);
@@ -773,7 +785,7 @@ int     main(int argc, char **argv)
            argv_add(ext_argv, "-v", (char *) 0);
        argv_add(ext_argv, "start", (char *) 0);
        argv_terminate(ext_argv);
-       err = mail_run_background(var_command_dir, ext_argv->argv);
+       err = (mail_run_background(var_command_dir, ext_argv->argv) < 0);
        argv_free(ext_argv);
        exit(err);
        break;
index 1e6d1e93a896aa9488f702c95b3434c69638a605..d43bccab80a57b3ff12686a297069c22f3dc1fdd 100644 (file)
@@ -317,7 +317,8 @@ static void showq_service(VSTREAM *client, char *unused_service, char **argv)
                        msg_warn("close file %s %s: %m", *queue, id);
                } else if (strcmp(*queue, MAIL_QUEUE_MAILDROP) == 0) {
                    queue_size += st.st_size;
-                   vstream_fprintf(client, DATA_FORMAT, id, (long) st.st_size,
+                   vstream_fprintf(client, DATA_FORMAT, id, ' ',
+                                   (long) st.st_size,
                                    asctime(localtime(&st.st_mtime)),
                                    "(to be determined)");
                } else if (errno != ENOENT)
index cd78128a39e6cc5bcddec250e96a15c1e4beee4c..53adda307b1ab34f777dcb81643a2521bd7d9d5b 100644 (file)
@@ -78,7 +78,6 @@ smtp.o: ../include/name_mask.h
 smtp.o: ../include/deliver_request.h
 smtp.o: ../include/vstring.h
 smtp.o: ../include/recipient_list.h
-smtp.o: ../include/mail_queue.h
 smtp.o: ../include/mail_params.h
 smtp.o: ../include/mail_conf.h
 smtp.o: ../include/debug_peer.h
index 2881bb99b1ed4a290d05dd87ed4561872f17db1f..801d1820fb07366c8661a25f0a25843824cbe8a2 100644 (file)
 /* Global library. */
 
 #include <deliver_request.h>
-#include <mail_queue.h>
 #include <mail_params.h>
 #include <mail_conf.h>
 #include <debug_peer.h>
@@ -242,20 +241,7 @@ static int deliver_message(DELIVER_REQUEST *request)
     why = vstring_alloc(100);
     state = smtp_state_alloc();
     state->request = request;
-
-    /*
-     * Open the queue file. Opening the file can fail for a variety of
-     * reasons, such as the system running out of resources. Instead of
-     * throwing away mail, we're raising a fatal error which forces the mail
-     * system to back off, and retry later.
-     */
-    state->src = mail_queue_open(request->queue_name, request->queue_id,
-                                O_RDWR, 0);
-    if (state->src == 0)
-       msg_fatal("%s: open %s %s: %m", myname,
-                 request->queue_name, request->queue_id);
-    if (msg_verbose)
-       msg_info("%s: file %s", myname, VSTREAM_PATH(state->src));
+    state->src = request->fp;
 
     /*
      * Establish an SMTP session and deliver this message to all requested
@@ -287,8 +273,6 @@ static int deliver_message(DELIVER_REQUEST *request)
     /*
      * Clean up.
      */
-    if (vstream_fclose(state->src))
-       msg_warn("close %s %s: %m", request->queue_name, request->queue_id);
     vstring_free(why);
     smtp_chat_reset(state);
     result = state->status;
index 9d32ba0749a459f88717a29837d5ad3671619f47..86e257268f6d9245f5ba716233594692183b8681 100644 (file)
@@ -365,6 +365,8 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
     DNS_RR *mx_names;
     DNS_RR *addr_list = 0;
     DNS_RR *self;
+    unsigned best_pref;
+    unsigned best_found;
 
     /*
      * Sanity check.
@@ -395,14 +397,21 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
        break;
     case DNS_OK:
        mx_names = dns_rr_sort(mx_names, smtp_compare_mx);
+       best_pref = (mx_names ? mx_names->pref : ~0);
        addr_list = smtp_addr_list(mx_names, why);
        dns_rr_free(mx_names);
+       best_found = (addr_list ? addr_list->pref : ~0);
        if (*var_fallback_relay)
            addr_list = smtp_addr_fallback(addr_list);
        if (msg_verbose)
            smtp_print_addr(name, addr_list);
        if ((self = smtp_find_self(addr_list)) != 0)
            addr_list = smtp_truncate_self(addr_list, self->pref, name, why);
+       if (addr_list == 0 && best_pref < best_found) {
+           vstring_sprintf(why, "unable to find primary mail relay for %s",
+                           name);
+           smtp_errno = SMTP_RETRY;
+       }
        break;
     case DNS_NOTFOUND:
        addr_list = smtp_host_addr(name, why);
index 429119ebe486d5f6324a07b3f9c6e499e89e9f3c..104ff958f35b7d5da04cd852c20ef253e2087707 100644 (file)
@@ -276,7 +276,7 @@ SMTP_SESSION *smtp_connect_domain(char *name, unsigned port, VSTRING *why)
            break;
        }
        msg_info("%s; address %s port %d", vstring_str(why),
-                inet_ntoa(*((struct in_addr *) addr->data)), port);
+                inet_ntoa(*((struct in_addr *) addr->data)), ntohs(port));
     }
     dns_rr_free(addr_list);
     return (session);
index cb0080354f1e51ccae380e99f7e86d3c330d3620..1e66f0c92006c7fcd8f17093ca677d8076f520cc 100644 (file)
@@ -180,9 +180,6 @@ int     smtp_helo(SMTP_STATE *state)
        if (n == 0 && strcasecmp(word, var_myhostname) == 0) {
            msg_warn("host %s greeted me with my own hostname %s",
                     session->namaddr, var_myhostname);
-           return (smtp_site_fail(state, session->best ? 550 : 450,
-                                  "mail for %s loops back to myself",
-                                  request->nexthop));
        } else if (strcasecmp(word, "ESMTP") == 0)
            state->features |= SMTP_FEATURE_ESMTP;
     }
@@ -213,7 +210,6 @@ int     smtp_helo(SMTP_STATE *state)
      * advertises a really huge message size limit.
      */
     lines = resp->str;
-    (void) mystrtok(&lines, "\n");
     while ((words = mystrtok(&lines, "\n")) != 0) {
        if (mystrtok(&words, "- ") && (word = mystrtok(&words, " \t")) != 0) {
            if (strcasecmp(word, "8BITMIME") == 0)
@@ -222,6 +218,13 @@ int     smtp_helo(SMTP_STATE *state)
                state->features |= SMTP_FEATURE_PIPELINING;
            else if (strcasecmp(word, "SIZE") == 0)
                state->features |= SMTP_FEATURE_SIZE;
+           else if (strcasecmp(word, var_myhostname) == 0) {
+               msg_warn("host %s replied to HELO/EHLO with my own hostname %s",
+                        session->namaddr, var_myhostname);
+               return (smtp_site_fail(state, session->best ? 550 : 450,
+                                      "mail for %s loops back to myself",
+                                      request->nexthop));
+           }
        }
     }
     if (msg_verbose)
index c3ad748e3d5d23787347759f09706636ce5d2b53..7a091d2c68ca8f5750aab2c715f0aedb04f78c96 100644 (file)
 /*     parameter.  Reject the request otherwise.
 /*     The \fIrelay_domains_reject_code\fR configuration parameter specifies
 /*     the reject status code (default: 554).
+/* .IP reject_unauth_destination
+/*     Allow the request when the resolved recipient domain matches the
+/*     \fIrelay_domains\fR configuration parameter.  Reject the request
+/*     otherwise.  Same error code as check_relay_domains.
 /* .IP permit_mx_backup
 /*     Allow the request when the local mail system is mail exchanger
 /*     for the recipient domain (this includes the case where the local
@@ -400,11 +404,22 @@ static int smtpd_check_reject(SMTPD_STATE *state, int error_class,
      * postmaster notices, this may be the only trace left that service was
      * rejected. Print the request, client name/address, and response.
      */
-    msg_info(state->recipient ? "reject: %s from %s: %s; from=<%s> to=<%s>"
-            : state->sender ? "reject: %s from %s: %s; from=<%s>"
-            : "reject: %s from %s: %s",
-            state->where, state->namaddr, STR(error_text),
-            state->sender, state->recipient);
+    if (state->recipient && state->sender) {
+       msg_info("reject: %s from %s: %s; from=<%s> to=<%s>",
+                state->where, state->namaddr, STR(error_text),
+                state->sender, state->recipient);
+    } else if (state->recipient) {
+       msg_info("reject: %s from %s: %s; to=<%s>",
+                state->where, state->namaddr, STR(error_text),
+                state->recipient);
+    } else if (state->sender) {
+       msg_info("reject: %s from %s: %s; from=<%s>",
+                state->where, state->namaddr, STR(error_text),
+                state->sender);
+    } else {
+       msg_info("reject: %s from %s: %s",
+                state->where, state->namaddr, STR(error_text));
+    }
     return (SMTPD_CHECK_REJECT);
 }
 
@@ -656,6 +671,45 @@ static int check_relay_domains(SMTPD_STATE *state, char *recipient,
                               var_relay_code, reply_name, reply_class));
 }
 
+/* reject_unauth_destination - FAIL for message relaying */
+
+static int reject_unauth_destination(SMTPD_STATE *state, char *recipient)
+{
+    char   *myname = "reject_unauth_destination";
+    char   *domain;
+
+    if (msg_verbose)
+       msg_info("%s: %s", myname, recipient);
+
+    /*
+     * Resolve the address.
+     */
+    canon_addr_internal(query, recipient);
+    resolve_clnt_query(STR(query), &reply);
+
+    /*
+     * Permit if destination is local. XXX This must be generalized for
+     * per-domain user tables and for non-UNIX local delivery agents.
+     */
+    if (STR(reply.nexthop)[0] == 0
+       || (domain = strrchr(STR(reply.recipient), '@')) == 0)
+       return (SMTPD_CHECK_DUNNO);
+    domain += 1;
+
+    /*
+     * Permit if the destination matches the relay_domains list.
+     */
+    if (domain_list_match(relay_domains, domain))
+       return (SMTPD_CHECK_DUNNO);
+
+    /*
+     * Deny relaying between sites that both are not in relay_domains.
+     */
+    return (smtpd_check_reject(state, MAIL_ERROR_POLICY,
+                              "%d <%s>: Relay access denied",
+                              var_relay_code, recipient));
+}
+
 /* has_my_addr - see if this host name lists one of my network addresses */
 
 static int has_my_addr(char *host)
@@ -1489,6 +1543,8 @@ char   *smtpd_check_rcpt(SMTPD_STATE *state, char *recipient)
                                       recipient, SMTPD_NAME_RECIPIENT);
        } else if (strcasecmp(name, PERMIT_MX_BACKUP) == 0) {
            status = permit_mx_backup(state, recipient);
+       } else if (strcasecmp(name, REJECT_UNAUTH_DEST) == 0) {
+           status = reject_unauth_destination(state, recipient);
        } else if (strcasecmp(name, CHECK_RELAY_DOMAINS) == 0) {
            status = check_relay_domains(state, recipient,
                                         recipient, SMTPD_NAME_RECIPIENT);
index 078e7f393087a43438ab029124481bb862006f1c..d6150beffab848e5b1be14c2779688288dd0815f 100644 (file)
@@ -83,6 +83,7 @@
 #include <mymalloc.h>
 #include <events.h>
 #include <find_inet.h>
+#include <iostuff.h>
 
 /* Global library. */
 
@@ -261,7 +262,11 @@ static void startup(SESSION *session)
            if (!connect(fd, (struct sockaddr *) & sin, sizeof(sin)))
                break;
            if (session->connect_count-- > 1)
+#ifdef MISSING_USLEEP
+               doze(10);
+#else
                usleep(10);
+#endif
        }
        session->stream = vstream_fdopen(fd, O_RDWR);
        smtp_timeout_setup(session->stream, var_timeout);
index 9d34b33fc4b6f34785660ad25e090814110aef47..1c8b7dc68ffc70ebc9511fbae63df9165fa32dbb 100644 (file)
@@ -297,7 +297,6 @@ close_on_exec.o: close_on_exec.c
 close_on_exec.o: sys_defs.h
 close_on_exec.o: msg.h
 close_on_exec.o: iostuff.h
-compat.o: compat.c
 concatenate.o: concatenate.c
 concatenate.o: sys_defs.h
 concatenate.o: mymalloc.h
index e96e8820c4f636c8bee34aff59d531ce76867b31..db2ed34e7fb18edd01ed41f5aebff832d74fa3d4 100644 (file)
@@ -56,6 +56,7 @@
 #include <db.h>
 #endif
 #include <string.h>
+#include <unistd.h>
 
 /* Utility library. */
 
@@ -345,18 +346,32 @@ static void dict_db_close(DICT *dict)
 
 /* dict_db_open - open data base */
 
-static DICT *dict_db_open(const char *path, int flags, int type,
+static DICT *dict_db_open(const char *path, int open_flags, int type,
                                  void *tweak, int dict_flags)
 {
     DICT_DB *dict_db;
     struct stat st;
     DB     *db;
     char   *db_path;
+    int     lock_fd = -1;
 
     db_path = concatenate(path, ".db", (char *) 0);
-    if ((db = dbopen(db_path, flags, 0644, type, tweak)) == 0)
+
+    if (dict_flags & DICT_FLAG_LOCK) {
+       if ((lock_fd = open(db_path, open_flags, 0644)) < 0)
+           msg_fatal("open database %s: %m", db_path);
+       if (myflock(lock_fd, MYFLOCK_SHARED) < 0)
+           msg_fatal("shared-lock database %s for open: %m", db_path);
+    }
+    if ((db = dbopen(db_path, open_flags, 0644, type, tweak)) == 0)
        msg_fatal("open database %s: %m", db_path);
 
+    if (dict_flags & DICT_FLAG_LOCK) {
+       if (myflock(lock_fd, MYFLOCK_NONE) < 0)
+           msg_fatal("unlock database %s for open: %m", db_path);
+       if (close(lock_fd) < 0)
+           msg_fatal("close database %s: %m", db_path);
+    }
     dict_db = (DICT_DB *) mymalloc(sizeof(*dict_db));
     dict_db->dict.lookup = dict_db_lookup;
     dict_db->dict.update = dict_db_update;
@@ -369,7 +384,7 @@ static DICT *dict_db_open(const char *path, int flags, int type,
     dict_db->dict.mtime = st.st_mtime;
     close_on_exec(dict_db->dict.fd, CLOSE_ON_EXEC);
     dict_db->dict.flags = dict_flags | DICT_FLAG_FIXED;
-    if ((flags & (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL)) == 0)
+    if ((dict_flags & (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL)) == 0)
        dict_db->dict.flags |= (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL);
     dict_db->db = db;
     dict_db->path = db_path;
index 64d7d346b29e7873160acb19acfa184b0c851c54..46d9aea3db109af520273ccf0253a6f28d233cad 100644 (file)
@@ -39,6 +39,7 @@
 #include <sys/stat.h>
 #include <ndbm.h>
 #include <string.h>
+#include <unistd.h>
 
 /* Utility library. */
 
@@ -48,6 +49,7 @@
 #include "iostuff.h"
 #include "vstring.h"
 #include "myflock.h"
+#include "stringops.h"
 #include "dict.h"
 #include "dict_dbm.h"
 
@@ -349,6 +351,16 @@ DICT   *dict_dbm_open(const char *path, int open_flags, int dict_flags)
     DICT_DBM *dict_dbm;
     struct stat st;
     DBM    *dbm;
+    char   *dbm_path;
+    int     lock_fd;
+
+    if (dict_flags & DICT_FLAG_LOCK) {
+       dbm_path = concatenate(path, ".pag", (char *) 0);
+       if ((lock_fd = open(dbm_path, open_flags, 0644)) < 0)
+           msg_fatal("open database %s: %m", dbm_path);
+       if (myflock(lock_fd, MYFLOCK_SHARED) < 0)
+           msg_fatal("shared-lock database %s for open: %m", dbm_path);
+    }
 
     /*
      * XXX SunOS 5.x has no const in dbm_open() prototype.
@@ -356,6 +368,13 @@ DICT   *dict_dbm_open(const char *path, int open_flags, int dict_flags)
     if ((dbm = dbm_open((char *) path, open_flags, 0644)) == 0)
        msg_fatal("open database %s.{dir,pag}: %m", path);
 
+    if (dict_flags & DICT_FLAG_LOCK) {
+       if (myflock(lock_fd, MYFLOCK_NONE) < 0)
+           msg_fatal("unlock database %s for open: %m", dbm_path);
+       if (close(lock_fd) < 0)
+           msg_fatal("close database %s: %m", dbm_path);
+       myfree(dbm_path);
+    }
     dict_dbm = (DICT_DBM *) mymalloc(sizeof(*dict_dbm));
     dict_dbm->dict.lookup = dict_dbm_lookup;
     dict_dbm->dict.update = dict_dbm_update;
@@ -366,7 +385,6 @@ DICT   *dict_dbm_open(const char *path, int open_flags, int dict_flags)
     if (fstat(dict_dbm->dict.fd, &st) < 0)
        msg_fatal("dict_dbm_open: fstat: %m");
     dict_dbm->dict.mtime = st.st_mtime;
-    close_on_exec(dict_dbm->dict.fd, CLOSE_ON_EXEC);
     dict_dbm->dict.flags = dict_flags | DICT_FLAG_FIXED;
     if ((dict_flags & (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL)) == 0)
        dict_dbm->dict.flags |= (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL);
index dbe02f9a5121b8a68b59693087ad0a94b3bba70e..3acc2b3b92bf4e3cfce2959e1a442e4199f38e68 100644 (file)
@@ -9,7 +9,7 @@
 /*     int     inet_addr_local(list)
 /*     INET_ADDR_LIST *list;
 /* DESCRIPTION
-/*     inet_addr_local() determines all active interface addresses
+/*     inet_addr_local() determines all active IP interface addresses
 /*     of the local system. Any address found is appended to the
 /*     specified address list. The result value is the number of
 /*     active interfaces found.
 #include <inet_addr_list.h>
 #include <inet_addr_local.h>
 
+ /*
+  * Support for variable-length addresses.
+  */
+#ifdef _SIZEOF_ADDR_IFREQ
+#define NEXT_INTERFACE(ifr) ((struct ifreq *) \
+       ((char *) ifr + _SIZEOF_ADDR_IFREQ(*ifr)))
+#else
+#ifdef HAS_SA_LEN
+#define NEXT_INTERFACE(ifr) ((struct ifreq *) \
+       ((char *) ifr + sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len))
+#else
+#define NEXT_INTERFACE(ifr) (ifr + 1)
+#endif
+#endif
+
 /* inet_addr_local - find all IP addresses for this host */
 
 int     inet_addr_local(INET_ADDR_LIST *addr_list)
@@ -109,16 +124,7 @@ int     inet_addr_local(INET_ADDR_LIST *addr_list)
                    &(((struct sockaddr_in *) & ifreq.ifr_addr)->sin_addr));
            }
        }
-
-       /*
-        * Support for variable-length addresses.
-        */
-#ifdef HAS_SA_LEN
-       ifr = (struct ifreq *)
-           ((char *) ifr + sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len);
-#else
-       ifr++;
-#endif
+       ifr = NEXT_INTERFACE(ifr);
     }
     vstring_free(buf);
     (void) close(sock);
index 1b5680bde691042f36cda8acab8519029ed23d19..3c8cc2590bc9074308b53d37d09b4b294ffe8922 100644 (file)
 /* System library. */
 
 #include <sys_defs.h>
+#ifdef HAVE_DIRENT_H
 #include <dirent.h>
+#else
+#define dirent direct
+#ifdef HAVE_SYS_NDIR_H
+#include <sys/ndir.h>
+#endif
+#ifdef HAVE_SYS_DIR_H
+#include <sys/dir.h>
+#endif
+#ifdef HAVE_NDIR_H
+#include <ndir.h>
+#endif
+#endif
 #include <string.h>
 
 /* Utility library. */
index 2264f3083ad5b8349ccb3fbefff572efa32a2f14..c75e90204da34375ea4bcac005838e636979750c 100644 (file)
@@ -20,6 +20,9 @@
 /*
 /*     split_at_right() looks for the rightmost delimiter
 /*     occurrence, but is otherwise identical to split_at().
+/* DIAGNOSTICS
+/*     The result is a null pointer when the delimiter character
+/*     was not found.
 /* HISTORY
 /* .ad
 /* .fi
index 70126fa8bb490b6dd6dcfa64aed6d1ac9628e628..7a956383b2365bd8a084162dcc7eca3460088862 100644 (file)
 
 #if defined(RHAPSODY5)
 #define NORETURN       void
+#define HAS_NETINFO
 #endif
 
 #ifdef ULTRIX4
 #define SUPPORTED
+/* Ultrix by default has only 64 descriptors per process */
+#ifndef FD_SETSIZE
+#define FD_SETSIZE     96
+#endif
 #include <sys/types.h>
 #define UNSAFE_CTYPE                   /* XXX verify */
 #define _PATH_MAILDIR  "/var/spool/mail"
@@ -85,11 +90,7 @@ extern int opterr;
 /* Ultrix misses just S_ISSOCK, the others are there */
 #define S_ISSOCK(mode) (((mode) & (S_IFMT)) == (S_IFSOCK))
 #define DUP2_DUPS_CLOSE_ON_EXEC
-/* Ultrix by default has only 64 descriptors per process */
-#ifndef FD_SETSIZE
-#define FD_SETSIZE     100
-#endif
-#define usleep         doze
+#define MISSING_USLEEP
 #endif
 
 #ifdef OSF1
@@ -316,7 +317,7 @@ extern int initgroups(const char *, int);
 #endif
 
 #if defined(IRIX5)
-#define usleep doze
+#define MISSING_USLEEP
 #endif
 
 #ifdef LINUX2
@@ -324,6 +325,7 @@ extern int initgroups(const char *, int);
 #include <sys/types.h>
 #define USE_PATHS_H
 #define USE_FLOCK_LOCK
+#define USE_DOT_LOCK
 #define HAS_FSYNC
 #define HAS_DB
 #define DEF_DB_TYPE    "hash"
@@ -337,6 +339,7 @@ extern int initgroups(const char *, int);
 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
 #define PREPEND_PLUS_TO_OPTSTRING
 #define HAS_POSIX_REGEXP
+#define WARN_SETXID_SENDMAIL
 #endif
 
  /*
@@ -460,7 +463,7 @@ extern int h_errno;
 #define _PATH_STDPATH  "/bin:/usr/bin:/usr/ucb"
 #define ROOT_PATH      "/bin:/usr/bin:/usr/etc:/usr/ucb"
 #define DEF_DB_TYPE    "dbm"
-#define ALIAS_DB_MAP   "dbm:/etc/sendmail/aliases"
+#define ALIAS_DB_MAP   "netinfo:/aliases"
 #include <libc.h>
 #define MISSING_POSIX_S_IS
 #define MISSING_POSIX_S_MODES
@@ -508,7 +511,7 @@ extern int opterr;
 #define _PATH_STDPATH  "/bin:/usr/bin:/usr/ucb"
 #define ROOT_PATH      "/bin:/usr/bin:/usr/etc:/usr/ucb"
 #define DEF_DB_TYPE    "dbm"
-#define ALIAS_DB_MAP   "dbm:/etc/sendmail/aliases"
+#define ALIAS_DB_MAP   "netinfo:/aliases"
 #include <libc.h>
 #define MISSING_POSIX_S_IS
 #define MISSING_POSIX_S_MODES
@@ -549,7 +552,7 @@ extern int opterr;                  /* XXX use <getopt.h> */
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
 #define USE_STATVFS
 #define STATVFS_IN_SYS_STATVFS_H
-#define usleep doze
+#define MISSING_USLEEP
 #endif
 
  /*