]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20001210
authorWietse Venema <wietse@porcupine.org>
Sun, 10 Dec 2000 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:26:59 +0000 (06:26 +0000)
24 files changed:
postfix/HISTORY
postfix/INSTALL.sh
postfix/MYSQL_README
postfix/RELEASE_NOTES
postfix/conf/main.cf
postfix/conf/sample-local.cf
postfix/conf/sample-misc.cf
postfix/conf/sample-smtp.cf
postfix/src/global/Makefile.in
postfix/src/global/mail_version.h
postfix/src/global/mbox_open.c
postfix/src/master/Makefile.in
postfix/src/nqmgr/Makefile.in
postfix/src/nqmgr/qmgr_deliver.c
postfix/src/nqmgr/qmgr_message.c
postfix/src/postdrop/Makefile.in
postfix/src/qmgr/Makefile.in
postfix/src/qmgr/qmgr_deliver.c
postfix/src/qmgr/qmgr_message.c
postfix/src/util/dict_mysql.c
postfix/src/util/name_mask.c
postfix/src/util/safe_open.c
postfix/src/util/sys_defs.h
postfix/src/util/vstream_popen.c

index aa742df65c4278be1fdb4dfdafe2a97c9543b9b8..bdfbb6022b6dc2fc7c9176696f6349659d897bfe 100644 (file)
@@ -4528,16 +4528,24 @@ Apologies for any names omitted.
        Feature: mailbox locking is now configurable. The configuration
        parameter name is "mailbox_delivery_lock". Depending on
        the operating system one can specify one or more of "flock",
-       "fcntl" and "dotlock". The default setting is system
-       dependent.  All mailbox file opens are now done by the
-       mbox_open() routine. This affects the operation of the
-       postlock command, and of local delivery to mailbox or
-       /file/name.  Files: util/safe_open.c, util/myflock.c,
+       "fcntl" and "dotlock". Use "postconf -l" to find out what
+       locking methods Postfix supports. The default setting is
+       system dependent.  All mailbox file opens are now done by
+       one central mbox_open() routine. This affects the operation
+       of the postlock command, and of local delivery to mailbox
+       or /file/name.  Files: util/safe_open.c, util/myflock.c,
        global/deliver_flock.c, global/mbox_conf.c, global/mbox_open.c.
-       local/mailbox.c, local/file.c, postlock/postlock.c.  The
-       old sun_mailtool_compatibility parameter is being phased
-       out (it just turns off flock/fcntl locks). It still works,
-       but a warning is logged as a reminder that it goes away.
+       local/mailbox.c, local/file.c, postlock/postlock.c.  
+
+       Compatibility: the old sun_mailtool_compatibility parameter
+       is being phased out. It still works (by turning off
+       flock/fcntl locks), but logs a warning as a reminder that
+       it will go away.
+
+       Compatibility: when delivering to /file/name, the local
+       delivery agent now logs a warning when it is unable to
+       create a /file/name.lock file, and then delivers the mail
+       (older Postfix versions would silently deliver).
 
 20001202
 
@@ -4545,11 +4553,10 @@ Apologies for any names omitted.
        ESMTP.  Someone asked for this long ago. Files:  smtp/smtp.c,
        smtp/smtp_proto.c.
 
-       Feature? Bugfix? The smtp client will now ignore server
-       replies that do not start with "CODE SPACE" or with "CODE
-       HYPHEN". Which means that "CODE TEXT" is now treated as
-       "CODE HYPHEN TEXT", instead of being treated as "CODE SPACE
-       TEXT", the way it was before. File:  smtp/smtp_chat.c.
+       Feature? Bugfix? The smtp client now skips server replies
+       that do not start with "CODE SPACE" or with "CODE HYPHEN",
+       and flags them as protocol errors. Older versions silently
+       treat "CODE TEXT" as "CODE SPACE TEXT".  File:  smtp/smtp_chat.c.
 
 20001203
 
@@ -4558,14 +4565,14 @@ Apologies for any names omitted.
 
 20001204
 
-       Bugfix: master no longer imported MAIL_CONF and other
-       necessary environmental parameters. Postfix now has
-       explicit "import_environment" and "export_environment"
-       configuration parameters that control what environment
-       parameters are imported from or exported to the external
-       environment. Files: util/clean_env.c, util/spawn_command.c,
+       Bugfix: the Postfix master daemon no longer imported
+       MAIL_CONF and some other necessary environment parameters.
+       Postfix now has explicit "import_environment" and
+       "export_environment" configuration parameters that control
+       what environment parameters are shared with non-Postfix
+       processes. Files: util/clean_env.c, util/spawn_command.c,
        util/vstream_popen.c, global/pipe_command.c, and everything
