2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-09-03 23:55:18 +00:00

snapshot-20001210

This commit is contained in:
Wietse Venema
2000-12-10 00:00:00 -05:00
committed by Viktor Dukhovni
parent f76aed6caf
commit 5ad8f0f553
24 changed files with 270 additions and 96 deletions

View File

@@ -4528,16 +4528,24 @@ Apologies for any names omitted.
Feature: mailbox locking is now configurable. The configuration Feature: mailbox locking is now configurable. The configuration
parameter name is "mailbox_delivery_lock". Depending on parameter name is "mailbox_delivery_lock". Depending on
the operating system one can specify one or more of "flock", the operating system one can specify one or more of "flock",
"fcntl" and "dotlock". The default setting is system "fcntl" and "dotlock". Use "postconf -l" to find out what
dependent. All mailbox file opens are now done by the locking methods Postfix supports. The default setting is
mbox_open() routine. This affects the operation of the system dependent. All mailbox file opens are now done by
postlock command, and of local delivery to mailbox or one central mbox_open() routine. This affects the operation
/file/name. Files: util/safe_open.c, util/myflock.c, 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. global/deliver_flock.c, global/mbox_conf.c, global/mbox_open.c.
local/mailbox.c, local/file.c, postlock/postlock.c. The local/mailbox.c, local/file.c, postlock/postlock.c.
old sun_mailtool_compatibility parameter is being phased
out (it just turns off flock/fcntl locks). It still works, Compatibility: the old sun_mailtool_compatibility parameter
but a warning is logged as a reminder that it goes away. 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 20001202
@@ -4545,11 +4553,10 @@ Apologies for any names omitted.
ESMTP. Someone asked for this long ago. Files: smtp/smtp.c, ESMTP. Someone asked for this long ago. Files: smtp/smtp.c,
smtp/smtp_proto.c. smtp/smtp_proto.c.
Feature? Bugfix? The smtp client will now ignore server Feature? Bugfix? The smtp client now skips server replies
replies that do not start with "CODE SPACE" or with "CODE that do not start with "CODE SPACE" or with "CODE HYPHEN",
HYPHEN". Which means that "CODE TEXT" is now treated as and flags them as protocol errors. Older versions silently
"CODE HYPHEN TEXT", instead of being treated as "CODE SPACE treat "CODE TEXT" as "CODE SPACE TEXT". File: smtp/smtp_chat.c.
TEXT", the way it was before. File: smtp/smtp_chat.c.
20001203 20001203
@@ -4558,14 +4565,14 @@ Apologies for any names omitted.
20001204 20001204
Bugfix: master no longer imported MAIL_CONF and other Bugfix: the Postfix master daemon no longer imported
necessary environmental parameters. Postfix now has MAIL_CONF and some other necessary environment parameters.
explicit "import_environment" and "export_environment" Postfix now has explicit "import_environment" and
configuration parameters that control what environment "export_environment" configuration parameters that control
parameters are imported from or exported to the external what environment parameters are shared with non-Postfix
environment. Files: util/clean_env.c, util/spawn_command.c, processes. Files: util/clean_env.c, util/spawn_command.c,
util/vstream_popen.c, global/pipe_command.c, and everything util/vstream_popen.c, global/pipe_command.c, and everything
that uses this code. that invokes this code.
20001208 20001208
@@ -4586,9 +4593,18 @@ Apologies for any names omitted.
example, "mailbox_transport = lmtp:unix:/file/name". File: example, "mailbox_transport = lmtp:unix:/file/name". File:
global/deliver_pass.c. global/deliver_pass.c.
Bugfix: local_destination_concurrency_limit no longer works 20001210
as per-user concurrency limit but as per-domain limit, so
the limit of "2" in the sample main.cf files would result Bugfix: the local_destination_concurrency_limit paramater
in poor local delivery performance. The Postfix install no longer worked as per-user concurrency limit but instead
procedure repairs this. Problem reported by David Schweikert worked as per-domain limit, so that the limit of "2" in
(ee.ethz.ch) and Dallas Wisehaupt (cynicism.com). 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.

