From 7e8044da83b0c5c0cd0070fe60ee90c540f9fbb7 Mon Sep 17 00:00:00 2001
From: Wietse Venema
Date: Sat, 7 Jul 2001 00:00:00 -0500
Subject: [PATCH] snapshot-20010707
---
postfix/.indent.pro | 3 +-
postfix/HISTORY | 48 +++
postfix/Makefile.in | 2 +-
postfix/README_QMQP | 39 ++
postfix/RELEASE_NOTES | 25 ++
postfix/conf/master.cf | 1 +
postfix/conf/postfix-script-diff | 10 +-
postfix/conf/postfix-script-sgid | 2 +-
postfix/conf/sample-qmqpd.cf | 40 ++
postfix/conf/sample-smtp.cf | 8 +
postfix/html/Makefile.in | 5 +-
postfix/html/faq.html | 58 ++-
postfix/html/lmtp.8.html | 2 +-
postfix/html/pipe.8.html | 2 +-
postfix/html/qmqpd.8.html | 122 ++++++
postfix/html/smtp.8.html | 5 +
postfix/man/Makefile.in | 5 +-
postfix/man/man8/lmtp.8 | 2 +-
postfix/man/man8/pipe.8 | 4 +-
postfix/man/man8/qmqpd.8 | 120 ++++++
postfix/man/man8/smtp.8 | 3 +
postfix/mantools/postlink | 1 +
postfix/src/global/Makefile.in | 2 +-
postfix/src/global/mail_params.h | 19 +
postfix/src/global/mail_queue.c | 2 +-
postfix/src/global/mail_version.h | 2 +-
postfix/src/global/qmqp_proto.h | 27 ++
postfix/src/lmtp/lmtp.c | 2 +-
postfix/src/lmtp/lmtp_proto.c | 2 +-
postfix/src/local/mailbox.c | 7 +-
postfix/src/pipe/pipe.c | 4 +-
postfix/src/qmqpd/.indent.pro | 1 +
postfix/src/qmqpd/.printfck | 25 ++
postfix/src/qmqpd/Makefile.in | 113 +++++
postfix/src/qmqpd/qmqpd.c | 645 ++++++++++++++++++++++++++++
postfix/src/qmqpd/qmqpd.h | 78 ++++
postfix/src/qmqpd/qmqpd_peer.c | 183 ++++++++
postfix/src/qmqpd/qmqpd_state.c | 96 +++++
postfix/src/smtp/smtp.c | 5 +
postfix/src/smtp/smtp_addr.c | 26 +-
postfix/src/smtp/smtp_connect.c | 2 +-
postfix/src/smtp/smtp_proto.c | 4 +-
postfix/src/smtp/smtp_sasl_glue.c | 4 +-
postfix/src/smtpd/smtpd.c | 2 +
postfix/src/smtpd/smtpd_check.c | 44 +-
postfix/src/smtpd/smtpd_peer.c | 1 -
postfix/src/smtpd/smtpd_sasl_glue.c | 4 +-
postfix/src/smtpstone/Makefile.in | 50 ++-
postfix/src/smtpstone/qmqp-sink.c | 287 +++++++++++++
postfix/src/smtpstone/qmqp-source.c | 592 +++++++++++++++++++++++++
postfix/src/smtpstone/smtp-source.c | 13 +-
postfix/src/util/Makefile.in | 15 +-
postfix/src/util/dict_mysql.c | 9 +-
postfix/src/util/mymalloc.c | 6 +-
postfix/src/util/netstring.c | 350 +++++++++++++++
postfix/src/util/netstring.h | 54 +++
postfix/src/util/vstream.c | 4 +-
postfix/src/util/vstring.c | 41 ++
postfix/src/util/vstring.h | 2 +
59 files changed, 3162 insertions(+), 68 deletions(-)
create mode 100644 postfix/README_QMQP
mode change 100755 => 100644 postfix/conf/postfix-script-sgid
create mode 100644 postfix/conf/sample-qmqpd.cf
create mode 100644 postfix/html/qmqpd.8.html
create mode 100644 postfix/man/man8/qmqpd.8
create mode 100644 postfix/src/global/qmqp_proto.h
create mode 120000 postfix/src/qmqpd/.indent.pro
create mode 100644 postfix/src/qmqpd/.printfck
create mode 100644 postfix/src/qmqpd/Makefile.in
create mode 100644 postfix/src/qmqpd/qmqpd.c
create mode 100644 postfix/src/qmqpd/qmqpd.h
create mode 100644 postfix/src/qmqpd/qmqpd_peer.c
create mode 100644 postfix/src/qmqpd/qmqpd_state.c
create mode 100644 postfix/src/smtpstone/qmqp-sink.c
create mode 100644 postfix/src/smtpstone/qmqp-source.c
create mode 100644 postfix/src/util/netstring.c
create mode 100644 postfix/src/util/netstring.h
diff --git a/postfix/.indent.pro b/postfix/.indent.pro
index c35b4962f..3dcb109b1 100644
--- a/postfix/.indent.pro
+++ b/postfix/.indent.pro
@@ -24,10 +24,10 @@
-TDICT
-TDICT_DB
-TDICT_DBM
+-TDICT_DEBUG
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
--TDICT_DEBUG
-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
@@ -93,6 +93,7 @@
-TQMGR_RECIPIENT
-TQMGR_SCAN
-TQMGR_TRANSPORT
+-TQMQPD_STATE
-TRECIPIENT
-TRECIPIENT_LIST
-TREC_TYPE_NAME
diff --git a/postfix/HISTORY b/postfix/HISTORY
index fe46e52a6..17a0dfc47 100644
--- a/postfix/HISTORY
+++ b/postfix/HISTORY
@@ -5261,3 +5261,51 @@ Apologies for any names omitted.
Feature: address quoting and case folding flags for the
pipe(8) mailer.
+
+20010611
+
+ Workaround: some MTAs fall on their face when they receive
+ unexpectedly long lines. From now on, Postfix defaults to
+ breaking long lines at 2048 (like Sendmail so it has got to
+ be right). To get the old, content preserving, behavior
+ specify "smtp_truncate_lines = no". File: smtp/smtp_proto.c.
+
+20010614
+
+ Bugfix: did not really undo 2821 552->452 mapping.
+
+20010628
+
+ Bugfix: postfix-script used a hard-coded maildrop group
+ owner instead of using the install-time specified name
+ stored in /etc/postfix/install.cf. Problem reported by
+ David Terrell @ meat.net.
+
+20010701
+
+ Feature: mail_spool_directory ending in / causes maildir
+ style delivery.
+
+ Bugfix: the FreeBSD kernel parameters kern.ipc.nmbclusters
+ and kern.ipc.maxsockets cannot be set with sysctl commands.
+ File: html/faq.html. Len Conrad @ Go2France.com.
+
+ Cleanup: the virtual delivery agent was poorly integrated
+ so that the SMTP server and queue manager did not reject
+ mail for unknown users. Files: smtpd/smtpd_check.c,
+ *qmgr/qmgr_message.c.
+
+20010705
+
+ Feature: QMQP server for compatibility with the ezmlm list
+ manager. Files: util/netstring.[hc], qmqpd/qmqpd*.c.
+
+20010706
+
+ Feature: QMQP stress test message generator program. Files:
+ smtpstone/qmqp-source.c, smtpstone/qmqp-sink.c.
+
+20010708
+
+ Bugfix: with disable_dns=yes, the SMTP client treated all
+ host lookup errors as permanent. File: smtp/smtp_addr.c.
diff --git a/postfix/Makefile.in b/postfix/Makefile.in
index 7046d4050..62d3af31d 100644
--- a/postfix/Makefile.in
+++ b/postfix/Makefile.in
@@ -6,7 +6,7 @@ DIRS = src/util src/global src/dns src/master src/postfix src/smtpstone \
src/lmtp src/trivial-rewrite src/qmgr src/smtp src/bounce src/pipe \
src/showq src/postalias src/postcat src/postconf src/postdrop \
src/postkick src/postlock src/postlog src/postmap src/postsuper \
- src/nqmgr src/spawn src/flush src/virtual # proto man html
+ src/nqmgr src/qmqpd src/spawn src/flush src/virtual # proto man html
default: update
diff --git a/postfix/README_QMQP b/postfix/README_QMQP
new file mode 100644
index 000000000..666f79e41
--- /dev/null
+++ b/postfix/README_QMQP
@@ -0,0 +1,39 @@
+Postfix QMQP server support
+===========================
+
+Postfix has preliminary server support for the QMQP protocol, so
+that Postfix can be used as a backend for the Ezmlm-idx mailing
+list manager. This support includes qmqp-source and qmqp-sink
+programs for protocol stress testing.
+
+Turning on the QMQP service
+===========================
+
+To enable QMQP server support on an existing Postfix system you
+have to add the following line to /etc/postfix/master.cf:
+
+628 inet n - n - - qmqpd
+
+
+QMQP server access control
+==========================
+
+By default, the QMQP server does not accept mail from any client.
+This is because the QMQP server relays mail to any destination
+(the "protocol" has no provision to reject specific recipients).
+
+To authorize QMQP clients, edit /etc/postfix/main.cf and specify
+a list of client patterns.
+
+qmqp_authorized_clients = client, client, ...
+
+A list pattern specifies a host name, a domain name, an internet
+address, or a network/mask pattern, where the mask specifies the
+number of bits in the network part. When a pattern specifies a
+file name, its contents are substituted for the file name; when a
+pattern is a type:name table specification, table lookup is used
+instead.
+
+Patterns are separated by whitespace and/or commas. In order to
+reverse the result, precede a non-file name pattern with an
+exclamation point (!).
diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES
index 7a25fef57..71b51f4ac 100644
--- a/postfix/RELEASE_NOTES
+++ b/postfix/RELEASE_NOTES
@@ -1,3 +1,28 @@
+Incompatible changes with snapshot-20010707
+===========================================
+
+The SMTP client by default breaks lines > 2048 characters, in order
+to avoid problems with mail delivery to fragile SMTP server software.
+To get the old behavior, specify "smtp_break_lines = no" in the
+Postfix main.cf file.
+
+Major changes with snapshot-20010707
+====================================
+
+QMQP server support, so that Postfix can be used as a backend mailer
+for the Ezmlm-idx mailing list manager. The service is disabled by
+default. To enable, follow instructions in the README_QMQP file.
+
+You can now reject unknown virtual(8) recipients at the SMTP port
+by specifying a "domain.name whatever" entry in the tables specified
+with virtual_mailbox_maps, similar to Postfix virtual(5) domains.
+[virtual(8) is the Postfix virtual delivery agent, virtual(5) is
+the Postfix virtual map. The two implement virtual domains in a
+very different manner.]
+
+Specify "mail_spool_directory = /var/mail/" (note the trailing "/"
+character) to enable maildir format for /var/mail/username.
+
Incompatible changes with snapshot-20010610
===========================================
diff --git a/postfix/conf/master.cf b/postfix/conf/master.cf
index 75073b080..fc4417323 100644
--- a/postfix/conf/master.cf
+++ b/postfix/conf/master.cf
@@ -69,6 +69,7 @@
# (yes) (yes) (yes) (never) (50)
# ==========================================================================
smtp inet n - n - - smtpd
+#628 inet n - n - - qmqpd
pickup fifo n n n 60 1 pickup
cleanup unix - - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
diff --git a/postfix/conf/postfix-script-diff b/postfix/conf/postfix-script-diff
index 538659fb9..1881b7380 100644
--- a/postfix/conf/postfix-script-diff
+++ b/postfix/conf/postfix-script-diff
@@ -1,7 +1,7 @@
-*** postfix-script-nosgid Wed Mar 24 11:20:49 1999
---- postfix-script-sgid Wed Mar 24 11:20:53 1999
+*** postfix-script-nosgid Thu May 24 17:13:59 2001
+--- postfix-script-sgid Fri Jun 29 10:28:19 2001
***************
-*** 174,181 ****
+*** 177,184 ****
test -d maildrop || {
$WARN creating missing Postfix maildrop directory
mkdir maildrop || exit 1
@@ -10,13 +10,13 @@
}
test -d pid || {
$WARN creating missing Postfix pid directory
---- 174,182 ----
+--- 177,185 ----
test -d maildrop || {
$WARN creating missing Postfix maildrop directory
mkdir maildrop || exit 1
! chmod 1730 maildrop
chown $mail_owner maildrop
-+ chgrp maildrop maildrop
++ (. $config_directory/install.cf; chgrp $setgid maildrop)
}
test -d pid || {
$WARN creating missing Postfix pid directory
diff --git a/postfix/conf/postfix-script-sgid b/postfix/conf/postfix-script-sgid
old mode 100755
new mode 100644
index 98207c5e8..43f5b2b62
--- a/postfix/conf/postfix-script-sgid
+++ b/postfix/conf/postfix-script-sgid
@@ -179,7 +179,7 @@ check)
mkdir maildrop || exit 1
chmod 1730 maildrop
chown $mail_owner maildrop
- chgrp maildrop maildrop
+ (. $config_directory/install.cf; chgrp $setgid maildrop)
}
test -d pid || {
$WARN creating missing Postfix pid directory
diff --git a/postfix/conf/sample-qmqpd.cf b/postfix/conf/sample-qmqpd.cf
new file mode 100644
index 000000000..03d26ee3c
--- /dev/null
+++ b/postfix/conf/sample-qmqpd.cf
@@ -0,0 +1,40 @@
+# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF
+# HERE JUST SERVES AS AN EXAMPLE.
+#
+# This file contains example settings of Postfix configuration parameters
+# that control the QMQP server program.
+
+# The qmqpd_authorized_clients parameter specifies what clients are
+# allowed to connect to the QMQP server port.
+#
+# By default, no client is allowed to use the service. This is
+# because the QMQP server will relay mail to any destination.
+#
+# Specify a list of client patterns. A list pattern specifies a host
+# name, a domain name, an internet address, or a network/mask pattern,
+# where the mask specifies the number of bits in the network part.
+# When a pattern specifies a file name, its contents are substituted
+# for the file name; when a pattern is a type:name table specification,
+# table lookup is used instead.
+#
+# Patterns are separated by whitespace and/or commas. In order to
+# reverse the result, precede a non-file name pattern with an
+# exclamation point (!).
+#
+#qmqpd_authorized_clients =
+
+# The qmqpd_error_delay parameter specifies how long the QMQP server
+# will pause before sending a negative reply to the client. The
+# purpose is to slow down confused or malicious clients.
+#
+# By default, the QMQP server pauses for 5 seconds.
+#
+#qmqpd_error_delay = 5s
+
+# The qmqpd_timeout parameter specifies a time limit for network I/O
+# operations. If a read or write operation blocks for more than
+# $qmqpd_timeout seconds the QMQP server gives up and disconnects.
+#
+# By default, the QMQP server runs out of patience after 300 seconds.
+#
+#qmqpd_timeout = 300s
diff --git a/postfix/conf/sample-smtp.cf b/postfix/conf/sample-smtp.cf
index ccaf5ec64..b1ffef725 100644
--- a/postfix/conf/sample-smtp.cf
+++ b/postfix/conf/sample-smtp.cf
@@ -65,6 +65,14 @@ smtp_never_send_ehlo = no
#
#smtp_bind_address=111.222.333.444
+# The smtp_break_lines parameter controls whether the SMTP client
+# will break lines longer than $line_length_limit characters.
+#
+# By default, line breaking is turned on, because some fragile SMTP
+# server implementations cannot receive mail with long lines.
+#
+#smtp_break_lines = yes
+
# The smtp_skip_4xx_greeting parameter controls what happens when
# an SMTP server greets us with a 4XX status code (go away, try
# again later).
diff --git a/postfix/html/Makefile.in b/postfix/html/Makefile.in
index cead447a0..44a59f239 100644
--- a/postfix/html/Makefile.in
+++ b/postfix/html/Makefile.in
@@ -5,7 +5,7 @@ SHELL = /bin/sh
DAEMONS = bounce.8.html cleanup.8.html defer.8.html error.8.html local.8.html \
lmtp.8.html master.8.html pickup.8.html pipe.8.html qmgr.8.html \
showq.8.html smtp.8.html smtpd.8.html trivial-rewrite.8.html \
- nqmgr.8.html spawn.8.html flush.8.html virtual.8.html
+ nqmgr.8.html spawn.8.html flush.8.html virtual.8.html qmqpd.8.html
COMMANDS= mailq.1.html newaliases.1.html postalias.1.html postcat.1.html \
postconf.1.html postfix.1.html postkick.1.html postlock.1.html \
postlog.1.html postdrop.1.html postmap.1.html sendmail.1.html \
@@ -68,6 +68,9 @@ pipe.8.html: ../src/pipe/pipe.c
qmgr.8.html: ../src/qmgr/qmgr.c
srctoman $? | $(AWK) | nroff -man | uniq | man2html | postlink >$@
+qmqpd.8.html: ../src/qmqpd/qmqpd.c
+ srctoman $? | $(AWK) | nroff -man | uniq | man2html | postlink >$@
+
showq.8.html: ../src/showq/showq.c
srctoman $? | $(AWK) | nroff -man | uniq | man2html | postlink >$@
diff --git a/postfix/html/faq.html b/postfix/html/faq.html
index 355a5a855..827439ecc 100644
--- a/postfix/html/faq.html
+++ b/postfix/html/faq.html
@@ -94,6 +94,12 @@ domains with "relay access denied"
Mail delivery fails with: "unknown
mail transport error"
+Too many connections
+
+write queue file: No such file or directory
+
+write queue file: Unknown error 4294967289
+
@@ -1033,7 +1039,7 @@ Berkeley DB library version.
-sendmail has set-uid root file permissions, or is run from a
+sendmail has set-uid root file permissions, or is run from a
set-uid root process
Traditionally, the UNIX sendmail command is installed with
@@ -1126,36 +1132,49 @@ run out of file handles; after that, it will run out of sockets.
-To set kernel parameters at boot time, add the following lines to
-the /boot/loader.conf file (this is specific to FreeBSD 4.x):
+To set the following kernel parameters at boot time, add the
+following lines to the /boot/loader.conf file (this is
+specific to FreeBSD 4.x):
kern.ipc.maxsockets="5000"
-kern.maxfiles="16384"
-kern.maxfilesperproc="16384"
kern.ipc.nmbclusters="65536"
-To set kernel parameters at run time execute the following commands
-as root (this is specific to FreeBSD 4.x):
+These parameters cannot be set at run time (verified with FreeBSD
+4.2).
+
+
+
+To set the following kernel parameters at run time execute the
+following commands as root (this is specific to FreeBSD 4.x):
-# sysctl -w kern.ipc.maxsockets=5000
# sysctl -w kern.maxfiles=16384
# sysctl -w kern.maxfilesperproc=16384
-# sysctl -w kern.ipc.nmbclusters=65536
+
+
+These parameters cannot be set from /boot/loader.conf
+(verified with FreeBSD 4.2).
+
+
+
+Other kernel parameters such as kern.maxproc can be increased
+only by recompiling the kernel with a different maxusers
+setting in the kernel configuration file (verified with FreeBSD 4.2).
+
Running hundreds of Postfix processes on Linux
@@ -3367,6 +3386,27 @@ files, and to mount the Postfix queue file system with the
+Too many connections
+
+This message is produced by the MYQSL server. You need to increase
+the number of connections that it can handle. Things to bear in
+mind: the virtual and canonical maps are accessed by
+every smtpd and cleanup process.
+
+
+
+write queue file: No such file or directory
+
+write queue file: Unknown error 4294967289
+
+Reiserfs reports the wrong error code when a message exceeds the
+message_size_limit setting. As a result, the Postfix SMTP
+server reports a "queue file write error" to the SMTP client, rather
+than reporting a "file too large" condition. The client will keep
+sending the same email again and again until the mail is too old.
+
+
+
Up one level | Postfix FAQ
+
+QMQPD(8) QMQPD(8)
+
+NAME
+ qmqpd - Postfix QMQP server
+
+SYNOPSIS
+ qmqpd [generic Postfix daemon options]
+
+DESCRIPTION
+ The Postfix QMQP server receives one message per connec-
+ tion. Each message is piped through the cleanup(8) dae-
+ mon, and is placed into the incoming queue as one single
+ queue file. The program expects to be run from the mas-
+ ter(8) process manager.
+
+ The QMQP server implements one access policy: only explic-
+ itly authorized client hosts are allowed to use the ser-
+ vice.
+
+SECURITY
+ The QMQP server is moderately security-sensitive. It talks
+ to QMQP clients and to DNS servers on the network. The
+ QMQP server can be run chrooted at fixed low privilege.
+
+DIAGNOSTICS
+ Problems and transactions are logged to syslogd(8).
+
+BUGS
+ The QMQP protocol provides only one server reply per mes-
+ sage delivery. It is therefore not possible to reject
+ individual recipients.
+
+ The QMQP protocol requires the server to receive the
+ entire message before replying. If a message is malformed,
+ or if any netstring component is longer than acceptable,
+ Postfix replies immediately and closes the connection. It
+ is left up to the client to handle the situation.
+
+CONFIGURATION PARAMETERS
+ The following main.cf parameters are especially relevant
+ to this program. See the Postfix main.cf file for syntax
+ details and for default values. Use the postfix reload
+ command after a configuration change.
+
+Miscellaneous
+ always_bcc
+ Address to send a copy of each message that enters
+ the system.
+
+ debug_peer_level
+ Increment in verbose logging level when a remote
+ host matches a pattern in the debug_peer_list
+ parameter.
+
+ debug_peer_list
+ List of domain or network patterns. When a remote
+ host matches a pattern, increase the verbose log-
+ ging level by the amount specified in the
+ debug_peer_level parameter.
+
+ hopcount_limit
+ Limit the number of Received: message headers.
+
+ qmqpd_authorized_clients
+ A list of domain or network patterns that specifies
+ what clients are allowed to use the service.
+
+ qmqpd_timeout
+ Limit the time to send a server response and to
+ receive a client request.
+
+ soft_bounce
+ Change hard (D) reject responses into soft (Z)
+ reject responses. This can be useful for testing
+ purposes.
+
+Content inspection controls
+ content_filter
+ The name of a mail delivery transport that filters
+ mail and that either bounces mail or re-injects the
+ result back into Postfix. This parameter uses the
+ same syntax as the right-hand side of a Postfix
+ transport table.
+
+Resource controls
+ line_length_limit
+ Limit the amount of memory in bytes used for the
+ handling of partial input lines, and the length of
+ sender and recipient addresses that are received
+ from client.
+
+ message_size_limit
+ Limit the total size in bytes of a message, includ-
+ ing on-disk storage for sender and recipient
+ address information.
+
+Tarpitting
+ qmqpd_error_sleep_time
+ Time to wait in seconds before informing the client
+ of a problem. This slows down run-away errors.
+
+SEE ALSO
+ http://cr.yp.to/proto/qmqp.html, QMQP protocol
+ cleanup(8) message canonicalization
+ master(8) process manager
+ syslogd(8) system logging
+
+LICENSE
+ The Secure Mailer license must be distributed with this
+ software.
+
+AUTHOR(S)
+ Wietse Venema
+ IBM T.J. Watson Research
+ P.O. Box 704
+ Yorktown Heights, NY 10598, USA
+
+ 1
+
+
diff --git a/postfix/html/lmtp.8.html b/postfix/html/lmtp.8.html
index df2d81ed6..a4428fa0b 100644
--- a/postfix/html/lmtp.8.html
+++ b/postfix/html/lmtp.8.html
@@ -108,7 +108,7 @@ LMTP(8) LMTP(8)
found in services(4).
Authentication controls
- lmtp_enable_sasl_auth
+ lmtp_sasl_auth_enable
Enable per-session authentication as per RFC 2554
(SASL). By default, Postfix is built without SASL
support.
diff --git a/postfix/html/pipe.8.html b/postfix/html/pipe.8.html
index 9fb5b181c..372fce1b6 100644
--- a/postfix/html/pipe.8.html
+++ b/postfix/html/pipe.8.html
@@ -78,7 +78,7 @@ PIPE(8) PIPE(8)
The q flag affects only entire addresses,
not the partial address information from the
- $user, extension or mailbox command-line
+ $user, $extension or $mailbox command-line
macros.
u Fold the command-line $recipient address
diff --git a/postfix/html/qmqpd.8.html b/postfix/html/qmqpd.8.html
new file mode 100644
index 000000000..7bed7101b
--- /dev/null
+++ b/postfix/html/qmqpd.8.html
@@ -0,0 +1,122 @@
+