-       that uses this code.
+       that invokes this code.
 
 20001208
 
@@ -4586,9 +4593,18 @@ Apologies for any names omitted.
        example, "mailbox_transport = lmtp:unix:/file/name". File:
        global/deliver_pass.c.
 
-       Bugfix: local_destination_concurrency_limit no longer works
-       as per-user concurrency limit but as per-domain limit, so
-       the limit of "2" in the sample main.cf files would result
-       in poor local delivery performance. The Postfix install
-       procedure repairs this.  Problem reported by David Schweikert
-       (ee.ethz.ch) and Dallas Wisehaupt (cynicism.com).
+20001210
+
+       Bugfix: the local_destination_concurrency_limit paramater
+       no longer worked as per-user concurrency limit but instead
+       worked as per-domain limit, so that the limit of "2" in
+       the default main.cf files resulted in poor local delivery
+       performance.  Files:  qmgr/qmgr_message.c, qmgr/qmgr_deliver.c.
+       Problem reported by David Schweikert (ee.ethz.ch) and Dallas
+       Wisehaupt (cynicism.com).
+
+20001210
+
+       Feature: support for MYSQL connections over UNIX-domain
+       sockets by Piotr Klaban.  Files: util/dict_mysql.c,
+       MYSQL_README.
index c2e8e79a8145eb7b0eec837daed4d6811e4ccd61..df4f74351f1ccdec61bcd5a3dafb0c40ac3dd63a 100644 (file)
@@ -285,7 +285,6 @@ bin/postconf -c $CONFIG_DIRECTORY -e \
     "command_directory = $command_directory" \
     "queue_directory = $queue_directory" \
     "mail_owner = $mail_owner" \