View File

@@ -285,7 +285,6 @@ bin/postconf -c $CONFIG_DIRECTORY -e \
"command_directory = $command_directory" \ "command_directory = $command_directory" \
"queue_directory = $queue_directory" \ "queue_directory = $queue_directory" \
"mail_owner = $mail_owner" \ "mail_owner = $mail_owner" \
"local_destination_concurrency_limit = 0" \
|| exit 1 || exit 1
(echo "# This file was generated by $0" (echo "# This file was generated by $0"

View File

@@ -60,7 +60,8 @@ additional_conditions = and status = 'paid'
# #
# the hosts that postfix will try to connect to # the hosts that postfix will try to connect to
# and query from (in the order listed) # 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 # end mysql config file

View 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 If this release does not work for you, you can go back to a previous
that turns off kernel locks on mailbox files). It still works, but Postfix version without losing your mail, subject to the "incompatible
a warning is logged. Instead, specify the mailbox locking strategy changes" listed for previous Postfix releases below.
via the new "mailbox_delivery_lock" parameter.
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
==================================== ====================================
The mailbox locking style is now fully configurable at runtime. This snapshot includes bugfixes that were already released as
The new configuration parameter is "mailbox_delivery_lock". patches 12 and 13 for the 19991231 "stable" release:
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 - The queue manager could deadlock for 10 seconds when bouncing
parameters now control what environment variables Postfix will mail under extreme load from one-to-one mass mailings.
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 - Local delivery performance was substandard, because the per-user
everything, and different sites may have different needs. concurrency limit accidentally applied to the entire local
domain.
The mailbox locking style is now fully configurable at runtime.
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". 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 Incompatible changes with snapshot-20001121
=========================================== ===========================================

View File

@@ -5,6 +5,17 @@
# that begin with whitespace continue the previous line. A value can # that begin with whitespace continue the previous line. A value can
# contain references to other $names or ${name}s. # 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 # LOCAL PATHNAME INFORMATION
# #
# The queue_directory specifies the location of the Postfix queue. # 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 # Each message delivery transport has its XXX_destination_concurrency_limit
# parameter. The default is $default_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 default_destination_concurrency_limit = 10
# DEBUGGING CONTROL # DEBUGGING CONTROL

View File

@@ -18,6 +18,14 @@
# biff = no # biff = no
biff = yes 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 # OVERRIDE LOCAL TRANSPORT
# #
@@ -177,15 +185,14 @@ fallback_transport =
# #
# The local_destination_concurrency_limit parameter limits the number # The local_destination_concurrency_limit parameter limits the number
# of parallel deliveries to the local domain. It should therefore be # of parallel deliveries to the same local recipient.
# 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.
# #
# The default limit is taken from the default_destination_concurrency_limit # 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 # The local_destination_recipient_limit parameter limits the number
# of recipients per local message delivery. The default limit is # of recipients per local message delivery. The default limit is

View File

@@ -260,6 +260,25 @@ queue_directory = /var/spool/postfix
# recipient_delimiter = + # recipient_delimiter = +
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 # The relayhost parameter specifies the default host to send mail to
# when no entry is matched in the optional transport(5) table. When # when no entry is matched in the optional transport(5) table. When
# no relayhost is given, mail is routed directly to the destination. # no relayhost is given, mail is routed directly to the destination.
@@ -293,15 +312,6 @@ relayhost =
# relocated_maps = hash:/etc/postfix/relocated # relocated_maps = hash:/etc/postfix/relocated
relocated_maps = 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 # The syslog_facility parameter controls where Postfix logging is
# sent by the syslog daemon. Specify a logging facility as defined # sent by the syslog daemon. Specify a logging facility as defined
# in syslog.conf(5). The default logging facility is "mail". # in syslog.conf(5). The default logging facility is "mail".

View File

@@ -38,6 +38,24 @@ fallback_relay =
# #
ignore_mx_lookup_error = no 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 # The smtp_bind_address parameter specifies a numerical network
# address that the client should bind to when making a connection. # 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, # This can be used in the main.cf file, or in the master.cf file,

View File

@@ -243,6 +243,17 @@ depend: $(MAKES)
@$(EXPORT) make -f Makefile.in Makefile 1>&2 @$(EXPORT) make -f Makefile.in Makefile 1>&2
# do not edit below this line - it is generated by 'make depend' # 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: been_here.c
been_here.o: ../../include/sys_defs.h been_here.o: ../../include/sys_defs.h
been_here.o: ../../include/msg.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/vstring.h
deliver_pass.o: ../../include/vbuf.h deliver_pass.o: ../../include/vbuf.h
deliver_pass.o: ../../include/vstream.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_pass.h
deliver_pass.o: deliver_request.h deliver_pass.o: deliver_request.h
deliver_pass.o: recipient_list.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: mynetworks.h
mail_params.o: mail_conf.h mail_params.o: mail_conf.h
mail_params.o: mail_version.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_params.o: mail_params.h
mail_pathname.o: mail_pathname.c mail_pathname.o: mail_pathname.c
mail_pathname.o: ../../include/sys_defs.h 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/vbuf.h
mail_stream.o: ../../include/vstream.h mail_stream.o: ../../include/vstream.h
mail_stream.o: ../../include/stringops.h mail_stream.o: ../../include/stringops.h
mail_stream.o: ../../include/argv.h
mail_stream.o: cleanup_user.h mail_stream.o: cleanup_user.h
mail_stream.o: mail_proto.h mail_stream.o: mail_proto.h
mail_stream.o: ../../include/iostuff.h mail_stream.o: ../../include/iostuff.h
mail_stream.o: mail_queue.h mail_stream.o: mail_queue.h
mail_stream.o: opened.h mail_stream.o: opened.h
mail_stream.o: mail_params.h
mail_stream.o: mail_stream.h mail_stream.o: mail_stream.h
mail_task.o: mail_task.c mail_task.o: mail_task.c
mail_task.o: ../../include/sys_defs.h mail_task.o: ../../include/sys_defs.h

View File

@@ -15,7 +15,7 @@
* Version of this program. * Version of this program.
*/ */
#define VAR_MAIL_VERSION "mail_version" #define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-20001209" #define DEF_MAIL_VERSION "Snapshot-20001210"
extern char *var_mail_version; extern char *var_mail_version;
/* LICENSE /* LICENSE

View File

@@ -102,7 +102,7 @@ MBOX *mbox_open(const char *path, int flags, int mode, struct stat * st,
*/ */
if (st == 0) if (st == 0)
st = &local_statbuf; 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) { chown_uid, chown_gid, why)) == 0) {
return (0); return (0);
} }

View File

@@ -92,6 +92,7 @@ master.o: ../../include/stringops.h
master.o: ../../include/myflock.h master.o: ../../include/myflock.h
master.o: ../../include/watchdog.h master.o: ../../include/watchdog.h
master.o: ../../include/clean_env.h master.o: ../../include/clean_env.h
master.o: ../../include/argv.h
master.o: ../../include/mail_params.h master.o: ../../include/mail_params.h
master.o: ../../include/debug_process.h master.o: ../../include/debug_process.h
master.o: ../../include/mail_task.h master.o: ../../include/mail_task.h

View File

@@ -94,6 +94,7 @@ qmgr_active.o: ../../include/vstring.h
qmgr_active.o: ../../include/recipient_list.h qmgr_active.o: ../../include/recipient_list.h
qmgr_active.o: ../../include/bounce.h qmgr_active.o: ../../include/bounce.h
qmgr_active.o: ../../include/defer.h qmgr_active.o: ../../include/defer.h
qmgr_active.o: ../../include/abounce.h
qmgr_active.o: ../../include/rec_type.h qmgr_active.o: ../../include/rec_type.h
qmgr_active.o: qmgr.h qmgr_active.o: qmgr.h
qmgr_active.o: ../../include/scan_dir.h qmgr_active.o: ../../include/scan_dir.h