-    "local_destination_concurrency_limit = 0" \
 || exit 1
 
 (echo "# This file was generated by $0"
index 7fb79e108816238cc0c5bc61df60c51a6187e76d..31cdcdc55dd46913f50363eff16cf68e95c8fa5b 100644 (file)
@@ -60,7 +60,8 @@ additional_conditions = and status = 'paid'
 #
 # the hosts that postfix will try to connect to
 # and query from (in the order listed)
-hosts = host1.some.domain host2.some.domain
+# specify unix: for unix-domain sockets, inet: for TCP connections (default)
+hosts = host1.some.domain host2.some.domain unix:/file/name
 
 # end mysql config file
 
index 4b481b439b00a930133a7c776d52655fcfa3261d..5a312ef2854596506e5513dfd76557200cd292df 100644 (file)
@@ -1,27 +1,76 @@
-Incompatible changes with snapshot-2000XXXX
+Incompatible changes with snapshot-20001210
 ===========================================
 
-The "sun_mailtool_compatibility" is going away (a compatibility mode
-that turns off kernel locks on mailbox files). It still works, but
-a warning is logged. Instead, specify the mailbox locking strategy
-via the new "mailbox_delivery_lock" parameter.
+If this release does not work for you, you can go back to a previous
+Postfix version without losing your mail, subject to the "incompatible
+changes" listed for previous Postfix releases below.
 
-Major changes with snapshot-2000XXXX
+When delivering to /file/name (as directed in an alias or .forward
+file), the local delivery agent now logs a warning when it is unable
+to create a /file/name.lock file. Mail is still delivered as before.
+
+The "sun_mailtool_compatibility" feature is going away (a compatibility
+mode that turns off kernel locks on mailbox files). It still works,
+but a warning is logged. Instead of using "sun_mailtool_compatibility",
+specify the mailbox locking strategy as "mailbox_delivery_lock =
+dotlock".
+
+The Postfix SMTP client now skips SMTP server replies that do not
+start with "CODE SPACE" or with "CODE HYPHEN" and flags them as
+protocol errors. Older Postfix SMTP clients silently treated "CODE
+TEXT" as "CODE SPACE TEXT", i.e. as a valid SMTP reply.
+
+This snapshot does not yet change default relay settings. That
+change alone affects a dozen files, most of which documentation.
+This may be an incompatibility with some people's expectations,
+but such are my rules - between code freeze and release no major
+functionality changes are allowed.
+
+Several interfaces of libutil and libglobal routines have changed.
+This may break third-party code written for Postfix. In particular,
+the safe_open() routine has changed, the way the preferred locking
+method is specified in the sys_defs.h file, as well as all routines
+that perform file locking. When compiling third-party code written
+for Postfix, the incompatibilities will be detected by the compiler
+provided that #include file dependencies are properly maintained.
+
+Major changes with snapshot-20001210
 ====================================
 
+This snapshot includes bugfixes that were already released as
+patches 12 and 13 for the 19991231 "stable" release:
+
+  - The queue manager could deadlock for 10 seconds when bouncing
+    mail under extreme load from one-to-one mass mailings.
+
+  - Local delivery performance was substandard, because the per-user
+    concurrency limit accidentally applied to the entire local
+    domain.
+
 The mailbox locking style is now fully configurable at runtime.
-The new configuration parameter is "mailbox_delivery_lock".
+The new configuration parameter is called "mailbox_delivery_lock".
 Depending on the operating system type, mailboxes can be locked
-with one or more of "flock", "fcntl" or "dotlock". This also applies
-to "/file/name" deliveries by the Postfix local delivery agent.
-The default setting of "mailbox_delivery_lock" is system dependent.
-The command "postconf -l" shows the available locking styles.
-
-The "import_environment" and "export_environment" configuration
-parameters now control what environment variables Postfix will
-import from its parent and what it variables Postfix will pass on
-to a non-Postfix process. It is not safe to import or export
-everything, and different sites may have different needs.
+with one or more of "flock", "fcntl" or "dotlock".  The command
+"postconf -l" shows the available locking styles.  The default
+mailbox locking style is system dependent.  This change affects
+all mailbox and all "/file/name" deliveries by the Postfix local
+delivery agent.
+
+The new "import_environment" and "export_environment" configuration
+parameters now provide explicit control over what environment
+variables Postfix will import, and what environment variables
+Postfix will pass on to a non-Postfix process. This is better than
+hard-coding my debugging environment into public releases.
+
+The "mailbox_transport" and "fallback_transport" parameters now
+understand the form "transport:nexthop", with suitable defaults
+when either transport or nexthop are omitted, just like in the
+Postfix transport map. This allows you to specify for example,
+"mailbox_transport = lmtp:unix:/file/name".
+
+The MYSQL client now supports server connections over UNIX-domain
+sockets.  Code provided by Piotr Klaban. See the file MYSQL_README
+for examples of "host" syntax.
 
 Incompatible changes with snapshot-20001121
 ===========================================
index 52334767fec3e26827b6ec4f2b39f32573625237..a2a81298bd6f061a3736b9eea35a8f7bf708ae02 100644 (file)
@@ -5,6 +5,17 @@
 # that begin with whitespace continue the previous line. A value can
 # contain references to other $names or ${name}s.
 
+# SOFT BOUNCE
+#
+# The soft_bounce parameter provides a limited safety net for
+# testing.  When soft_bounce is enabled, mail will remain queued that
+# would otherwise bounce. This parameter disables locally-generated
+# bounces, and prevents the SMTP server from rejecting mail permanently
+# (by changing 5xx replies into 4xx replies). However, soft_bounce
+# is no cure for address rewriting mistakes or mail routing mistakes.
+#
+#soft_bounce = no
+
 # LOCAL PATHNAME INFORMATION
 #
 # The queue_directory specifies the location of the Postfix queue.
@@ -388,11 +399,8 @@ mail_owner = postfix
 # 
 # Each message delivery transport has its XXX_destination_concurrency_limit
 # parameter.  The default is $default_destination_concurrency_limit.
-# The limit is per destination domain, so the destination concurrency
-# limit for local delivery must be set to zero otherwise performance
-# will suffer.
 
-local_destination_concurrency_limit = 0
+local_destination_concurrency_limit = 2
 default_destination_concurrency_limit = 10
 
 # DEBUGGING CONTROL
index ab2214468dabadca2e3b5accdbccce3943593a60..183e524ffd6a83c98bee91c98582a69801c166d5 100644 (file)
 # biff = no
 biff = yes
 
+# The require_home_directory parameter controls whether a local
+# recipient's home directory must exist before mail delivery is
+# attempted. By default this test is disabled. It can be useful for
+# environments that import home directories to the file server (NOT
+# RECOMMENDED).
+# 
+require_home_directory = no
+
 #
 # OVERRIDE LOCAL TRANSPORT
 #
@@ -177,15 +185,14 @@ fallback_transport =
 #
 
 # The local_destination_concurrency_limit parameter limits the number
-# of parallel deliveries to the local domain. It should therefore be
-# set to zero, in order to prevent poor local delivery performance.
-# In old Postfix versions this parameter implemented a per-user
-# limit. That is no longer the case.
+# of parallel deliveries to the same local recipient.
 #
 # The default limit is taken from the default_destination_concurrency_limit
-# parameter. 
+# parameter. I recommend a low limit of 2, just in case someone has
+# an expensive shell command in a .forward file or in an alias (e.g.,
+# a mailing list manager). You don't want to run lots of those.
 #
-local_destination_concurrency_limit = 0
+local_destination_concurrency_limit = 2
 
 # The local_destination_recipient_limit parameter limits the number
 # of recipients per local message delivery.  The default limit is
index 0741e0e20d5475c85d0c48d954b4561db4485af0..436767b3c453631399e9f08d36c5aca4e1e6806e 100644 (file)
@@ -260,6 +260,25 @@ queue_directory = /var/spool/postfix
 # recipient_delimiter = +
 recipient_delimiter =
 
+# The propagate_unmatched_extensions parameter specifies what lookup
+# tables should copy the address extension from the lookup key to
+# the lookup result. 
+# 
+# For example, with a virtual table entry "joe@domain joe.user",
+# the address joe+foo@domain would be rewritten to joe.user+foo.
+# Address extensions can be propagated with canonical, virtual,
+# and alias maps, as well as with .forward and :include: files,
+# including mailing lists!!
+#
+# By default, only canonical and virtual maps propagate address
+# extensions to lookup results. Enabling this feature for other
+# types of lookups usually causes problems when mail is forwarded
+# to other sites, especially with mail that is sent to a mailing
+# list exploder address.
+#
+#propagate_unmatched_extensions = canonical, virtual, alias, forward, include
+#propagate_unmatched_extensions = canonical, virtual
+
 # The relayhost parameter specifies the default host to send mail to
 # when no entry is matched in the optional transport(5) table. When
 # no relayhost is given, mail is routed directly to the destination.
@@ -293,15 +312,6 @@ relayhost =
 # relocated_maps = hash:/etc/postfix/relocated
 relocated_maps =
 
-# The sun_mailtool_compatibility parameter disables kernel file locks
-# on mailboxes. This is needed on SUN workstations because the mailtool
-# program keeps an exclusive kernel lock while its window is open.
-# SUN software uses user.lock files only. Unless you remove all SUN
-# mail software, kernel locks just give a false sense of security.
-#
-#sun_mailtool_compatibility = yes
-sun_mailtool_compatibility = no
-
 # The syslog_facility parameter controls where Postfix logging is
 # sent by the syslog daemon. Specify a logging facility as defined
 # in syslog.conf(5). The default logging facility is "mail".
index 2359377f8dd56f920366e746ca0c1f80d2aa3206..680c714bdaf7726d76f10aa327e2c23931ef2113 100644 (file)
@@ -38,6 +38,24 @@ fallback_relay =
 #
 ignore_mx_lookup_error = no
 
+# The smtp_always_send_ehlo parameter specifies that the SMTP client
+# should always send EHLO at the start of an SMTP session.
+# 
+# By default, Postfix sends EHLO only when the word "ESMTP" appears
+# in the server greeting banner (example: 220 spike.porcupine.org
+# ESMTP Postfix).
+#
+smtp_always_send_ehlo = no
+
+# The smtp_never_send_ehlo parameter specifies that the SMTP client 
+# should never send EHLO at the start of an SMTP session.
+#
+# By default, Postfix sends EHLO whenever the word "ESMTP" appears
+# in the server greeting banner (example: 220 spike.porcupine.org
+# ESMTP Postfix).
+#
+smtp_never_send_ehlo = no
+
 # The smtp_bind_address parameter specifies a numerical network
 # address that the client should bind to when making a connection.
 # This can be used in the main.cf file, or in the master.cf file,
index c19cd75aecb750e6362455603fa37ff88d445508..fac2db938329c5c6eceb987ff413e40915ccfbe3 100644 (file)
@@ -243,6 +243,17 @@ depend: $(MAKES)
        @$(EXPORT) make -f Makefile.in Makefile 1>&2
 
 # do not edit below this line - it is generated by 'make depend'
+abounce.o: abounce.c
+abounce.o: ../../include/sys_defs.h
+abounce.o: ../../include/msg.h
+abounce.o: ../../include/mymalloc.h
+abounce.o: ../../include/events.h
+abounce.o: ../../include/vstream.h
+abounce.o: ../../include/vbuf.h
+abounce.o: mail_proto.h
+abounce.o: ../../include/iostuff.h
+abounce.o: abounce.h
+abounce.o: bounce.h
 been_here.o: been_here.c
 been_here.o: ../../include/sys_defs.h
 been_here.o: ../../include/msg.h
@@ -343,6 +354,9 @@ deliver_pass.o: ../../include/msg.h
 deliver_pass.o: ../../include/vstring.h
 deliver_pass.o: ../../include/vbuf.h
 deliver_pass.o: ../../include/vstream.h
+deliver_pass.o: ../../include/split_at.h
+deliver_pass.o: ../../include/mymalloc.h
+deliver_pass.o: mail_params.h
 deliver_pass.o: deliver_pass.h
 deliver_pass.o: deliver_request.h
 deliver_pass.o: recipient_list.h
@@ -595,6 +609,9 @@ mail_params.o: ../../include/vbuf.h
 mail_params.o: mynetworks.h
 mail_params.o: mail_conf.h
 mail_params.o: mail_version.h
+mail_params.o: mail_proto.h
+mail_params.o: ../../include/vstream.h
+mail_params.o: ../../include/iostuff.h
 mail_params.o: mail_params.h
 mail_pathname.o: mail_pathname.c
 mail_pathname.o: ../../include/sys_defs.h
@@ -659,11 +676,13 @@ mail_stream.o: ../../include/vstring.h
 mail_stream.o: ../../include/vbuf.h
 mail_stream.o: ../../include/vstream.h
 mail_stream.o: ../../include/stringops.h
+mail_stream.o: ../../include/argv.h
 mail_stream.o: cleanup_user.h
 mail_stream.o: mail_proto.h
 mail_stream.o: ../../include/iostuff.h
 mail_stream.o: mail_queue.h
 mail_stream.o: opened.h
+mail_stream.o: mail_params.h
 mail_stream.o: mail_stream.h
 mail_task.o: mail_task.c
 mail_task.o: ../../include/sys_defs.h
index 7588e001ea93317a32e4e7a3e0b4a43aeda559f9..6600e0d3b156ad0034def43872a65df16236891e 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-20001209"
+#define DEF_MAIL_VERSION       "Snapshot-20001210"
 extern char *var_mail_version;
 
 /* LICENSE
index e53373b9109b186767398d916361a09f60e71c82..d533dd86f3de70c13268b760d19728d5f2647045 100644 (file)
@@ -102,7 +102,7 @@ MBOX   *mbox_open(const char *path, int flags, int mode, struct stat * st,
      */
     if (st == 0)
        st = &local_statbuf;
-    if ((fp = safe_open(path, flags, mode | O_NONBLOCK, st,
+    if ((fp = safe_open(path, flags | O_NONBLOCK, mode, st,
                        chown_uid, chown_gid, why)) == 0) {
        return (0);
     }
index 3acb84e40cba62403bb254d93ef05698c86082f9..83d6200cc343be094328e4f7b0b48b8509a27dbf 100644 (file)
@@ -92,6 +92,7 @@ master.o: ../../include/stringops.h
 master.o: ../../include/myflock.h
 master.o: ../../include/watchdog.h
 master.o: ../../include/clean_env.h
+master.o: ../../include/argv.h
 master.o: ../../include/mail_params.h
 master.o: ../../include/debug_process.h
 master.o: ../../include/mail_task.h
index 608f7faa8f4e46c5030fb4d82a730df6cdb28c8d..eea19d355bef1fc83296eb67dcc80d266b8f6878 100644 (file)
@@ -94,6 +94,7 @@ qmgr_active.o: ../../include/vstring.h
 qmgr_active.o: ../../include/recipient_list.h
 qmgr_active.o: ../../include/bounce.h
 qmgr_active.o: ../../include/defer.h
+qmgr_active.o: ../../include/abounce.h
 qmgr_active.o: ../../include/rec_type.h
 qmgr_active.o: qmgr.h
 qmgr_active.o: ../../include/scan_dir.h
index aacb8efa54afe17daa67cfb9c2ba0e46d207a5ac..3c479746f0f3bccb3e47f275190ab0a7df53a9af 100644 (file)
@@ -50,6 +50,7 @@
 
 #include <sys_defs.h>
 #include <time.h>
+#include <string.h>
 
 /* Utility library. */
 
@@ -122,11 +123,18 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream)
     QMGR_RCPT_LIST list = entry->rcpt_list;
     QMGR_RCPT *recipient;
     QMGR_MESSAGE *message = entry->message;
+    char   *cp;
 
+    /*
+     * With local delivery, the queue name is user@nexthop, so that we can
+     * implement per-recipient concurrency limits. The delivery agent
+     * protocol expects nexthop only.
+     */
     mail_print(stream, "%d %s %s %ld %ld %s %s %s %s %ld",
          message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT,
               message->queue_name, message->queue_id,
               message->data_offset, message->data_size,
+           (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ? cp + 1 :
               entry->queue->name, message->sender,
               message->errors_to, message->return_receipt,
               message->arrival_time);
index 91b261354fe61be6dde286b1a3e8065155f4d883..aa2ad115734b2730fe767b03aae6261a25805493 100644 (file)
@@ -678,8 +678,9 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
         */
        if ((at = strrchr(STR(reply.recipient), '@')) == 0
            || resolve_local(at + 1)) {
-#if 0
            vstring_strcpy(reply.nexthop, STR(reply.recipient));
+           lowercase(STR(reply.nexthop));
+#if 0
            (void) split_at_right(STR(reply.nexthop), '@');
 #endif
 #if 0
index 8a1a5983cf777e81e29f5ed2602c307323513099..2d893c3ac61449bab3e60bae24351b1aaba42e69 100644 (file)
@@ -62,6 +62,7 @@ postdrop.o: ../../include/vbuf.h
 postdrop.o: ../../include/vstring.h
 postdrop.o: ../../include/msg_vstream.h
 postdrop.o: ../../include/msg_syslog.h
+postdrop.o: ../../include/argv.h
 postdrop.o: ../../include/mail_proto.h
 postdrop.o: ../../include/iostuff.h
 postdrop.o: ../../include/mail_queue.h
index 91f57e21ff54fa9c8606dc5c8b10fecd8bfc7ce6..c37f1d78fd0c6bf3e97d411009215d7ef6b6aeec 100644 (file)
@@ -92,6 +92,7 @@ qmgr_active.o: ../../include/vstring.h
 qmgr_active.o: ../../include/recipient_list.h
 qmgr_active.o: ../../include/bounce.h
 qmgr_active.o: ../../include/defer.h
+qmgr_active.o: ../../include/abounce.h
 qmgr_active.o: ../../include/rec_type.h
 qmgr_active.o: qmgr.h
 qmgr_active.o: ../../include/scan_dir.h
index cfc49de7333427b8981057f6c0b5239c9f8ce41f..003c4373e8125de628ebe83caf2fa7efa29b19e5 100644 (file)
@@ -45,6 +45,7 @@
 
 #include <sys_defs.h>
 #include <time.h>
+#include <string.h>
 
 /* Utility library. */
 
@@ -117,11 +118,18 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream)
     QMGR_RCPT_LIST list = entry->rcpt_list;
     QMGR_RCPT *recipient;
     QMGR_MESSAGE *message = entry->message;
+    char   *cp;
 
+    /*
+     * With local delivery, the queue name is user@nexthop, so that we can
+     * implement per-recipient concurrency limits. The delivery agent
+     * protocol expects nexthop only.
+     */
     mail_print(stream, "%d %s %s %ld %ld %s %s %s %s %ld",
          message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT,
               message->queue_name, message->queue_id,
               message->data_offset, message->data_size,
+           (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ? cp + 1 :
               entry->queue->name, message->sender,
               message->errors_to, message->return_receipt,
               message->arrival_time);
index 6e532a5b9841c2d2f50dea17ae19bf3384313d6b..cc02674bc0b64d57f5d1edadcef5a93e7f26cf7b 100644 (file)
@@ -556,8 +556,9 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
         */
        if ((at = strrchr(STR(reply.recipient), '@')) == 0
            || resolve_local(at + 1)) {
-#if 0
            vstring_strcpy(reply.nexthop, STR(reply.recipient));
+           lowercase(STR(reply.nexthop));
+#if 0
            (void) split_at_right(STR(reply.nexthop), '@');
 #endif
 #if 0
index ba1c0658e2b0c28aa954339e79079b033dfca1f3..135917b83add4bc3caaaa678c2036bf8c9552230 100644 (file)
 #include "sys_defs.h"
 
 #ifdef HAS_MYSQL
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -77,6 +81,8 @@
 #include "dict_mysql.h"
 #include "argv.h"
 #include "vstring.h"
+#include "split_at.h"
+#include "find_inet.h"
 
 /* external declarations */
 extern int dict_errno;
@@ -230,9 +236,7 @@ static MYSQL_RES *plmysql_query(PLMYSQL *PLDB,
        /* answer already found */
        if (res != 0 && host->stat == STATACTIVE) {
            msg_info("dict_mysql: closing unnessary connection to %s", host->hostname);
-           mysql_close(&(host->db));           /* also frees memory, have to
-                                                * reallocate it */
-           host->db = *((MYSQL *) mymalloc(sizeof(MYSQL)));
+           mysql_close(&(host->db));
            plmysql_down_host(host);
        }
        /* try to connect for the first time if we don't have a result yet */
@@ -279,18 +283,36 @@ static MYSQL_RES *plmysql_query(PLMYSQL *PLDB,
  */
 static void plmysql_connect_single(HOST *host, char *dbname, char *username, char *password)
 {
-    if (mysql_connect(&(host->db), host->hostname, username, password)) {
-       if (mysql_select_db(&(host->db), dbname) == 0) {
-           msg_info("dict_mysql: successful connection to host %s", host->hostname);
-           host->stat = STATACTIVE;
-       } else {
-           plmysql_down_host(host);
-           msg_warn("%s", mysql_error(&(host->db)));
-       }
+    char   *destination = host->hostname;
+    char   *unix_socket = 0;
+    char   *hostname = 0;
+    char   *service;
+    unsigned port = 0;
+
+    /*
+     * Ad-hoc parsing code. Expect "unix:pathname" or "inet:host:port", where
+     * both "inet:" and ":port" are optional.
+     */
+    if (strncmp(destination, "unix:", 5) == 0) {
+       unix_socket = destination + 5;
+    } else {
+       if (strncmp(destination, "inet:", 5) == 0)
+           destination += 5;
+       hostname = mystrdup(destination);
+       if ((service = split_at(hostname, ':')) != 0)
+           port = ntohs(find_inet_port(service, "tcp"));
+    }
+
+    host->db = *((MYSQL *) mysql_init(NULL));
+    if (mysql_real_connect(&(host->db), hostname, username, password, dbname, port, unix_socket, 0)) {
+       msg_info("dict_mysql: successful connection to host %s", host->hostname);
+       host->stat = STATACTIVE;
     } else {
        plmysql_down_host(host);
        msg_warn("%s", mysql_error(&(host->db)));
     }
+    if (hostname)
+       myfree(hostname);
 }
 
 /*
index 52e9cf7692daa50ec26da8a29c463d1a873e4366..0ed7a7558517df71eafccc0b4dcf791a984b1d2f 100644 (file)
@@ -139,9 +139,9 @@ int     main(int argc, char **argv)
     VSTRING *buf = vstring_alloc(1);
 
     while (--argc && *++argv) {
-       mask = name_mask(table, *argv);
+       mask = name_mask("test", table, *argv);
        vstream_printf("%s -> 0x%x -> %s\n",
-                      *argv, mask, str_name_mask(buf, table, mask));
+                      *argv, mask, str_name_mask("mask_test", table, mask));
        vstream_fflush(VSTREAM_OUT);
     }
     vstring_free(buf);
index 4183a1b8cb9dbbcbfadb2de776d7bb39baff68eb..f582cc1f09c20915190cb985330cf370c55595bd 100644 (file)
@@ -87,7 +87,7 @@
 /* safe_open_exist - open existing file */
 
 static VSTREAM *safe_open_exist(const char *path, int flags,
-                                       struct stat * fstat_st, VSTRING *why)
+                                     struct stat * fstat_st, VSTRING * why)
 {
     struct stat local_statbuf;
     struct stat lstat_st;
@@ -97,7 +97,7 @@ static VSTREAM *safe_open_exist(const char *path, int flags,
      * Open an existing file.
      */
     if ((fp = vstream_fopen(path, flags & ~(O_CREAT | O_EXCL), 0)) == 0) {
-       vstring_sprintf(why, "cannot open existing file: %m");
+       vstring_sprintf(why, "cannot open file: %m");
        return (0);
     }
 
@@ -110,8 +110,9 @@ static VSTREAM *safe_open_exist(const char *path, int flags,
        fstat_st = &local_statbuf;
     if (fstat(vstream_fileno(fp), fstat_st) < 0) {
        msg_fatal("%s: bad open file status: %m", path);
-    } else if (fstat_st->st_nlink > 1) {
-       vstring_sprintf(why, "file has multiple hard links");
+    } else if (fstat_st->st_nlink != 1) {
+       vstring_sprintf(why, "file has %d hard links",
+                       (int) fstat_st->st_nlink);
     } else if (S_ISDIR(fstat_st->st_mode)) {
        vstring_sprintf(why, "file is a directory");
     }
@@ -158,7 +159,7 @@ static VSTREAM *safe_open_exist(const char *path, int flags,
 /* safe_open_create - create new file */
 
 static VSTREAM *safe_open_create(const char *path, int flags, int mode,
-                   struct stat * st, uid_t user, uid_t group, VSTRING *why)
+                  struct stat * st, uid_t user, uid_t group, VSTRING * why)
 {
     VSTREAM *fp;
 
@@ -206,7 +207,7 @@ static VSTREAM *safe_open_create(const char *path, int flags, int mode,
 /* safe_open - safely open or create file */
 
 VSTREAM *safe_open(const char *path, int flags, int mode,
-                   struct stat * st, uid_t user, gid_t group, VSTRING *why)
+                  struct stat * st, uid_t user, gid_t group, VSTRING * why)
 {
     VSTREAM *fp;
 
index cf315c46b38ed94ed245a7d6ef7df92cb8f79d64..f7c118624c5e3c12056184f3806f940a3f03cc34 100644 (file)
@@ -437,7 +437,7 @@ extern int initgroups(const char *, int);
 #define HAS_DBM
 #define HAS_FCNTL_LOCK
 #define INTERNAL_LOCK  MYFLOCK_STYLE_FCNTL
-#define DEF_MAILBOX_LOCK "fcntl, dotlock"
+#define DEF_MAILBOX_LOCK "fcntl"
 #define HAS_FSYNC
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
@@ -467,7 +467,7 @@ extern int h_errno;                 /* <netdb.h> imports too much stuff */
 #define HAS_DBM
 #define HAS_FCNTL_LOCK
 #define INTERNAL_LOCK  MYFLOCK_STYLE_FCNTL
-#define DEF_MAILBOX_LOCK "fcntl, dotlock"
+#define DEF_MAILBOX_LOCK "fcntl"
 #define HAS_FSYNC
 #define DEF_DB_TYPE    "dbm"
 #define ALIAS_DB_MAP   "dbm:/etc/mail/aliases"
@@ -497,7 +497,7 @@ extern int h_errno;                 /* <netdb.h> imports too much stuff */
 #define HAS_DBM
 #define HAS_FCNTL_LOCK
 #define INTERNAL_LOCK  MYFLOCK_STYLE_FCNTL
-#define DEF_MAILBOX_LOCK "fcntl, dotlock"
+#define DEF_MAILBOX_LOCK "fcntl"
 #define HAS_FSYNC
 #define HAS_NIS
 #define MISSING_SETENV
@@ -531,7 +531,7 @@ extern int h_errno;
 #define HAS_DBM
 #define HAS_FLOCK_LOCK
 #define INTERNAL_LOCK  MYFLOCK_STYLE_FLOCK
-#define DEF_MAILBOX_LOCK "flock, dotlock"
+#define DEF_MAILBOX_LOCK "flock"
 #define USE_STATFS
 #define HAVE_SYS_DIR_H
 #define STATFS_IN_SYS_VFS_H
@@ -581,7 +581,7 @@ extern int opterr;
 #define HAS_DBM
 #define HAS_FLOCK_LOCK
 #define INTERNAL_LOCK  MYFLOCK_STYLE_FLOCK
-#define DEF_MAILBOX_LOCK "flock, dotlock"
+#define DEF_MAILBOX_LOCK "flock"
 #define USE_STATFS
 #define HAVE_SYS_DIR_H
 #define STATFS_IN_SYS_VFS_H
index dad7b306219fc5813754bad9aa5d4fd7fe1a4a9e..b31a76bf8229281b61703d83030f8f15ac3be4f4 100644 (file)
@@ -319,13 +319,15 @@ int     main(int argc, char **argv)
     /*
      * Sanity check.
      */
-    if (argc != 2)
+    if (argc < 2)
        msg_fatal("usage: %s 'command'", argv[0]);
 
     /*
      * Open stream to child process.
      */
-    if ((stream = vstream_popen(argv[1], O_RDWR)) == 0)
+    if ((stream = vstream_popen(O_RDWR,
+                               VSTREAM_POPEN_ARGV, argv + 1,
+                               VSTREAM_POPEN_END)) == 0)
        msg_fatal("vstream_popen: %m");
 
     /*