View File

@@ -50,6 +50,7 @@
#include <sys_defs.h> #include <sys_defs.h>
#include <time.h> #include <time.h>
#include <string.h>
/* Utility library. */ /* 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_LIST list = entry->rcpt_list;
QMGR_RCPT *recipient; QMGR_RCPT *recipient;
QMGR_MESSAGE *message = entry->message; 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", 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->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT,
message->queue_name, message->queue_id, message->queue_name, message->queue_id,
message->data_offset, message->data_size, message->data_offset, message->data_size,
(cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ? cp + 1 :
entry->queue->name, message->sender, entry->queue->name, message->sender,
message->errors_to, message->return_receipt, message->errors_to, message->return_receipt,
message->arrival_time); message->arrival_time);

View File

@@ -678,8 +678,9 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
*/ */
if ((at = strrchr(STR(reply.recipient), '@')) == 0 if ((at = strrchr(STR(reply.recipient), '@')) == 0
|| resolve_local(at + 1)) { || resolve_local(at + 1)) {
#if 0
vstring_strcpy(reply.nexthop, STR(reply.recipient)); vstring_strcpy(reply.nexthop, STR(reply.recipient));
lowercase(STR(reply.nexthop));
#if 0
(void) split_at_right(STR(reply.nexthop), '@'); (void) split_at_right(STR(reply.nexthop), '@');
#endif #endif
#if 0 #if 0

View File

@@ -62,6 +62,7 @@ postdrop.o: ../../include/vbuf.h
postdrop.o: ../../include/vstring.h postdrop.o: ../../include/vstring.h
postdrop.o: ../../include/msg_vstream.h postdrop.o: ../../include/msg_vstream.h
postdrop.o: ../../include/msg_syslog.h postdrop.o: ../../include/msg_syslog.h
postdrop.o: ../../include/argv.h
postdrop.o: ../../include/mail_proto.h postdrop.o: ../../include/mail_proto.h
postdrop.o: ../../include/iostuff.h postdrop.o: ../../include/iostuff.h
postdrop.o: ../../include/mail_queue.h postdrop.o: ../../include/mail_queue.h

View File

@@ -92,6 +92,7 @@ qmgr_active.o: ../../include/vstring.h
qmgr_active.o: ../../include/recipient_list.h qmgr_active.o: ../../include/recipient_list.h
qmgr_active.o: ../../include/bounce.h qmgr_active.o: ../../include/bounce.h
qmgr_active.o: ../../include/defer.h qmgr_active.o: ../../include/defer.h
qmgr_active.o: ../../include/abounce.h
qmgr_active.o: ../../include/rec_type.h qmgr_active.o: ../../include/rec_type.h
qmgr_active.o: qmgr.h qmgr_active.o: qmgr.h
qmgr_active.o: ../../include/scan_dir.h qmgr_active.o: ../../include/scan_dir.h

View File

@@ -45,6 +45,7 @@
#include <sys_defs.h> #include <sys_defs.h>
#include <time.h> #include <time.h>
#include <string.h>
/* Utility library. */ /* 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_LIST list = entry->rcpt_list;
QMGR_RCPT *recipient; QMGR_RCPT *recipient;
QMGR_MESSAGE *message = entry->message; 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", 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->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT,
message->queue_name, message->queue_id, message->queue_name, message->queue_id,
message->data_offset, message->data_size, message->data_offset, message->data_size,
(cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ? cp + 1 :
entry->queue->name, message->sender, entry->queue->name, message->sender,
message->errors_to, message->return_receipt, message->errors_to, message->return_receipt,
message->arrival_time); message->arrival_time);

View File

@@ -556,8 +556,9 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
*/ */
if ((at = strrchr(STR(reply.recipient), '@')) == 0 if ((at = strrchr(STR(reply.recipient), '@')) == 0
|| resolve_local(at + 1)) { || resolve_local(at + 1)) {
#if 0
vstring_strcpy(reply.nexthop, STR(reply.recipient)); vstring_strcpy(reply.nexthop, STR(reply.recipient));
lowercase(STR(reply.nexthop));
#if 0
(void) split_at_right(STR(reply.nexthop), '@'); (void) split_at_right(STR(reply.nexthop), '@');
#endif #endif
#if 0 #if 0

View File

@@ -64,6 +64,10 @@
#include "sys_defs.h" #include "sys_defs.h"
#ifdef HAS_MYSQL #ifdef HAS_MYSQL
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@@ -77,6 +81,8 @@
#include "dict_mysql.h" #include "dict_mysql.h"
#include "argv.h" #include "argv.h"
#include "vstring.h" #include "vstring.h"
#include "split_at.h"
#include "find_inet.h"
/* external declarations */ /* external declarations */
extern int dict_errno; extern int dict_errno;
@@ -230,9 +236,7 @@ static MYSQL_RES *plmysql_query(PLMYSQL *PLDB,
/* answer already found */ /* answer already found */
if (res != 0 && host->stat == STATACTIVE) { if (res != 0 && host->stat == STATACTIVE) {
msg_info("dict_mysql: closing unnessary connection to %s", host->hostname); msg_info("dict_mysql: closing unnessary connection to %s", host->hostname);
mysql_close(&(host->db)); /* also frees memory, have to mysql_close(&(host->db));
* reallocate it */
host->db = *((MYSQL *) mymalloc(sizeof(MYSQL)));
plmysql_down_host(host); plmysql_down_host(host);
} }
/* try to connect for the first time if we don't have a result yet */ /* 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) static void plmysql_connect_single(HOST *host, char *dbname, char *username, char *password)
{ {
if (mysql_connect(&(host->db), host->hostname, username, password)) { char *destination = host->hostname;
if (mysql_select_db(&(host->db), dbname) == 0) { char *unix_socket = 0;
msg_info("dict_mysql: successful connection to host %s", host->hostname); char *hostname = 0;
host->stat = STATACTIVE; char *service;
} else { unsigned port = 0;
plmysql_down_host(host);
msg_warn("%s", mysql_error(&(host->db))); /*
} * 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 { } else {
plmysql_down_host(host); plmysql_down_host(host);
msg_warn("%s", mysql_error(&(host->db))); msg_warn("%s", mysql_error(&(host->db)));
} }
if (hostname)
myfree(hostname);
} }
/* /*

View File

@@ -139,9 +139,9 @@ int main(int argc, char **argv)
VSTRING *buf = vstring_alloc(1); VSTRING *buf = vstring_alloc(1);
while (--argc && *++argv) { while (--argc && *++argv) {
mask = name_mask(table, *argv); mask = name_mask("test", table, *argv);
vstream_printf("%s -> 0x%x -> %s\n", 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); vstream_fflush(VSTREAM_OUT);
} }
vstring_free(buf); vstring_free(buf);

View File

@@ -87,7 +87,7 @@
/* safe_open_exist - open existing file */ /* safe_open_exist - open existing file */
static VSTREAM *safe_open_exist(const char *path, int flags, 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 local_statbuf;
struct stat lstat_st; struct stat lstat_st;
@@ -97,7 +97,7 @@ static VSTREAM *safe_open_exist(const char *path, int flags,
* Open an existing file. * Open an existing file.
*/ */
if ((fp = vstream_fopen(path, flags & ~(O_CREAT | O_EXCL), 0)) == 0) { 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); return (0);
} }
@@ -110,8 +110,9 @@ static VSTREAM *safe_open_exist(const char *path, int flags,
fstat_st = &local_statbuf; fstat_st = &local_statbuf;
if (fstat(vstream_fileno(fp), fstat_st) < 0) { if (fstat(vstream_fileno(fp), fstat_st) < 0) {
msg_fatal("%s: bad open file status: %m", path); msg_fatal("%s: bad open file status: %m", path);
} else if (fstat_st->st_nlink > 1) { } else if (fstat_st->st_nlink != 1) {
vstring_sprintf(why, "file has multiple hard links"); vstring_sprintf(why, "file has %d hard links",
(int) fstat_st->st_nlink);
} else if (S_ISDIR(fstat_st->st_mode)) { } else if (S_ISDIR(fstat_st->st_mode)) {
vstring_sprintf(why, "file is a directory"); 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 */ /* safe_open_create - create new file */
static VSTREAM *safe_open_create(const char *path, int flags, int mode, 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; 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 */ /* safe_open - safely open or create file */
VSTREAM *safe_open(const char *path, int flags, int mode, 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; VSTREAM *fp;

View File

@@ -437,7 +437,7 @@ extern int initgroups(const char *, int);
#define HAS_DBM #define HAS_DBM
#define HAS_FCNTL_LOCK #define HAS_FCNTL_LOCK
#define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock" #define DEF_MAILBOX_LOCK "fcntl"
#define HAS_FSYNC #define HAS_FSYNC
#define DEF_DB_TYPE "dbm" #define DEF_DB_TYPE "dbm"
#define ALIAS_DB_MAP "dbm:/etc/mail/aliases" #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_DBM
#define HAS_FCNTL_LOCK #define HAS_FCNTL_LOCK
#define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock" #define DEF_MAILBOX_LOCK "fcntl"
#define HAS_FSYNC #define HAS_FSYNC
#define DEF_DB_TYPE "dbm" #define DEF_DB_TYPE "dbm"
#define ALIAS_DB_MAP "dbm:/etc/mail/aliases" #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_DBM
#define HAS_FCNTL_LOCK #define HAS_FCNTL_LOCK
#define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock" #define DEF_MAILBOX_LOCK "fcntl"
#define HAS_FSYNC #define HAS_FSYNC
#define HAS_NIS #define HAS_NIS
#define MISSING_SETENV #define MISSING_SETENV
@@ -531,7 +531,7 @@ extern int h_errno;
#define HAS_DBM #define HAS_DBM
#define HAS_FLOCK_LOCK #define HAS_FLOCK_LOCK
#define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock" #define DEF_MAILBOX_LOCK "flock"
#define USE_STATFS #define USE_STATFS
#define HAVE_SYS_DIR_H #define HAVE_SYS_DIR_H
#define STATFS_IN_SYS_VFS_H #define STATFS_IN_SYS_VFS_H
@@ -581,7 +581,7 @@ extern int opterr;
#define HAS_DBM #define HAS_DBM
#define HAS_FLOCK_LOCK #define HAS_FLOCK_LOCK
#define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock" #define DEF_MAILBOX_LOCK "flock"
#define USE_STATFS #define USE_STATFS
#define HAVE_SYS_DIR_H #define HAVE_SYS_DIR_H
#define STATFS_IN_SYS_VFS_H #define STATFS_IN_SYS_VFS_H

View File

@@ -319,13 +319,15 @@ int main(int argc, char **argv)
/* /*
* Sanity check. * Sanity check.
*/ */
if (argc != 2) if (argc < 2)
msg_fatal("usage: %s 'command'", argv[0]); msg_fatal("usage: %s 'command'", argv[0]);
/* /*
* Open stream to child process. * 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"); msg_fatal("vstream_popen: %m");
/* /*