-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
Web sites:
+ http://www.postfix.org/ current release information
http://www.ibm.com/alphaworks/ the original distribution site
- http://www.postfix.org/ post-release information
Mail addresses (please do NOT send mail to my address at work):
are also available through the HTML interface, which allows you to
navigate faster.
+The RELEASE_NOTES file describes new features, and lists incompatible
+changes with respect to previous Postfix versions.
+
+The INSTALL file provides a step-by-step guide for building and
+installing Postfix on many popular UNIX platforms.
+
The COMPATIBILITY file lists features that Postfix does or does
not yet implement, and how well it works with other software.
The HISTORY file gives a detailed log of changes to the software.
-The INSTALL file provides a step-by-step guide for building and
-installing Postfix on many popular UNIX platforms.
-
The PORTING file discusses how to go about porting Postfix to other
UNIX platforms. Some people are looking into a port to Windows NT.
We'll see. This software uses every trick in the book that I learned
bounce/ Bounce or defer mail
cleanup/ Canonicalize and enqueue mail
+ error/ Trivial error mailer
local/ Local delivery
master/ Postfix resident superserver
pickup/ Local pickup
Miscellaneous:
- bin/ Installed programs
+ bin/ Postfix command executables
conf/ Sample configuration files
include/ Installed include files
lib/ Installed object libraries
+ libexec/ Postfix daemon executables
19990121
Feature: pickup (again) logs uid and sender address.
- On repeated request by Scott Cotton, Internet, IC Group, Inc.
+ On repeated request by Scott Cotton, Internet Consultants
+ Group, Inc.
Portability: doze() function for systems without usleep().
user@[ip_address] regardless of destination. Eric Cholet
had the honor of suffering from this one.
-1990601
+19990527
+
+ More SMTP client logging for easier debugging: the smtp
+ client now logs hostname[ip.addr], and logs every failed
+ attempt to reach an MX host, not just the last one.
+
+19990601
Bugfix: emit a blank line before a MIME boundary; the line
is part of the boundary. File: bounce/bounce_notify_service.c.
Wolfgang Segmuller, IBM Research.
+
+19990610
+
+ Bugfix: the "is this the loopback interface" test was
+ broken. Reported by Claus Fischer @microworld.com.
+ File: smtp/smtp_connect.c.
+
+ Usability: added helpful warnings about restrictions that
+ are being ignored after check_relay_domains, etc.
+
+ Portability: Reliant Unix support by Gert-Jan Looy, Siemens,
+ the Netherlands.
+
+19990611
+
+ Robustness: the postfix-script start-up procedure now
+ detects a missing master program, avoiding misleading
+ warnings that the mail system is already running. Fix
+ suggested by David E. Smith @technopagan.org.
+
+ Portability: Mac OS X Server Port by Mark Miller @swoon.net.
+
+ Feature: on systems that use dotlock files for mailbox
+ locking, the local delivery agent now will attempt to use
+ dotlock files when delivering to user-specified files.
+ Dotlock files for user-specified destinations are created
+ with the privileges of the user. For backwards compatibility,
+ Postfix will attempt to create dotlocks for user-specified
+ destinations only when the user has parent directory write
+ permission.
+
+ Feature: specify "expand_owner_alias = yes" in order to
+ use the right-hand side of an owner- alias, instead of
+ using the left-hand side address. Needed by Juergen Georgi.
+
+19990622
+
+ Bugfix: the local delivery agent did not set user attributes
+ when delivering to root, so that forward_path did not expand
+ properly. Found by Jozsef Kadlecsik, KFKI Research Institute
+ for Particle and Nuclear Physics, Hungary. File:
+ local/dotforward.c.
+
+ Bugfix: the unix:passwd.byname mechanism is not suitable
+ for smtpd access control - the user name would have to end
+ in @, or the access control software would have to be
+ changed. Removed the example from the RELEASE_NOTES file.
+
+19990623
+
+ Bugfix: the smtp server did not reset the error flag after
+ ".". Found by James Ponder, Oaktree Internet Solutions Ltd.
+ File: smtpd/smtpd.c.
+
+ Bugfix: fencepost error in the doze() routine (an usleep()
+ replacement for systems without one). Found by Simon J Mudd.
+ File: util/doze.c.
+
+19990624
+
+ Portability: support for AIX 3.2.5 (!) by Florian Lohoff
+ @rfc822.org.
+
+ Portability: Ultrix 4.3 support by Christian von Roques
+ @pond.sub.org.
+
+ Feature: mysql support by Scott Cotton and Joshua Marcus,
+ Internet Consultants Group, Inc. Files: util/dict_myqsl.*.
+
+19990627
+
+ Bugfix: Postfix is now distributed under the new IBM Public
+ License (version 1, dated June 14, 1999).
+
+ Feature: the Delivered-To: header can be turned off for
+ delivery to command or file/mailbox. The default setting
+ is: "prepend_delivered_header = command, file, forward".
+ Turning off the Delivered-To: header when forwarding mail
+ is not recommended.
-Please read this carefully. You must agree to the following terms and
-conditions before installing the Secure Mailer or any related
-documentation ("Software"). If you do not agree to these terms
-and conditions, you may not install or use the Software.
-
-Permission to reproduce and create derivative works from the Software
-("Software Derivative Works") is hereby granted to you under the
-copyrights of International Business Machines Corporation ("IBM"). IBM
-also grants you the right to distribute the Software and Software
-Derivative Works.
-
-You grant IBM a world-wide, royalty-free right to use, copy,
-distribute, sublicense and prepare derivative works based upon any
-feedback, including materials, error corrections, Software Derivatives,
-enhancements, suggestions and the like that you provide to IBM relating
-to the Software.
-
-IBM licenses the Software to you on an "AS IS" basis, without warranty
-of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES OR
-CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, NON
-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. You are solely
-responsible for determining the appropriateness of using this Software
-and assume all risks associated with the use and distribution of this
-Software, including but not limited to the risks of program errors,
-damage to or loss of data, programs or equipment, and unavailability or
-interruption of operations. IBM WILL NOT BE LIABLE FOR ANY DIRECT
-DAMAGES OR FOR ANY SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY
-ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS),
-EVEN IF IBM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IBM
-will not be liable for the loss of, or damage to, your records or data,
-or any damages claimed by you based on a third party claim. You may
-not use the name "IBM" or any other IBM trademark without the prior
-written consent of IBM.
-
-You agree to distribute the Software and any Software Derivatives under
-a license agreement that: 1) is sufficient to notify all licensees of
-the Software and Software Derivatives that IBM assumes no liability for
-any claim that may arise regarding the Software or Software
-Derivatives, and 2) that disclaims all warranties, both express and
-implied, from IBM regarding the Software and Software Derivatives. (If
-you include this Agreement with any distribution of the Software or
-Software Derivatives you will have met this requirement.) You agree
-that you will not delete any copyright notices in the Software.
-
-In the event an intellectual property claim is made or appears likely
-to be made with respect to the Software, you agree to permit IBM to
-enable you to continue to use the Software, or to modify it, or replace
-it with software that is at least functionally equivalent. If IBM
-determines that none of these alternatives is reasonably available, you
-agree, at IBM's request, upon notice to you, to discontinue further
-distribution of the Software and to delete or destroy all copies of the
-Software you possess. This is IBM's entire obligation to you regarding
-any claim of infringement.
-
-This Agreement is the exclusive statement of your rights in the
-Software as provided by IBM. Except for the licenses granted to you in
-the second paragraph above, no other licenses are granted hereunder, by
-estoppel, implication or otherwise.
+IBM PUBLIC LICENSE VERSION 1.0 6/14/1999 - SECURE MAILER
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE
+PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+ a) in the case of International Business Machines Corporation ("IBM"),
+ the Original Program, and
+ b) in the case of each Contributor,
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate
+ from and are distributed by that particular Contributor.
+ A Contribution 'originates' from a Contributor if it was added
+ to the Program by such Contributor itself or anyone acting on
+ such Contributor's behalf.
+ Contributions do not include additions to the Program which:
+ (i) are separate modules of software distributed in conjunction
+ with the Program under their own license agreement, and
+ (ii) are not derivative works of the Program.
+
+"Contributor" means IBM and any other entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Original Program" means the original version of the software accompanying
+this Agreement as released by IBM, including source code, object code
+and documentation, if any.
+
+"Program" means the Original Program and Contributions.
+
+"Recipient" means anyone who receives the Program under this Agreement,
+including all Contributors.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare derivative works of, publicly display,
+ publicly perform, distribute and sublicense the Contribution of such
+ Contributor, if any, and such derivative works, in source code and
+ object code form.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in source code and object code form. This patent license
+ shall apply to the combination of the Contribution and the Program
+ if, at the time the Contribution is added by the Contributor, such
+ addition of the Contribution causes such combination to be covered
+ by the Licensed Patents. The patent license shall not apply to any
+ other combinations which include the Contribution. No hardware per
+ se is licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the rights
+ and licenses granted hereunder, each Recipient hereby assumes sole
+ responsibility to secure any other intellectual property rights
+ needed, if any. For example, if a third party patent license
+ is required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before distributing
+ the Program.
+
+ d) Each Contributor represents that to its knowledge it has sufficient
+ copyright rights in its Contribution, if any, to grant the copyright
+ license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+ a) it complies with the terms and conditions of this Agreement; and
+ b) its license agreement:
+ i) effectively disclaims on behalf of all Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+ ii) effectively excludes on behalf of all Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+ iii) states that any provisions which differ from this Agreement
+ are offered by that Contributor alone and not by any other
+ party; and
+ iv) states that source code for the Program is available from
+ such Contributor, and informs licensees how to obtain it in a
+ reasonable manner on or through a medium customarily used for
+ software exchange.
+
+When the Program is made available in source code form:
+ a) it must be made available under this Agreement; and
+ b) a copy of this Agreement must be included with each copy of the
+ Program.
+
+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.
+
+In addition, each Contributor must identify itself as the originator of
+its Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program, the
+Contributor who includes the Program in a commercial product offering
+should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in
+a commercial product offering, such Contributor ("Commercial Contributor")
+hereby agrees to defend and indemnify every other Contributor
+("Indemnified Contributor") against any losses, damages and costs
+(collectively "Losses") arising from claims, lawsuits and other legal
+actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor
+in connection with its distribution of the Program in a commercial
+product offering. The obligations in this section do not apply to any
+claims or Losses relating to any actual or alleged intellectual property
+infringement. In order to qualify, an Indemnified Contributor must:
+ a) promptly notify the Commercial Contributor in writing of such claim,
+and
+ b) allow the Commercial Contributor to control, and cooperate with
+ the Commercial Contributor in, the defense and any related
+ settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay those
+damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED
+ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
+EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
+CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
+PARTICULAR PURPOSE. Each Recipient is solely responsible for determining
+the appropriateness of using and distributing the Program and assumes
+all risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION
+OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against a Contributor with
+respect to a patent applicable to software (including a cross-claim or
+counterclaim in a lawsuit), then any patent licenses granted by that
+Contributor to such Recipient under this Agreement shall terminate
+as of the date such litigation is filed. In addition, If Recipient
+institutes patent litigation against any entity (including a cross-claim
+or counterclaim in a lawsuit) alleging that the Program itself (excluding
+combinations of the Program with other software or hardware) infringes
+such Recipient's patent(s), then such Recipient's rights granted under
+Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails
+to comply with any of the material terms or conditions of this Agreement
+and does not cure such failure in a reasonable period of time after
+becoming aware of such noncompliance. If all Recipient's rights under
+this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's
+obligations under this Agreement and any licenses granted by Recipient
+relating to the Program shall continue and survive.
+
+IBM may publish new versions (including revisions) of this Agreement
+from time to time. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement under
+which it was received. In addition, after a new version of the Agreement
+is published, Contributor may elect to distribute the Program (including
+its Contributions) under the new version. No one other than IBM has the
+right to modify this Agreement. Except as expressly stated in Sections
+2(a) and 2(b) above, Recipient receives no rights or licenses to the
+intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the
+Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the
+intellectual property laws of the United States of America. No party to
+this Agreement will bring a legal action under this Agreement more than
+one year after the cause of action arose. Each party waives its rights
+to a jury trial in any resulting litigation.
--- /dev/null
+[Code contributed by Scott Cotton and Joshua Marcus, IC Group, Inc.]
+
+We've written code to add a mysql map type. It utilizes the mysql
+client library, which can be obtained from:
+
+ http://www.tcx.se/download.html
+
+In order to build postfix with mysql map support, you will need to add
+-DHAS_MYSQL and -I for the directory containing the mysql headers, and
+the mysqlclient library (and libm) to AUXLIBS, for example:
+
+make -f Makefile.init makefiles \
+ 'CCARGS=-DHAS_MYSQL -I/some/where/include/mysql' \
+ 'AUXLIBS=/some/where/lib/mysql/libmysqlclient.a -lm'
+
+then, just run 'make'.
+
+Postfix installations which may benefit from using mysql map types
+include sites that have a need for instantaneous updates of
+forwarding, and sites that may benefit from having mail exchangers
+reference a networked database, possibly working in conjunction with a
+customer database of sorts.
+
+Once postfix is built with mysql support, you can specify a map type
+in main.cf like this:
+
+alias_maps = mysql:/etc/postfix/mysql-aliases.cf
+
+The file /etc/postfix/mysql-aliases.cf specifies lots of information
+telling postfix how to reference the mysql database. An example mysql
+map config file follows:
+
+#
+# mysql config file for alias lookups on postfix
+# comments are ok.
+#
+
+# the user name and password to log into the mysql server
+user = someone
+password = some_passwordd
+
+# the database name on the servers
+dbname = customer_database
+
+# the table name
+table = mxaliases
+
+#
+select_field = forw_addr
+where_field = alias
+
+# you may specify additional_conditions here
+additional_conditions = and status = 'paid'
+
+# the above variables will result in a query of
+# the form:
+# select forw_addr from mxaliases where alias = '$lookup' and status = 'paid'
+# ($lookup is escaped so if it contains single quotes or other odd
+# characters, it will not cause a parse error in the sql).
+#
+# the hosts that postfix will try to connect to
+# and query from (in the order listed)
+hosts = host1.some.domain host2.some.domain
+
+# end mysql config file
+
+Some notes:
+
+This configuration interface setup allows for multiple mysql
+databases: you can use one for a virtual table, one for an access
+table, and one for an aliases table if you want.
+
+Since sites that have a need for multiple mail exchangers may enjoy
+the convenience of using a networked mailer database, but do not want
+to introduce a single point of failure to their system, we've included
+the ability to have postfix reference multiple hosts for access to a
+single mysql map. This will work if sites set up mirrored mysql
+databases on two or more hosts. Whenever queries fail with an error
+at one host, the rest of the hosts will be tried in order. Each host
+that is in an error state will undergo a reconnection attempt every so
+often, and if no mysql server hosts are reachable, then mail will be
+deferred until atleast one of those hosts is reachable.
+
+Performance of postfix with mysql has not been thoroughly tested,
+however, we have found it to be stable. Busy mail servers using mysql
+maps will generate lots of concurrent mysql clients, so the mysql
+server(s) should be run with this fact in mind. Any further
+performance information, in addition to any feedback is most welcome.
+
(set -e; echo "[$$i]"; cd $$i; rm -f Makefile; \
$(MAKE) -f Makefile.in Makefile); \
done;
- rm -f Makefile; (set -e; sh makedefs; cat Makefile.in) >Makefile
+ rm -f Makefile; (set -e; $(SHELL) makedefs; cat Makefile.in) >Makefile
update printfck:
set -e; for i in $(DIRS); do \
cp Makefile.init Makefile
-rm -f *core */*core .nfs* .pure bin/* lib/* include/* libexec/* \
*/.nfs* */.pure *.out */*.out */*.db */*.a *~ */*~ *- */*- *.orig \
- */*.orig *.bak */*.bak make.err
+ */*.orig *.bak */*.bak make.err conf/main.cf.default
find . -type s -print | xargs rm -f
find . -type d -print | xargs chmod 755
find . -type f -print | xargs chmod a+r
+Incompatible changes with snapshot-19990627:
+============================================
+
+- On systems that use user.lock files to protect system mailboxes
+against simultaneous updates, Postfix now uses /file/name.lock
+files while delivering to files specified in aliases/forward/include
+files. This is a no-op when the recipient lacks directory write
+permission.
+
+Major changes with snapshot-19990627:
+=====================================
+
+Several bugfixes, none related to security. See the HISTORY file
+for a complete list of changes.
+
+- Postfix is now distributed under IBM Public License Version 1.0
+(June 14, 1999), which does not carry the controversial termination
+clause. The new license does have a requirement that contributors
+make source code available.
+
+- The ugly Delivered-To: header can now be turned off selectively.
+The default setting is: "prepend_delivered_header = command, file,
+forward". Turning off the Delivered-To: header when forwarding
+mail is not recommended.
+
+- mysql client support by Scott Cotton and Joshua Marcus, Internet
+Consultants Group, Inc. See the file MYSQL_README for instructions.
+
+- Portability to the Mac OS X Server, Reliant Unix, AIX 3.2.5 and
+Ultrix 4.3.
+
Incompatible changes with postfix-19990601:
===========================================
- Workaround for BSD select() collisions that cause performance
problems on large BSD systems.
-- Use "$alias_maps, unix:passwd.byname" in smtpd access tables to
-recognize known local users. We're almost there with stopping
-unknown users at the RCPT TO command - the syntax for virtual maps
-and sendmail access tables is too different.
-
- Several questionable but useful features to capture mail:
"always_bcc = address" to capture a copy of every message that
enters the system, and "luser_relay = address" to capture mail for
--- /dev/null
+To: wietse@porcupine.org (Wietse Venema)
+Subject: postfix-19990317-pl05 on Ultrix4.3a
+From: Christian von Roques <roques@pond.sub.org>
+Date: 02 Jun 1999 18:44:34 +0200
+Message-ID: <87iu96wo0d.fsf_-_@scalar.pond.sub.org>
+
+I've upgraded the MTA of our DECstation-3100 running Ultrix4.3a to
+postfix-19990317-pl05 and am sending you the patches I needed to get
+it running under Ultrix.
+
+ ...
+
+ o One of the bugs of Ultrix's /bin/sh is that shell-variables set in
+ arguments of `:' expand to garbage if expanded in here-documents.
+ Using a different shell helps. I needed to replace all calls of
+ ``sh .../makedefs'' by ``$(SHELL) .../makedefs'' in all the
+ Makefile.in and am now able to use
+
+ make SHELL=/bin/sh5 or zsh.
+
+ ...
+
+ o Ultrix's FD_SET_SIZE is 4096, but getdtablesize() returns 64 by
+ default, if not increased when building a new kernel. getrlimit()
+ doesn't know RLIMIT_NOFILE. This makes event_init() always log
+ the warning: `could allocate space for only 64 open files'.
+
+ I just reduced the threshold from 256 to 64, but this is not good.
+ The initial problem still remains: How to disable this warning on
+ Ultrix without making the source ugly?
+
+[I have updated util/sys_defs.h, and by default set FD_SETSIZE to
+100. This should be sufficient for a workstation. No-one would
+run a major mail hub on Ultrix 4. -- Wietse]
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
cleanup_extracted.o: ../include/cleanup_user.h
cleanup_extracted.o: ../include/record.h
cleanup_extracted.o: ../include/rec_type.h
+cleanup_extracted.o: ../include/mail_params.h
+cleanup_extracted.o: ../include/ext_prop.h
cleanup_extracted.o: cleanup.h
cleanup_extracted.o: ../include/maps.h
cleanup_extracted.o: ../include/dict.h
}
if (type == REC_TYPE_MESG) {
if (cleanup_sender == 0 || cleanup_time == 0) {
- msg_warn("missing sender or time envelope record");
+ msg_warn("%s: missing sender or time envelope record",
+ cleanup_queue_id);
cleanup_errs |= CLEANUP_STAT_BAD;
} else {
if (warn_time == 0 && var_delay_warn_time > 0)
break;
}
if (strchr(REC_TYPE_ENVELOPE, type) == 0) {
- msg_warn("unexpected record type %d in envelope", type);
+ msg_warn("%s: unexpected record type %d in envelope",
+ cleanup_queue_id, type);
cleanup_errs |= CLEANUP_STAT_BAD;
break;
}
cleanup_sender = mystrdup(STR(clean_addr));
} else if (type == REC_TYPE_RCPT) {
if (cleanup_sender == 0) { /* protect showq */
- msg_warn("envelope recipient precedes sender");
+ msg_warn("%s: envelope recipient precedes sender",
+ cleanup_queue_id);
cleanup_errs |= CLEANUP_STAT_BAD;
break;
}
} else if (type == REC_TYPE_END) {
break;
} else {
- msg_warn("unexpected record type %d in extracted segment", type);
+ msg_warn("%s: unexpected record type %d in extracted segment",
+ cleanup_queue_id, type);
cleanup_errs |= CLEANUP_STAT_BAD;
if (type >= 0)
cleanup_skip();
for (count = 0; count < MAX_RECURSION; count++) {
if ((new_addr = mail_addr_map(maps, STR(addr), propagate)) != 0) {
if (new_addr->argc > 1)
- msg_warn("multi-valued %s entry for %s",
- maps->title, STR(addr));
+ msg_warn("%s: multi-valued %s entry for %s",
+ cleanup_queue_id, maps->title, STR(addr));
saved_addr = mystrdup(STR(addr));
vstring_strcpy(addr, new_addr->argv[0]);
expand_to_self = !strcasecmp(saved_addr, STR(addr));
break;
}
if (strchr(REC_TYPE_CONTENT, type) == 0) {
- msg_warn("%s: unexpected record type %d", myname, type);
+ msg_warn("%s: %s: unexpected record type %d",
+ cleanup_queue_id, myname, type);
cleanup_errs |= CLEANUP_STAT_BAD;
break;
}
if (CLEANUP_OUT_OK()) {
if (rec_put(cleanup_dst, type, string, len) < 0) {
if (errno == EFBIG) {
- msg_warn("queue file size limit exceeded");
+ msg_warn("%s: queue file size limit exceeded",
+ cleanup_queue_id);
cleanup_errs |= CLEANUP_STAT_SIZE;
} else {
msg_warn("%s: write queue file: %m", cleanup_queue_id);
{
int type;
- msg_warn("skipping further client input");
+ msg_warn("%s: skipping further client input", cleanup_queue_id);
/*
* XXX Rely on the front-end programs to enforce record size limits.
-Please read this carefully. You must agree to the following terms and
-conditions before installing the Secure Mailer or any related
-documentation ("Software"). If you do not agree to these terms
-and conditions, you may not install or use the Software.
-
-Permission to reproduce and create derivative works from the Software
-("Software Derivative Works") is hereby granted to you under the
-copyrights of International Business Machines Corporation ("IBM"). IBM
-also grants you the right to distribute the Software and Software
-Derivative Works.
-
-You grant IBM a world-wide, royalty-free right to use, copy,
-distribute, sublicense and prepare derivative works based upon any
-feedback, including materials, error corrections, Software Derivatives,
-enhancements, suggestions and the like that you provide to IBM relating
-to the Software.
-
-IBM licenses the Software to you on an "AS IS" basis, without warranty
-of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES OR
-CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, NON
-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. You are solely
-responsible for determining the appropriateness of using this Software
-and assume all risks associated with the use and distribution of this
-Software, including but not limited to the risks of program errors,
-damage to or loss of data, programs or equipment, and unavailability or
-interruption of operations. IBM WILL NOT BE LIABLE FOR ANY DIRECT
-DAMAGES OR FOR ANY SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY
-ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS),
-EVEN IF IBM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IBM
-will not be liable for the loss of, or damage to, your records or data,
-or any damages claimed by you based on a third party claim. You may
-not use the name "IBM" or any other IBM trademark without the prior
-written consent of IBM.
-
-You agree to distribute the Software and any Software Derivatives under
-a license agreement that: 1) is sufficient to notify all licensees of
-the Software and Software Derivatives that IBM assumes no liability for
-any claim that may arise regarding the Software or Software
-Derivatives, and 2) that disclaims all warranties, both express and
-implied, from IBM regarding the Software and Software Derivatives. (If
-you include this Agreement with any distribution of the Software or
-Software Derivatives you will have met this requirement.) You agree
-that you will not delete any copyright notices in the Software.
-
-In the event an intellectual property claim is made or appears likely
-to be made with respect to the Software, you agree to permit IBM to
-enable you to continue to use the Software, or to modify it, or replace
-it with software that is at least functionally equivalent. If IBM
-determines that none of these alternatives is reasonably available, you
-agree, at IBM's request, upon notice to you, to discontinue further
-distribution of the Software and to delete or destroy all copies of the
-Software you possess. This is IBM's entire obligation to you regarding
-any claim of infringement.
-
-This Agreement is the exclusive statement of your rights in the
-Software as provided by IBM. Except for the licenses granted to you in
-the second paragraph above, no other licenses are granted hereunder, by
-estoppel, implication or otherwise.
+IBM PUBLIC LICENSE VERSION 1.0 6/14/1999 - SECURE MAILER
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE
+PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+ a) in the case of International Business Machines Corporation ("IBM"),
+ the Original Program, and
+ b) in the case of each Contributor,
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate
+ from and are distributed by that particular Contributor.
+ A Contribution 'originates' from a Contributor if it was added
+ to the Program by such Contributor itself or anyone acting on
+ such Contributor's behalf.
+ Contributions do not include additions to the Program which:
+ (i) are separate modules of software distributed in conjunction
+ with the Program under their own license agreement, and
+ (ii) are not derivative works of the Program.
+
+"Contributor" means IBM and any other entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Original Program" means the original version of the software accompanying
+this Agreement as released by IBM, including source code, object code
+and documentation, if any.
+
+"Program" means the Original Program and Contributions.
+
+"Recipient" means anyone who receives the Program under this Agreement,
+including all Contributors.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare derivative works of, publicly display,
+ publicly perform, distribute and sublicense the Contribution of such
+ Contributor, if any, and such derivative works, in source code and
+ object code form.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in source code and object code form. This patent license
+ shall apply to the combination of the Contribution and the Program
+ if, at the time the Contribution is added by the Contributor, such
+ addition of the Contribution causes such combination to be covered
+ by the Licensed Patents. The patent license shall not apply to any
+ other combinations which include the Contribution. No hardware per
+ se is licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the rights
+ and licenses granted hereunder, each Recipient hereby assumes sole
+ responsibility to secure any other intellectual property rights
+ needed, if any. For example, if a third party patent license
+ is required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before distributing
+ the Program.
+
+ d) Each Contributor represents that to its knowledge it has sufficient
+ copyright rights in its Contribution, if any, to grant the copyright
+ license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+ a) it complies with the terms and conditions of this Agreement; and
+ b) its license agreement:
+ i) effectively disclaims on behalf of all Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+ ii) effectively excludes on behalf of all Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+ iii) states that any provisions which differ from this Agreement
+ are offered by that Contributor alone and not by any other
+ party; and
+ iv) states that source code for the Program is available from
+ such Contributor, and informs licensees how to obtain it in a
+ reasonable manner on or through a medium customarily used for
+ software exchange.
+
+When the Program is made available in source code form:
+ a) it must be made available under this Agreement; and
+ b) a copy of this Agreement must be included with each copy of the
+ Program.
+
+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.
+
+In addition, each Contributor must identify itself as the originator of
+its Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program, the
+Contributor who includes the Program in a commercial product offering
+should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in
+a commercial product offering, such Contributor ("Commercial Contributor")
+hereby agrees to defend and indemnify every other Contributor
+("Indemnified Contributor") against any losses, damages and costs
+(collectively "Losses") arising from claims, lawsuits and other legal
+actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor
+in connection with its distribution of the Program in a commercial
+product offering. The obligations in this section do not apply to any
+claims or Losses relating to any actual or alleged intellectual property
+infringement. In order to qualify, an Indemnified Contributor must:
+ a) promptly notify the Commercial Contributor in writing of such claim,
+and
+ b) allow the Commercial Contributor to control, and cooperate with
+ the Commercial Contributor in, the defense and any related
+ settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay those
+damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED
+ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
+EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
+CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
+PARTICULAR PURPOSE. Each Recipient is solely responsible for determining
+the appropriateness of using and distributing the Program and assumes
+all risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION
+OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against a Contributor with
+respect to a patent applicable to software (including a cross-claim or
+counterclaim in a lawsuit), then any patent licenses granted by that
+Contributor to such Recipient under this Agreement shall terminate
+as of the date such litigation is filed. In addition, If Recipient
+institutes patent litigation against any entity (including a cross-claim
+or counterclaim in a lawsuit) alleging that the Program itself (excluding
+combinations of the Program with other software or hardware) infringes
+such Recipient's patent(s), then such Recipient's rights granted under
+Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails
+to comply with any of the material terms or conditions of this Agreement
+and does not cure such failure in a reasonable period of time after
+becoming aware of such noncompliance. If all Recipient's rights under
+this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's
+obligations under this Agreement and any licenses granted by Recipient
+relating to the Program shall continue and survive.
+
+IBM may publish new versions (including revisions) of this Agreement
+from time to time. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement under
+which it was received. In addition, after a new version of the Agreement
+is published, Contributor may elect to distribute the Program (including
+its Contributions) under the new version. No one other than IBM has the
+right to modify this Agreement. Except as expressly stated in Sections
+2(a) and 2(b) above, Recipient receives no rights or licenses to the
+intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the
+Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the
+intellectual property laws of the United States of America. No party to
+this Agreement will bring a legal action under this Agreement more than
+one year after the cause of action arose. Each party waives its rights
+to a jury trial in any resulting litigation.
#alias_database = hash:/etc/aliases
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
+# DELIVERED-TO
+#
+# The prepend_delivered_header controls when Postfix should prepend
+# a Delivered-To: message header.
+#
+# By default, Postfix prepends a Delivered-To: header when forwarding
+# mail and when delivering to file (mailbox) or command. Turning off
+# the Delivered-To: header when forwarding mail is not recommended.
+#
+# prepend_delivered_header = command, file, forward
+# prepend_delivered_header = forward
+
# ADDRESS EXTENSIONS (e.g., user+foo)
#
# The recipient_delimiter parameter specifies the separator between
+++ /dev/null
-2bounce_notice_recipient = postmaster
-access_map_reject_code = 554
-alias_database = hash:/etc/aliases
-alias_maps = hash:/etc/aliases
-allow_mail_to_commands = alias,forward
-allow_mail_to_files = alias,forward
-allow_percent_hack = yes
-always_bcc =
-append_at_myorigin = yes
-append_dot_mydomain = yes
-best_mx_transport =
-biff = yes
-bounce_notice_recipient = postmaster
-bounce_size_limit = 50000
-canonical_maps =
-command_directory = $program_directory
-command_expansion_filter = 1234567890!@%-_=+:,./abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
-command_time_limit = 1000
-daemon_directory = $program_directory
-daemon_timeout = 18000
-debug_peer_level = 2
-debug_peer_list =
-default_database_type = hash
-default_destination_concurrency_limit = 10
-default_destination_recipient_limit = 50
-default_privs = nobody
-default_process_limit = 50
-default_transport = smtp
-defer_transports =
-delay_notice_recipient = postmaster
-delay_warning_time = 0
-deliver_lock_attempts = 5
-deliver_lock_delay = 1
-disable_dns_lookups = no
-dont_remove = 0
-double_bounce_sender = double-bounce
-duplicate_filter_limit = 1000
-empty_address_recipient = MAILER-DAEMON
-error_notice_recipient = postmaster
-fallback_relay =
-fallback_transport =
-fork_attempts = 5
-fork_delay = 1
-forward_path = $home/.forward${recipient_delimiter}${extension},$home/.forward
-hash_queue_depth = 2
-hash_queue_names = defer
-header_checks =
-header_size_limit = 102400
-home_mailbox =
-hopcount_limit = 50
-ignore_mx_lookup_error = no
-inet_interfaces = all
-initial_destination_concurrency = 5
-invalid_hostname_reject_code = 501
-ipc_idle = 100
-ipc_timeout = 3600
-line_length_limit = 2048
-local_command_shell =
-local_destination_concurrency_limit = $default_destination_concurrency_limit
-local_destination_recipient_limit = $default_destination_recipient_limit
-luser_relay =
-mail_name = Postfix
-mail_owner = postfix
-mail_spool_directory = /var/mail
-mail_version = Beta-19990601
-mailbox_command =
-mailbox_transport =
-maps_rbl_domains = rbl.maps.vix.com
-maps_rbl_reject_code = 554
-masquerade_domains =
-masquerade_exceptions =
-max_idle = 100
-max_use = 100
-maximal_backoff_time = 4000
-maximal_queue_lifetime = 5
-message_size_limit = 10240000
-minimal_backoff_time = 1000
-mydestination = $myhostname, localhost.$mydomain
-myorigin = $myhostname
-non_fqdn_reject_code = 504
-notify_classes = resource,software
-owner_request_special = yes
-process_id_directory = pid
-program_directory = /usr/libexec/postfix
-propagate_unmatched_extensions = canonical, virtual
-qmgr_message_active_limit = 1000
-qmgr_message_recipient_limit = 10000
-queue_directory = /var/spool/postfix
-queue_minfree = 0
-queue_run_delay = 1000
-recipient_canonical_maps =
-recipient_delimiter =
-recipient_feature_delimiter =
-reject_code = 554
-relay_domains = $mydestination, $virtual_maps
-relay_domains_reject_code = 554
-relayhost =
-relocated_maps =
-sender_canonical_maps =
-service_throttle_time = 60
-smtp_connect_timeout = 0
-smtp_data_done_timeout = 600
-smtp_data_init_timeout = 120
-smtp_data_xfer_timeout = 180
-smtp_destination_concurrency_limit = $default_destination_concurrency_limit
-smtp_destination_recipient_limit = $default_destination_recipient_limit
-smtp_helo_timeout = 300
-smtp_mail_timeout = 300
-smtp_quit_timeout = 300
-smtp_rcpt_timeout = 300
-smtp_skip_4xx_greeting = no
-smtp_skip_quit_response = yes
-smtpd_banner = $myhostname ESMTP $mail_name
-smtpd_client_restrictions =
-smtpd_delay_reject = yes
-smtpd_error_sleep_time = 5
-smtpd_etrn_restrictions =
-smtpd_hard_error_limit = 100
-smtpd_helo_required = no
-smtpd_helo_restrictions =
-smtpd_recipient_limit = 1000
-smtpd_recipient_restrictions = permit_mynetworks,check_relay_domains
-smtpd_sender_restrictions =
-smtpd_soft_error_limit = 10
-smtpd_timeout = 300
-soft_bounce = no
-stale_lock_time = 500
-sun_mailtool_compatibility = no
-swap_bangpath = yes
-transport_maps =
-transport_retry_time = 60
-trigger_timeout = 10
-unknown_address_reject_code = 450
-unknown_client_reject_code = 450
-unknown_hostname_reject_code = 450
-virtual_maps =
$FATAL no Postfix daemon directory $daemon_directory!
exit 1
}
+test -x master || {
+ $FATAL no Postfix master program $daemon_directory/master!
+ exit 1
+}
cd $config_directory || {
$FATAL no Postfix configuration directory $config_directory!
exit 1
$FATAL no Postfix daemon directory $daemon_directory!
exit 1
}
+test -x master || {
+ $FATAL no Postfix master program $daemon_directory/master!
+ exit 1
+}
cd $config_directory || {
$FATAL no Postfix configuration directory $config_directory!
exit 1
# effect.
#
local_destination_recipient_limit = 1
+
+# DELIVERED-TO
+#
+# The prepend_delivered_header controls when Postfix should prepend
+# a Delivered-To: message header.
+#
+# By default, Postfix prepends a Delivered-To: header when forwarding
+# mail and when delivering to file (mailbox) and command. Turning off
+# the Delivered-To: header when forwarding mail is not recommended.
+#
+# prepend_delivered_header = command, file, forward
+# prepend_delivered_header = forward
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
all: $(LIB)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
all: $(PROG)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
fsstone: fsstone.o $(LIBS)
$(CC) $(CFLAGS) -o $@ fsstone.o $(LIBS) $(SYSLIBS)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
recipient_list.c record.c remove.c resolve_clnt.c resolve_local.c \
rewrite_clnt.c sent.c smtp_stream.c split_addr.c string_list.c \
sys_exits.c timed_ipc.c tok822_find.c tok822_node.c tok822_parse.c \
- tok822_resolve.c tok822_rewrite.c tok822_tree.c ext_prop.c
+ tok822_resolve.c tok822_rewrite.c tok822_tree.c ext_prop.c \
+ dot_lockfile_as.c
OBJS = been_here.o bounce.o canon_addr.o cleanup_strerror.o clnt_stream.o \
debug_peer.o debug_process.o defer.o deliver_completed.o \
deliver_flock.o deliver_pass.o deliver_request.o domain_list.o \
recipient_list.o record.o remove.o resolve_clnt.o resolve_local.o \
rewrite_clnt.o sent.o smtp_stream.o split_addr.o string_list.o \
sys_exits.o timed_ipc.o tok822_find.o tok822_node.o tok822_parse.o \
- tok822_resolve.o tok822_rewrite.o tok822_tree.o ext_prop.o
+ tok822_resolve.o tok822_rewrite.o tok822_tree.o ext_prop.o \
+ dot_lockfile_as.o
HDRS = been_here.h bounce.h canon_addr.h cleanup_user.h clnt_stream.h \
config.h debug_peer.h debug_process.h defer.h deliver_completed.h \
deliver_flock.h deliver_pass.h deliver_request.h domain_list.h \
quote_822_local.h rec_streamlf.h rec_type.h recipient_list.h \
record.h resolve_clnt.h resolve_local.h rewrite_clnt.h sent.h \
smtp_stream.h split_addr.h string_list.h sys_exits.h timed_ipc.h \
- tok822.h ext_prop.h
+ tok822.h ext_prop.h dot_lockfile_as.h
TESTSRC = rec2stream.c stream2rec.c recdump.c
WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
-Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
all: $(LIB)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
dot_lockfile.o: ../include/mymalloc.h
dot_lockfile.o: mail_params.h
dot_lockfile.o: dot_lockfile.h
+dot_lockfile_as.o: dot_lockfile_as.c
+dot_lockfile_as.o: ../include/sys_defs.h
+dot_lockfile_as.o: ../include/msg.h
+dot_lockfile_as.o: ../include/set_eugid.h
+dot_lockfile_as.o: dot_lockfile.h
+dot_lockfile_as.o: ../include/vstring.h
+dot_lockfile_as.o: ../include/vbuf.h
+dot_lockfile_as.o: dot_lockfile_as.h
ext_prop.o: ext_prop.c
ext_prop.o: ../include/sys_defs.h
ext_prop.o: ../include/name_mask.h
if (unlink(lock_file) < 0)
if (errno != ENOENT)
break;
+ errno = EEXIST;
}
if (status && why)
vstring_sprintf(why, "unable to create lock file %s: %m", lock_file);
--- /dev/null
+/*++
+/* NAME
+/* dot_lockfile_as 3
+/* SUMMARY
+/* dotlock file as user
+/* SYNOPSIS
+/* #include <dot_lockfile_as.h>
+/*
+/* int dot_lockfile_as(path, why, euid, egid)
+/* const char *path;
+/* VSTRING *why;
+/* uid_t euid;
+/* gid_t egid;
+/*
+/* void dot_unlockfile_as(path, euid, egid)
+/* const char *path;
+/* uid_t euid;
+/* gid_t egid;
+/* DESCRIPTION
+/* dot_lockfile_as() and dot_unlockfile_as() are wrappers around
+/* the dot_lockfile() and dot_unlockfile() routines. The routines
+/* change privilege to the designated privilege, perform the
+/* requested operation, and restore privileges.
+/* DIAGNOSTICS
+/* Fatal error: no permission to change privilege level.
+/* SEE ALSO
+/* dot_lockfile(3) dotlock file management
+/* set_eugid(3) switch effective rights
+/* LICENSE
+/* .ad
+/* .fi
+/* 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
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <unistd.h>
+
+/* Utility library. */
+
+#include "msg.h"
+#include "set_eugid.h"
+#include "dot_lockfile.h"
+#include "dot_lockfile_as.h"
+
+/* dot_lockfile_as - dotlock file as user */
+
+int dot_lockfile_as(const char *path, VSTRING *why, uid_t euid, gid_t egid)
+{
+ uid_t saved_euid = geteuid();
+ gid_t saved_egid = getegid();
+ int result;
+
+ /*
+ * Switch to the target user privileges.
+ */
+ set_eugid(euid, egid);
+
+ /*
+ * Lock that file.
+ */
+ result = dot_lockfile(path, why);
+
+ /*
+ * Restore saved privileges.
+ */
+ set_eugid(saved_euid, saved_egid);
+
+ return (result);
+}
+
+/* dot_unlockfile_as - dotlock file as user */
+
+void dot_unlockfile_as(const char *path, uid_t euid, gid_t egid)
+{
+ uid_t saved_euid = geteuid();
+ gid_t saved_egid = getegid();
+
+ /*
+ * Switch to the target user privileges.
+ */
+ set_eugid(euid, egid);
+
+ /*
+ * Lock that file.
+ */
+ dot_unlockfile(path);
+
+ /*
+ * Restore saved privileges.
+ */
+ set_eugid(saved_euid, saved_egid);
+}
--- /dev/null
+#ifndef _DOT_LOCKFILE_AS_H_INCLUDED_
+#define _DOT_LOCKFILE_AS_H_INCLUDED_
+
+/*++
+/* NAME
+/* dot_lockfile_as 3h
+/* SUMMARY
+/* dotlock file management
+/* SYNOPSIS
+/* #include <dot_lockfile_as.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+ * Utility library.
+ */
+#include <vstring.h>
+
+ /*
+ * External interface.
+ */
+extern int dot_lockfile_as(const char *, VSTRING *, uid_t, gid_t);
+extern void dot_unlockfile_as(const char *, uid_t, gid_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/* 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
+/*--*/
+
+#endif
VAR_MAX_IDLE, DEF_MAX_IDLE, &var_idle_limit, 1, 0,
VAR_IPC_TIMEOUT, DEF_IPC_TIMEOUT, &var_ipc_timeout, 1, 0,
VAR_DONT_REMOVE, DEF_DONT_REMOVE, &var_dont_remove, 0, 0,
- VAR_LINE_LIMIT, DEF_LINE_LIMIT, &var_line_limit, 1024, 0,
+ VAR_LINE_LIMIT, DEF_LINE_LIMIT, &var_line_limit, 512, 0,
VAR_MESSAGE_LIMIT, DEF_MESSAGE_LIMIT, &var_message_limit, 0, 0,
VAR_IPC_IDLE, DEF_IPC_IDLE, &var_ipc_idle_limit, 1, 0,
VAR_HASH_QUEUE_DEPTH, DEF_HASH_QUEUE_DEPTH, &var_hash_queue_depth, 1, 0,
ABCDEFGHIJKLMNOPQRSTUVWXYZ"
extern char *var_cmd_exp_filter;
-#define VAR_RCPT_FDELIM "recipient_feature_delimiter"
-#define DEF_RCPT_FDELIM ""
-extern char *var_rcpt_fdelim;
+#define VAR_DELIVER_HDR "prepend_delivered_header"
+#define DEF_DELIVER_HDR "command, file, forward"
+extern char *var_deliver_hdr;
+
+#define VAR_EXP_OWN_ALIAS "expand_owner_alias"
+#define DEF_EXP_OWN_ALIAS 0
+extern bool var_exp_own_alias;
/*
* Queue manager: maximal size of the duplicate expansion filter. By
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "Beta-19990601"
+#define DEF_MAIL_VERSION "Snapshot-19990627"
extern char *var_mail_version;
/* LICENSE
*/
close(cmd_in_pipe[1]);
close(cmd_out_pipe[0]);
- if (dup2(cmd_in_pipe[0], STDIN_FILENO) < 0
- || dup2(cmd_out_pipe[1], STDOUT_FILENO) < 0
- || dup2(cmd_out_pipe[1], STDERR_FILENO) < 0)
+ if (DUP2(cmd_in_pipe[0], STDIN_FILENO) < 0
+ || DUP2(cmd_out_pipe[1], STDOUT_FILENO) < 0
+ || DUP2(cmd_out_pipe[1], STDERR_FILENO) < 0)
msg_fatal("%s: dup2: %m", myname);
close(cmd_in_pipe[0]);
close(cmd_out_pipe[1]);
update: $(DAEMONS) $(COMMANDS) $(CONFIG)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
clean:
echo clean
<a name="delivered"><h2>Getting rid of Delivered-To:</h2> </a>
-Some people will complain about the ugly <b>Delivered-To:</b>
-message header that Postfix prepends to their mail.
+Some people will complain about the ugly <b>Delivered-To:</b>
+message header that Postfix prepends to their mail. By default,
+Postfix prepends this header when forwarding mail, and when delivering
+to file (mailbox) or command. The purpose is to stop mail forwarding
+loops as early as possible, that is, before they have a chance to
+happen. But the header is ugly, no question about it.
<p>
-With the Postfix architecture, <b>Delivered-To:</b> is required to
-prevent mail forwarding loops. Fortunately, many mail user agents
-have per-user or even system-wide configuration files that can be
-set up to suppress specific message headers (for example <b>~/.mailrc</b>
-and <b>/usr/lib/Mail.rc</b>).
+Solutions, ranging from fighting symptoms to turning off the
+<b>Delivered-To:</b> header:
<p>
+<ul>
+
+<li>
+
+Fortunately, many mail user agents have per-user or even system-wide
+configuration files that can be set up to suppress specific message
+headers (for example <b>~/.mailrc</b> and <b>/usr/lib/Mail.rc</b>).
+
+<p>
+
+<li>
+
With mailing lists, <b>Delivered-To:</b> can get in the way when
the list exploder uses a "secret" alias that should not be shown
in outbound mail. The recommended solution is to use a regular
<p>
+<li>
+
+The <b>prepend_delivered_header</b> configuration parameter controls
+when <b>Delivered-To:</b> is prepended. The default setting is
+<b>command, file, forward</b>. <i>Turning off <b>Delivered-To:</b>
+when forwarding mail is not recommended</i>.
+
+</ul>
+
+<p>
+
See also the FAQ item for problems with the <b>majordomo</b> <a
href="#approve">approve</a> command.
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 a <b>Delivered-To:</b> header with the
- envelope recipient address, prepends a <b>Return-Path:</b> header
- with the envelope sender address, prepends a > character
- to lines beginning with "<b>From</b> ", and appends an empty
- line. The mailbox is locked for exclusive access while
+ 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
+ > character to lines beginning with "<b>From</b> ", and appends
+ an empty line. The mailbox is locked for exclusive access
LOCAL(8) LOCAL(8)
- delivery is in progress. In case of problems, an attempt
- is made to truncate the mailbox to its original length.
+ while delivery is in progress. In case of problems, an
+ attempt is made to truncate the mailbox to its original
+ length.
In the case of <b>maildir</b> delivery, the local daemon prepends
- a <b>Delivered-To:</b> header with the envelope recipient address
- and prepends a <b>Return-Path:</b> header with the envelope
- sender address.
+ an optional <b>Delivered-To:</b> header with the envelope recipi-
+ ent address and prepends a <b>Return-Path:</b> header with the
+ envelope sender address.
<b>EXTERNAL</b> <b>COMMAND</b> <b>DELIVERY</b>
- The <b>allow</b><i>_</i><b>mail</b><i>_</i><b>to</b><i>_</i><b>commands</b> configuration parameter
- restricts delivery to external commands. The default set-
- ting (<b>alias,</b> <b>forward</b>) forbids command destinations in
+ The <b>allow</b><i>_</i><b>mail</b><i>_</i><b>to</b><i>_</i><b>commands</b> configuration parameter
+ restricts delivery to external commands. The default set-
+ ting (<b>alias,</b> <b>forward</b>) forbids command destinations in
<b>:include:</b> files.
- The command is executed directly where possible. Assis-
- tance by the shell (<b>/bin/sh</b> on UNIX systems) is used only
- when the command contains shell magic characters, or when
+ The command is executed directly where possible. Assis-
+ tance by the shell (<b>/bin/sh</b> on UNIX systems) is used only
+ when the command contains shell magic characters, or when
the command invokes a shell built-in command.
- A limited amount of command output (standard output and
- standard error) is captured for inclusion with non-deliv-
- ery status reports. A command is forcibly terminated if
- it does not complete within <b>command</b><i>_</i><b>time</b><i>_</i><b>limit</b> seconds.
- Command exit status codes are expected to follow the con-
+ A limited amount of command output (standard output and
+ standard error) is captured for inclusion with non-deliv-
+ ery status reports. A command is forcibly terminated if
+ it does not complete within <b>command</b><i>_</i><b>time</b><i>_</i><b>limit</b> seconds.
+ Command exit status codes are expected to follow the con-
ventions defined in <<b>sysexits.h</b>>.
- A limited amount of message context is exported via envi-
- ronment variables. Characters that may have special mean-
+ A limited amount of message context is exported via envi-
+ ronment variables. Characters that may have special mean-
ing to the shell are replaced by underscores. The list of
acceptable characters is specified with the <b>command</b><i>_</i><b>expan-</b>
<b>sion</b><i>_</i><b>filter</b> configuration parameter.
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
LOCAL(8) LOCAL(8)
+ dependent default path, and the <b>TZ</b> (time zone) environment
variable is always passed on without change.
The current working directory is the mail queue directory.
The <b>local</b> daemon prepends a "<b>From</b> <i>sender</i> <i>time_stamp</i>" enve-
- lope header to each message, prepends a <b>Delivered-To:</b>
- header with the recipient envelope address, prepends a
- <b>Return-Path:</b> header with the sender envelope address, and
- appends an empty line.
+ lope header to each message, prepends an optional <b>Deliv-</b>
+ <b>ered-To:</b> header with the recipient envelope address,
+ prepends a <b>Return-Path:</b> header with the sender envelope
+ address, and appends an empty line.
<b>EXTERNAL</b> <b>FILE</b> <b>DELIVERY</b>
- The <b>allow</b><i>_</i><b>mail</b><i>_</i><b>to</b><i>_</i><b>files</b> configuration parameter restricts
- delivery to external files. The default setting (<b>alias,</b>
- <b>forward</b>) forbids file destinations in <b>:include:</b> files.
+ The <b>allow</b><i>_</i><b>mail</b><i>_</i><b>to</b><i>_</i><b>files</b> configuration parameter restricts
+ delivery to external files. The default setting (<b>alias,</b>
+ <b>forward</b>) forbids file destinations in <b>:include:</b> files.
Specify a pathname ending in <b>/</b> for <b>qmail</b>-compatible
<b>maildir</b> delivery.
The <b>local</b> daemon prepends a "<b>From</b> <i>sender</i> <i>time_stamp</i>" enve-
- lope header to each message, prepends a <b>Delivered-To:</b>
- header with the recipient envelope address, prepends a >
- character to lines beginning with "<b>From</b> ", and appends an
- empty line. The envelope sender address is available in
- the <b>Return-Path:</b> header. When the destination is a regu-
- lar file, it is locked for exclusive access while delivery
- is in progress. In case of problems, an attempt is made to
- truncate a regular file to its original length.
+ lope header to each message, prepends an optional <b>Deliv-</b>
+ <b>ered-To:</b> header with the recipient envelope address,
+ prepends a > character to lines beginning with "<b>From</b> ",
+ and appends an empty line. The envelope sender address is
+ available in the <b>Return-Path:</b> header. When the destina-
+ tion is a regular file, it is locked for exclusive access
+ while delivery is in progress. In case of problems, an
+ attempt is made to truncate a regular file to its original
+ length.
In the case of <b>maildir</b> delivery, the local daemon prepends
- a <b>Delivered-To:</b> header with the envelope recipient
- address. The envelope sender address is available in the
- <b>Return-Path:</b> header.
+ an optional <b>Delivered-To:</b> header with the envelope recipi-
+ ent address. The envelope sender address is available in
+ the <b>Return-Path:</b> header.
<b>ADDRESS</b> <b>EXTENSION</b>
The optional <b>recipient</b><i>_</i><b>delimiter</b> configuration parameter
<b>ward</b>+<i>foo</i> or in ~<i>name</i>/.<b>forward</b>, to the mailbox owned by the
user <i>name</i>, or it is sent back as undeliverable.
- In all cases the <b>local</b> daemon prepends a `<b>Delivered-To:</b>
- <i>name</i>+<i>foo</i>' header line.
+ In all cases the <b>local</b> daemon prepends an opional `<b>Deliv-</b>
+ <b>ered-To:</b> <i>name</i>+<i>foo</i>' header line.
<b>DELIVERY</b> <b>RIGHTS</b>
Deliveries to external files and external commands are
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.
LOCAL(8) LOCAL(8)
+ superuser, delivery is made with the rights specified with
+ the <b>default</b><i>_</i><b>privs</b> configuration parameter.
+
<b>STANDARDS</b>
RFC 822 (ARPA Internet Text Messages)
<b>alias</b><i>_</i><b>maps</b>
List of alias databases.
+ <b>expand</b><i>_</i><b>owner</b><i>_</i><b>alias</b>
+ When delivering to an alias that has an owner- com-
+ panion alias, set the envelope sender address to
+ the right-hand side of the owner alias, instead
+ using of the left-hand side address.
+
<b>forward</b><i>_</i><b>path</b>
Search list for .forward files. The names are sub-
ject to <i>$name</i> expansion.
<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
+ 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-
+ tains 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>recipient</b><i>_</i><b>delimiter</b>
- Separator between username and address extension.
-
-<b>Mailbox</b> <b>delivery</b>
- <b>fallback</b><i>_</i><b>transport</b>
- Message transport for recipients that are not found
LOCAL(8) LOCAL(8)
- in the UNIX passwd database. This parameter over-
+ <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>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>recipient</b><i>_</i><b>delimiter</b>
+ Separator between username and address extension.
+
+<b>Mailbox</b> <b>delivery</b>
+ <b>fallback</b><i>_</i><b>transport</b>
+ Message transport for recipients that are not found
+ in the UNIX passwd database. This parameter over-
rides <b>luser</b><i>_</i><b>relay</b>.
<b>home</b><i>_</i><b>mailbox</b>
- Pathname of a mailbox relative to a user's home
+ Pathname of a mailbox relative to a user's home
directory. Specify a path ending in <b>/</b> for maildir-
style delivery.
<b>luser</b><i>_</i><b>relay</b>
- Destination (<i>@domain</i> or <i>address</i>) for non-existent
- users. The <i>address</i> is subjected to <i>$name</i> expan-
+ Destination (<i>@domain</i> or <i>address</i>) for non-existent
+ users. The <i>address</i> is subjected to <i>$name</i> expan-
sion.
<b>mail</b><i>_</i><b>spool</b><i>_</i><b>directory</b>
- Directory with UNIX-style mailboxes. The default
+ Directory with UNIX-style mailboxes. The default
pathname is system dependent.
<b>mailbox</b><i>_</i><b>command</b>
- External command to use for mailbox delivery. The
+ External command to use for mailbox delivery. The
command executes with the recipient privileges
- (exception: root). The string is subject to $name
+ (exception: root). The string is subject to $name
expansions.
<b>mailbox</b><i>_</i><b>transport</b>
- Message transport to use for mailbox delivery to
+ Message transport to use for mailbox delivery to
all local recipients, whether or not they are found
- in the UNIX passwd database. This parameter over-
- rides all other configuration parameters that con-
+ in the UNIX passwd database. This parameter over-
+ rides all other configuration parameters that con-
trol mailbox delivery, including <b>luser</b><i>_</i><b>relay</b>.
<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 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
+ Time in seconds between successive attempts to
+
+
+
+ 6
+
+
+
+
+
+LOCAL(8) LOCAL(8)
+
+
acquire an exclusive lock.
<b>stale</b><i>_</i><b>lock</b><i>_</i><b>time</b>
<b>Resource</b> <b>controls</b>
<b>command</b><i>_</i><b>time</b><i>_</i><b>limit</b>
- Limit the amount of time for delivery to external
+ Limit the amount of time for delivery to external
command.
<b>duplicate</b><i>_</i><b>filter</b><i>_</i><b>limit</b>
- Limit the size of the duplicate filter for results
+ Limit the size of the duplicate filter for results
from alias etc. expansion.
<b>line</b><i>_</i><b>length</b><i>_</i><b>limit</b>
- Limit the amount of memory used for processing a
+ Limit the amount of memory used for processing a
partial input line.
-
-
- 6
-
-
-
-
-
-LOCAL(8) LOCAL(8)
-
-
<b>local</b><i>_</i><b>destination</b><i>_</i><b>concurrency</b><i>_</i><b>limit</b>
Limit the number of parallel deliveries to the same
- user. The default limit is taken from the
+ user. The default limit is taken from the
<b>default</b><i>_</i><b>destination</b><i>_</i><b>concurrency</b><i>_</i><b>limit</b> parameter.
<b>local</b><i>_</i><b>destination</b><i>_</i><b>recipient</b><i>_</i><b>limit</b>
- Limit the number of recipients per message deliv-
- ery. The default limit is taken from the
+ Limit the number of recipients per message deliv-
+ ery. The default limit is taken from the
<b>default</b><i>_</i><b>destination</b><i>_</i><b>recipient</b><i>_</i><b>limit</b> parameter.
<b>Security</b> <b>controls</b>
<b>allow</b><i>_</i><b>mail</b><i>_</i><b>to</b><i>_</i><b>commands</b>
- Restrict the usage of mail delivery to external
+ Restrict the usage of mail delivery to external
command.
<b>allow</b><i>_</i><b>mail</b><i>_</i><b>to</b><i>_</i><b>files</b>
- Restrict the usage of mail delivery to external
+ Restrict the usage of mail delivery to external
file.
<b>command</b><i>_</i><b>expansion</b><i>_</i><b>filter</b>
- What characters are allowed to appear in $name
- expansions of mailbox_command. Illegal characters
+ What characters are allowed to appear in $name
+ expansions of mailbox_command. Illegal characters
are replaced by underscores.
<b>default</b><i>_</i><b>privs</b>
- Default rights for delivery to external file or
+ 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
+ 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
+ The <i>maildir</i> structure appears in the <b>qmail</b> system by
Daniel Bernstein.
+
+
+
+
+ 7
+
+
+
+
+
+LOCAL(8) LOCAL(8)
+
+
<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
<a href="qmgr.8.html">qmgr(8)</a> queue manager
<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>
- 7
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 8
</pre> </body> </html>
tiple <b>-v</b> options make the software increasingly
verbose.
- B-w Do not warn about duplicate entries; silently
+ <b>-w</b> Do not warn about duplicate entries; silently
ignore them.
Arguments:
<p>
+<dt> <b><a href="#reject_maps_rbl">reject_maps_rbl</a></b>
+
<dt> <b><a href="#reject_unknown_client">reject_unknown_client</a></b>
<dt> <b><a href="#permit_mynetworks">permit_mynetworks</a></b>
<p>
+<dt> <b><a href="#reject_maps_rbl">reject_maps_rbl</a></b>
+
<dt> <b><a href="#reject_unknown_client">reject_unknown_client</a></b>
<dt> <b><a href="#permit_mynetworks">permit_mynetworks</a></b>
<p>
+<dt> <b><a href="#reject_maps_rbl">reject_maps_rbl</a></b>
+
<dt> <b><a href="#reject_unknown_client">reject_unknown_client</a></b>
<dt> <b><a href="#permit_mynetworks">permit_mynetworks</a></b>
<p>
+<dt> <b><a href="#reject_maps_rbl">reject_maps_rbl</a></b>
+
<dt> <b><a href="#reject_unknown_client">reject_unknown_client</a></b>
<dt> <b><a href="#permit_mynetworks">permit_mynetworks</a></b>
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
SHELL = /bin/sh
SRCS = alias.c command.c delivered.c dotforward.c file.c forward.c \
include.c indirect.c local.c mailbox.c recipient.c resolve.c token.c \
- deliver_attr.c feature.c maildir.c biff_notify.c unknown.c \
+ deliver_attr.c maildir.c biff_notify.c unknown.c \
local_expand.c
OBJS = alias.o command.o delivered.o dotforward.o file.o forward.o \
include.o indirect.o local.o mailbox.o recipient.o resolve.o token.o \
- deliver_attr.o feature.o maildir.o biff_notify.o unknown.o \
+ deliver_attr.o maildir.o biff_notify.o unknown.o \
local_expand.o
HDRS = local.h
TESTSRC =
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
command.o: ../include/vbuf.h
command.o: ../include/vstream.h
command.o: ../include/argv.h
-command.o: ../include/mac_expand.h
-command.o: ../include/mac_parse.h
command.o: ../include/defer.h
command.o: ../include/bounce.h
command.o: ../include/sent.h
dotforward.o: ../include/resolve_clnt.h
dotforward.o: ../include/deliver_request.h
dotforward.o: ../include/recipient_list.h
-feature.o: feature.c
-feature.o: ../include/sys_defs.h
-feature.o: ../include/msg.h
-feature.o: ../include/stringops.h
-feature.o: ../include/mymalloc.h
-feature.o: ../include/mail_params.h
-feature.o: local.h
-feature.o: ../include/htable.h
-feature.o: ../include/vstream.h
-feature.o: ../include/vbuf.h
-feature.o: ../include/vstring.h
-feature.o: ../include/been_here.h
-feature.o: ../include/tok822.h
-feature.o: ../include/resolve_clnt.h
-feature.o: ../include/deliver_request.h
-feature.o: ../include/recipient_list.h
file.o: file.c
file.o: ../include/sys_defs.h
file.o: ../include/msg.h
file.o: ../include/sent.h
file.o: ../include/been_here.h
file.o: ../include/mail_params.h
+file.o: ../include/dot_lockfile_as.h
file.o: local.h
file.o: ../include/tok822.h
file.o: ../include/resolve_clnt.h
token.o: ../include/readlline.h
token.o: ../include/mymalloc.h
token.o: ../include/vstring_vstream.h
+token.o: ../include/stringops.h
token.o: ../include/tok822.h
token.o: ../include/resolve_clnt.h
token.o: ../include/mail_params.h
+token.o: ../include/bounce.h
token.o: local.h
token.o: ../include/been_here.h
token.o: ../include/deliver_request.h
struct mypasswd *alias_pwd;
VSTRING *canon_owner;
DICT *dict;
+ const char *owner_rhs; /* owner alias, RHS */
/*
* Make verbose logging easier to understand.
concatenate("owner-", name, (char *) 0)))
expansion = mystrdup(alias_result);
- if (OWNER_ASSIGN(owner) != 0 && maps_find(maps, owner,
- DICT_FLAG_FIXED)) {
- canon_owner = canon_addr_internal(vstring_alloc(10), owner);
+ if (OWNER_ASSIGN(owner) != 0
+ && (owner_rhs = maps_find(maps, owner, DICT_FLAG_FIXED)) != 0) {
+ canon_owner = canon_addr_internal(vstring_alloc(10),
+ var_exp_own_alias ? owner_rhs : owner);
SET_OWNER_ATTR(state.msg_attr, STR(canon_owner), state.level);
} else {
canon_owner = 0;
* Deliver.
*/
copy_flags = MAIL_COPY_FROM | MAIL_COPY_RETURN_PATH;
- if ((state.msg_attr.features & FEATURE_NODELIVERED) == 0)
+ if (local_deliver_hdr_mask & DELIVER_HDR_CMD)
copy_flags |= MAIL_COPY_DELIVERED;
why = vstring_alloc(1);
attrp->relay = 0;
attrp->exp_type = 0;
attrp->exp_from = 0;
- attrp->features = 0;
}
/* deliver_attr_dump - log message delivery attributes */
msg_info("relay: %s", attrp->relay ? attrp->relay : "null");
msg_info("exp_type: %d", attrp->exp_type);
msg_info("exp_from: %s", attrp->exp_from ? attrp->exp_from : "null");
- msg_info("features: %d", attrp->features);
}
* these are the rights of root, the /file and |command delivery routines
* will use unprivileged default rights instead. Better safe than sorry.
*/
- if (mypwd->pw_uid != 0)
SET_USER_ATTR(usr_attr, mypwd, state.level);
/*
+++ /dev/null
-/*++
-/* NAME
-/* feature 3
-/* SUMMARY
-/* toggle features depending on address
-/* SYNOPSIS
-/* #include "local.h"
-/*
-/* int feature_control(state)
-/* LOCAL_STATE state;
-/* DESCRIPTION
-/* feature_control() breaks the localpart of the recipient
-/* address up into fields, according to the recipient feature
-/* delimiter, and turns on/off the features as encountered.
-/*
-/* Arguments:
-/* .IP state
-/* The attributes that specify the message, recipient and more.
-/* Attributes describing the alias, include or forward expansion.
-/* A table with the results from expanding aliases or lists.
-/* LICENSE
-/* .ad
-/* .fi
-/* 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
-/*--*/
-
-/* System library. */
-
-#include <sys_defs.h>
-#include <string.h>
-
-#ifdef STRCASECMP_IN_STRINGS_H
-#include <strings.h>
-#endif
-
-/* Utility library. */
-
-#include <msg.h>
-#include <stringops.h>
-#include <mymalloc.h>
-
-/* Global library. */
-
-#include <mail_params.h>
-
-/* Application-specific. */
-
-#include "local.h"
-
-struct feature_map {
- char *name;
- int mask;
-};
-
-static struct feature_map feature_map[] = {
- "nodelivered", FEATURE_NODELIVERED,
- 0,
-};
-
-/* feature_control - extract delivery options from recipient localpart */
-
-int feature_control(const char *localpart)
-{
- struct feature_map *mp;
- char *saved_localpart;
- char *ptr;
- int mask = 0;
- char *cp;
-
- if (*var_rcpt_fdelim) {
- ptr = saved_localpart = mystrdup(localpart);
- while ((cp = mystrtok(&ptr, var_rcpt_fdelim)) != 0) {
- for (mp = feature_map; mp->name; mp++)
- if (strcasecmp(mp->name, cp) == 0) {
- if (msg_verbose)
- msg_info("feature: %s", mp->name);
- mask |= mp->mask;
- break;
- }
- }
- myfree(saved_localpart);
- }
- if (msg_verbose)
- msg_info("features: 0x%x", mask);
- return (mask);
-}
#include <sent.h>
#include <been_here.h>
#include <mail_params.h>
+#include <dot_lockfile_as.h>
/* Application-specific. */
int status;
int copy_flags;
+#ifdef USE_DOT_LOCK
+ int lock = -1;
+
+#endif
+
/*
* Make verbose logging easier to understand.
*/
* existing file.
*/
copy_flags = MAIL_COPY_MBOX;
- if (state.msg_attr.features & FEATURE_NODELIVERED)
+ if ((local_deliver_hdr_mask & DELIVER_HDR_FILE) == 0)
copy_flags &= ~MAIL_COPY_DELIVERED;
#define FOPEN_AS(p,u,g) ( \
vstream_fclose(dst);
status = bounce_append(BOUNCE_FLAG_KEEP, BOUNCE_ATTR(state.msg_attr),
"executable destination file %s", path);
+#ifdef USE_DOT_LOCK
+ } else if ((lock = dot_lockfile_as(path, why, usr_attr.uid, usr_attr.gid)) < 0
+ && errno == EEXIST) {
+ vstream_fclose(dst);
+ status = defer_append(BOUNCE_FLAG_KEEP, BOUNCE_ATTR(state.msg_attr),
+ "cannot append destination file %s: %s",
+ path, STR(why));
+#endif
} else if (mail_copy(COPY_ATTR(state.msg_attr), dst, S_ISREG(st.st_mode) ?
copy_flags : (copy_flags & ~MAIL_COPY_TOFILE), why)) {
status = defer_append(BOUNCE_FLAG_KEEP, BOUNCE_ATTR(state.msg_attr),
/*
* Clean up.
*/
+#ifdef USE_DOT_LOCK
+ if (lock == 0)
+ dot_unlockfile_as(path, usr_attr.uid, usr_attr.gid);
+#endif
vstring_free(why);
return (status);
}
var_myhostname, var_mail_name);
rec_fprintf(info->cleanup, REC_TYPE_NORM, "\tid %s; %s",
info->queue_id, mail_date(info->posting_time));
- rec_fprintf(info->cleanup, REC_TYPE_NORM, "Delivered-To: %s",
- lowercase(vstring_str(buffer)));
+ if (local_deliver_hdr_mask & DELIVER_HDR_FWD)
+ rec_fprintf(info->cleanup, REC_TYPE_NORM, "Delivered-To: %s",
+ lowercase(vstring_str(buffer)));
if ((status = vstream_ferror(info->cleanup)) == 0)
if (vstream_fseek(attr.fp, attr.offset, SEEK_SET) < 0)
msg_fatal("%s: seek queue file %s: %m:",
/*
/* In the case of UNIX-style mailbox delivery,
/* the \fBlocal\fR daemon prepends a "\fBFrom \fIsender time_stamp\fR"
-/* envelope header to each message, prepends a \fBDelivered-To:\fR header
+/* envelope header to each message, prepends an
+/* optional \fBDelivered-To:\fR header
/* with the envelope recipient address, prepends a \fBReturn-Path:\fR
/* header with the envelope sender address, prepends a \fB>\fR character
/* to lines beginning with "\fBFrom \fR", and appends an empty line.
/* mailbox to its original length.
/*
/* In the case of \fBmaildir\fR delivery, the local daemon prepends
-/* a \fBDelivered-To:\fR header with the envelope recipient address
+/* an optional
+/* \fBDelivered-To:\fR header with the envelope recipient address
/* and prepends a \fBReturn-Path:\fR header with the envelope sender
/* address.
/* EXTERNAL COMMAND DELIVERY
/* The current working directory is the mail queue directory.
/*
/* The \fBlocal\fR daemon prepends a "\fBFrom \fIsender time_stamp\fR"
-/* envelope header to each message, prepends a \fBDelivered-To:\fR
+/* envelope header to each message, prepends an
+/* optional \fBDelivered-To:\fR
/* header with the recipient envelope address, prepends a
/* \fBReturn-Path:\fR header with the sender envelope address,
/* and appends an empty line.
/* \fBmaildir\fR delivery.
/*
/* The \fBlocal\fR daemon prepends a "\fBFrom \fIsender time_stamp\fR"
-/* envelope header to each message, prepends a \fBDelivered-To:\fR
+/* envelope header to each message, prepends an
+/* optional \fBDelivered-To:\fR
/* header with the recipient envelope address, prepends a \fB>\fR
/* character to lines beginning with "\fBFrom \fR", and appends an
/* empty line.
/* is made to truncate a regular file to its original length.
/*
/* In the case of \fBmaildir\fR delivery, the local daemon prepends
-/* a \fBDelivered-To:\fR header with the envelope recipient address.
+/* an optional
+/* \fBDelivered-To:\fR header with the envelope recipient address.
/* The envelope sender address is available in the \fBReturn-Path:\fR
/* header.
/* ADDRESS EXTENSION
/* to the mailbox owned by the user \fIname\fR, or it is sent back as
/* undeliverable.
/*
-/* In all cases the \fBlocal\fR daemon prepends a
+/* In all cases the \fBlocal\fR daemon prepends an opional
/* `\fBDelivered-To:\fR \fIname\fR+\fIfoo\fR' header line.
/* DELIVERY RIGHTS
/* .ad
/* .fi
/* .IP \fBalias_maps\fR
/* List of alias databases.
+/* .IP \fBexpand_owner_alias\fR
+/* When delivering to an alias that has an owner- companion alias,
+/* set the envelope sender address to the right-hand side of the
+/* owner alias, instead using of the left-hand side address.
/* .IP \fBforward_path\fR
/* Search list for .forward files. The names are subject to \fI$name\fR
/* expansion.
/* /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 \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.
char *var_forward_path;
char *var_cmd_exp_filter;
char *var_prop_extension;
+int var_exp_own_alias;
+char *var_deliver_hdr;
int local_cmd_deliver_mask;
int local_file_deliver_mask;
int local_ext_prop_mask;
+int local_deliver_hdr_mask;
/* local_deliver - deliver message with extreme prejudice */
"include", EXPAND_TYPE_INCL,
0,
};
+ static NAME_MASK deliver_mask[] = {
+ "command", DELIVER_HDR_CMD,
+ "file", DELIVER_HDR_FILE,
+ "forward", DELIVER_HDR_FWD,
+ 0,
+ };
local_file_deliver_mask = name_mask(file_mask, var_allow_files);
local_cmd_deliver_mask = name_mask(command_mask, var_allow_commands);
local_ext_prop_mask = ext_prop_mask(var_prop_extension);
+ local_deliver_hdr_mask = name_mask(deliver_mask, var_deliver_hdr);
}
/* pre_accept - see if tables have changed */
VAR_HOME_MAILBOX, DEF_HOME_MAILBOX, &var_home_mailbox, 0, 0,
VAR_ALLOW_COMMANDS, DEF_ALLOW_COMMANDS, &var_allow_commands, 0, 0,
VAR_ALLOW_FILES, DEF_ALLOW_FILES, &var_allow_files, 0, 0,
- VAR_RCPT_FDELIM, DEF_RCPT_FDELIM, &var_rcpt_fdelim, 0, 0,
VAR_LOCAL_CMD_SHELL, DEF_LOCAL_CMD_SHELL, &var_local_cmd_shell, 0, 0,
VAR_MAIL_SPOOL_DIR, DEF_MAIL_SPOOL_DIR, &var_mail_spool_dir, 0, 0,
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_PROP_EXTENSION, DEF_PROP_EXTENSION, &var_prop_extension, 0, 0,
+ VAR_DELIVER_HDR, DEF_DELIVER_HDR, &var_deliver_hdr, 0, 0,
0,
};
static CONFIG_BOOL_TABLE bool_table[] = {
VAR_BIFF, DEF_BIFF, &var_biff,
+ VAR_EXP_OWN_ALIAS, DEF_EXP_OWN_ALIAS, &var_exp_own_alias,
0,
};
long arrival_time; /* arrival time */
int exp_type; /* expansion type. see below */
char *exp_from; /* expanded_from */
- int features; /* see below */
} DELIVER_ATTR;
extern void deliver_attr_init(DELIVER_ATTR *);
#define EXPAND_TYPE_FWD (1<<1)
#define EXPAND_TYPE_INCL (1<<2)
-#define FEATURE_NODELIVERED (1<<0) /* no delivered-to */
-
/*
* Rather than schlepping around dozens of arguments, here is one that has
* all. Well, almost. The user attributes are just a bit too sensitive, so
*/
extern int local_ext_prop_mask;
+ /*
+ * When to prepend a Delivered-To: header upon external delivery.
+ */
+#define DELIVER_HDR_CMD (1<<0)
+#define DELIVER_HDR_FILE (1<<1)
+#define DELIVER_HDR_FWD (1<<2)
+
+extern int local_deliver_hdr_mask;
+
/*
* delivered.c
*/
* Write the file as the recipient, so that file quota work.
*/
copy_flags = MAIL_COPY_MBOX;
- if (state.msg_attr.features & FEATURE_NODELIVERED)
+ if ((local_deliver_hdr_mask & DELIVER_HDR_FILE) == 0)
copy_flags &= ~MAIL_COPY_DELIVERED;
set_eugid(spool_uid, spool_gid);
why = vstring_alloc(100);
copy_flags = MAIL_COPY_TOFILE | MAIL_COPY_RETURN_PATH;
- if ((state.msg_attr.features & FEATURE_NODELIVERED) == 0)
+ if (local_deliver_hdr_mask & DELIVER_HDR_FILE)
copy_flags |= MAIL_COPY_DELIVERED;
newdir = concatenate(path, "new/", (char *) 0);
lowercase(state.msg_attr.local);
if ((state.msg_attr.domain = split_at_right(state.msg_attr.local, '@')) == 0)
msg_warn("no @ in recipient address: %s", state.msg_attr.local);
- state.msg_attr.features = feature_control(state.msg_attr.local);
/*
* Address extension management.
/* This module delivers to addresses listed in an alias database
/* entry, in an include file, or in a .forward file.
/*
-/* deliver_token() delivers to the address in the given token.
+/* deliver_token() delivers to the address in the given token:
+/* an absolute /path/name, a ~/path/name relative to the recipient's
+/* home directory, an :include:/path/name request, an external
+/* "|command", or a mail address.
/*
/* deliver_token_string() delivers to all addresses listed in
/* the specified string.
#include <readlline.h>
#include <mymalloc.h>
#include <vstring_vstream.h>
+#include <stringops.h>
/* Global library. */
#include <tok822.h>
#include <mail_params.h>
+#include <bounce.h>
/* Application-specific. */
#include "local.h"
+/* deliver_token_home - expand ~token */
+
+static int deliver_token_home(LOCAL_STATE state, USER_ATTR usr_attr, char *addr)
+{
+ char *full_path;
+ int status;
+
+ if (addr[1] != '/') { /* disallow ~user */
+ status = bounce_append(BOUNCE_FLAG_KEEP,
+ BOUNCE_ATTR(state.msg_attr),
+ "bad home directory syntax for: %s", addr);
+ } else if (usr_attr.home == 0) { /* require user context */
+ status = bounce_append(BOUNCE_FLAG_KEEP,
+ BOUNCE_ATTR(state.msg_attr),
+ "unknown home directory for: %s", addr);
+ } else if (usr_attr.home[0] == '/' && usr_attr.home[1] == 0) {
+ status = deliver_file(state, usr_attr, addr + 1);
+ } else { /* expand ~ to home */
+ full_path = concatenate(usr_attr.home, addr + 1, (char *) 0);
+ status = deliver_file(state, usr_attr, full_path);
+ myfree(full_path);
+ }
+ return (status);
+}
+
/* deliver_token - deliver to expansion of include file or alias */
int deliver_token(LOCAL_STATE state, USER_ATTR usr_attr, TOK822 *addr)
if (*STR(addr_buf) == '/') {
status = deliver_file(state, usr_attr, STR(addr_buf));
+ } else if (*STR(addr_buf) == '~') {
+ status = deliver_token_home(state, usr_attr, STR(addr_buf));
} else if (*STR(addr_buf) == '|') {
status = deliver_command(state, usr_attr, STR(addr_buf) + 1);
} else if (strncasecmp(STR(addr_buf), include, sizeof(include) - 1) == 0) {
esac;;
esac
;;
+ ULTRIX.4*) SYSTYPE=ULTRIX4
+ if [ -f /usr/local/lib/libdb.a ]; then
+ SYSLIBS="$SYSLIBS -ldb"
+ CCARGS="$CCARGS -DHAS_DB"
+ if [ -d /usr/local/include/db ]; then
+ CCARGS="$CCARGS -I/usr/local/include/db"
+ fi
+ fi
+ for l in syslog resolv; do
+ if [ -f /usr/local/lib/lib$l.a ]; then
+ SYSLIBS="$SYSLIBS -l$l"
+ fi
+ done
+ ;;
AIX.*) case "`uname -v`" in
4) SYSTYPE=AIX4
# How embarrassing...
case "$CC" in
- cc|*/cc|xlc|*/xlc) OPT=;;
+ cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w";;
+ esac
+ CCARGS="$CCARGS -D_ALL_SOURCE"
+ ;;
+ 3) SYSTYPE=AIX3
+ # How embarrassing...
+ case "$CC" in
+ cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w";;
esac
CCARGS="$CCARGS -D_ALL_SOURCE"
;;
SYSLIBS="$SYSLIBS -ldb"
fi
;;
+ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
+ RANLIB=echo
+ SYSLIBS="-lresolv -lsocket -lnsl"
+ ;;
+ Rhapsody.5*) SYSTYPE=RHAPSODY5
+ ;;
".") if [ -d /NextApps ]; then
SYSTYPE=`hostinfo | sed -n \
's/^.*NeXT Mach 3.*$/NEXTSTEP3/;/NEXTSTEP3/{p;q;}'`
update: $(DAEMONS) $(COMMANDS) $(CONFIG)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
clean:
rm -f cat?/*
.IP \fB-v\fR
Enable verbose logging for debugging purposes. Multiple \fB-v\fR
options make the software increasingly verbose.
-.IP \f\B-w\fR
+.IP \fB-w\fR
Do not warn about duplicate entries; silently ignore them.
.PP
Arguments:
In the case of UNIX-style mailbox delivery,
the \fBlocal\fR daemon prepends a "\fBFrom \fIsender time_stamp\fR"
-envelope header to each message, prepends a \fBDelivered-To:\fR header
+envelope header to each message, prepends an
+optional \fBDelivered-To:\fR header
with the envelope recipient address, prepends a \fBReturn-Path:\fR
header with the envelope sender address, prepends a \fB>\fR character
to lines beginning with "\fBFrom \fR", and appends an empty line.
mailbox to its original length.
In the case of \fBmaildir\fR delivery, the local daemon prepends
-a \fBDelivered-To:\fR header with the envelope recipient address
+an optional
+\fBDelivered-To:\fR header with the envelope recipient address
and prepends a \fBReturn-Path:\fR header with the envelope sender
address.
.SH EXTERNAL COMMAND DELIVERY
The current working directory is the mail queue directory.
The \fBlocal\fR daemon prepends a "\fBFrom \fIsender time_stamp\fR"
-envelope header to each message, prepends a \fBDelivered-To:\fR
+envelope header to each message, prepends an
+optional \fBDelivered-To:\fR
header with the recipient envelope address, prepends a
\fBReturn-Path:\fR header with the sender envelope address,
and appends an empty line.
\fBmaildir\fR delivery.
The \fBlocal\fR daemon prepends a "\fBFrom \fIsender time_stamp\fR"
-envelope header to each message, prepends a \fBDelivered-To:\fR
+envelope header to each message, prepends an
+optional \fBDelivered-To:\fR
header with the recipient envelope address, prepends a \fB>\fR
character to lines beginning with "\fBFrom \fR", and appends an
empty line.
is made to truncate a regular file to its original length.
In the case of \fBmaildir\fR delivery, the local daemon prepends
-a \fBDelivered-To:\fR header with the envelope recipient address.
+an optional
+\fBDelivered-To:\fR header with the envelope recipient address.
The envelope sender address is available in the \fBReturn-Path:\fR
header.
.SH ADDRESS EXTENSION
to the mailbox owned by the user \fIname\fR, or it is sent back as
undeliverable.
-In all cases the \fBlocal\fR daemon prepends a
+In all cases the \fBlocal\fR daemon prepends an opional
`\fBDelivered-To:\fR \fIname\fR+\fIfoo\fR' header line.
.SH DELIVERY RIGHTS
.na
.fi
.IP \fBalias_maps\fR
List of alias databases.
+.IP \fBexpand_owner_alias\fR
+When delivering to an alias that has an owner- companion alias,
+set the envelope sender address to the right-hand side of the
+owner alias, instead using of the left-hand side address.
.IP \fBforward_path\fR
Search list for .forward files. The names are subject to \fI$name\fR
expansion.
/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 \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.
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
all: $(PROG) $(LIB)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
$(PROG): $(OBJS) $(LIBS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
close(serv->status_fd[0]); /* status channel */
if (serv->status_fd[1] <= MASTER_STATUS_FD)
msg_fatal("%s: status file descriptor collision", myname);
- if (dup2(serv->status_fd[1], MASTER_STATUS_FD) < 0)
+ if (DUP2(serv->status_fd[1], MASTER_STATUS_FD) < 0)
msg_fatal("%s: dup2 status_fd: %m", myname);
(void) close(serv->status_fd[1]);
for (n = 0; n < serv->listen_fd_count; n++) {
if (serv->listen_fd[n] <= MASTER_LISTEN_FD + n)
msg_fatal("%s: listen file descriptor collision", myname);
- if (dup2(serv->listen_fd[n], MASTER_LISTEN_FD + n) < 0)
+ if (DUP2(serv->listen_fd[n], MASTER_LISTEN_FD + n) < 0)
msg_fatal("%s: dup2 listen_fd %d: %m",
myname, serv->listen_fd[n]);
(void) close(serv->listen_fd[n]);
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
/* .IP \fB-v\fR
/* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
/* options make the software increasingly verbose.
-/* .IP \f\B-w\fR
+/* .IP \fB-w\fR
/* Do not warn about duplicate entries; silently ignore them.
/* .PP
/* Arguments:
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
./$(PROG) -d |egrep -v '^(myhostname|mydomain|mynetworks) ' >$@
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
smtp_session.o: ../include/mymalloc.h
smtp_session.o: ../include/vstream.h
smtp_session.o: ../include/vbuf.h
+smtp_session.o: ../include/stringops.h
smtp_session.o: smtp.h
smtp_session.o: ../include/vstring.h
smtp_session.o: ../include/argv.h
VSTREAM *stream; /* network connection */
char *host; /* mail exchanger */
char *addr; /* mail exchanger */
+ char *namaddr; /* mail exchanger */
int best; /* most preferred host */
} SMTP_SESSION;
* program is trying to do.
*/
if (msg_verbose)
- msg_info("> %s: %s", session->host, STR(state->buffer));
+ msg_info("> %s: %s", session->namaddr, STR(state->buffer));
/*
* Send the command to the SMTP server.
cp = printable(STR(state->buffer), '?');
if (last_char != '\n')
msg_warn("%s: response longer than %d: %.30s...",
- session->host, var_line_limit, cp);
+ session->namaddr, var_line_limit, cp);
if (msg_verbose)
- msg_info("< %s: %s", session->host, cp);
+ msg_info("< %s: %s", session->namaddr, cp);
while (ISDIGIT(*cp))
cp++;
rdata.code = (cp - STR(state->buffer) == 3 ?
mail_addr_mail_daemon());
post_mail_fprintf(notice, "To: %s (Postmaster)", var_error_rcpt);
post_mail_fprintf(notice, "Subject: %s SMTP client: errors from %s",
- var_mail_name, session->host);
+ var_mail_name, session->namaddr);
post_mail_fputs(notice, "");
- post_mail_fprintf(notice, "Unexpected response from %s.", session->host);
+ post_mail_fprintf(notice, "Unexpected response from %s.", session->namaddr);
post_mail_fputs(notice, "");
post_mail_fputs(notice, "Transcript of session follows.");
post_mail_fputs(notice, "");
/* System library. */
#include <sys_defs.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
memcpy((char *) &sin.sin_addr, addr_list->addrs, sizeof(sin.sin_addr));
inaddr = ntohl(sin.sin_addr.s_addr);
if (!IN_CLASSA(inaddr)
- || !((inaddr & IN_CLASSA_NET) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {
+ || !(((inaddr & IN_CLASSA_NET) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)) {
if (bind(sock, (struct sockaddr *) & sin, sizeof(sin)) < 0)
msg_warn("%s: bind %s: %m", myname, inet_ntoa(sin.sin_addr));
if (msg_verbose)
session->best = (addr->pref == addr_list->pref);
break;
}
+ msg_info("%s; address %s port %d", vstring_str(why),
+ inet_ntoa(*((struct in_addr *) addr->data)), port);
}
dns_rr_free(addr_list);
return (session);
if (((resp = smtp_chat_resp(state))->code / 100) != 2)
return (smtp_site_fail(state, resp->code,
"host %s refused to talk to me: %s",
- session->host, translit(resp->str, "\n", " ")));
+ session->namaddr, translit(resp->str, "\n", " ")));
/*
* See if we are talking to ourself. This should not be possible with the
for (n = 0; (word = mystrtok(&words, " \t\n")) != 0; n++) {
if (n == 0 && strcasecmp(word, var_myhostname) == 0) {
msg_warn("host %s greeted me with my own hostname %s",
- session->host, var_myhostname);
+ session->namaddr, var_myhostname);
return (smtp_site_fail(state, session->best ? 550 : 450,
"mail for %s loops back to myself",
request->nexthop));
if ((resp = smtp_chat_resp(state))->code / 100 != 2)
return (smtp_site_fail(state, resp->code,
"host %s refused to talk to me: %s",
- session->host,
+ session->namaddr,
translit(resp->str, "\n", " ")));
}
case SMTP_STATE_MAIL:
if (resp->code / 100 != 2) {
smtp_mesg_fail(state, resp->code,
- "host %s said: %s", session->host,
+ "host %s said: %s", session->namaddr,
translit(resp->str, "\n", " "));
mail_from_rejected = 1;
}
} else {
rcpt = request->rcpt_list.info + recv_rcpt;
smtp_rcpt_fail(state, resp->code, rcpt,
- "host %s said: %s", session->host,
+ "host %s said: %s", session->namaddr,
translit(resp->str, "\n", " "));
rcpt->offset = 0; /* in case deferred */
}
if (resp->code / 100 != 3) {
if (nrcpt > 0)
smtp_mesg_fail(state, resp->code,
- "host %s said: %s", session->host,
+ "host %s said: %s", session->namaddr,
translit(resp->str, "\n", " "));
nrcpt = -1;
}
if (resp->code / 100 != 2) {
smtp_mesg_fail(state, resp->code,
"host %s said: %s",
- session->host,
+ session->namaddr,
translit(resp->str, "\n", " "));
} else {
for (nrcpt = 0; nrcpt < recv_rcpt; nrcpt++) {
rcpt = request->rcpt_list.info + nrcpt;
if (rcpt->offset) {
sent(request->queue_id, rcpt->address,
- session->host, request->arrival_time, "%s",
+ session->namaddr,
+ request->arrival_time, "%s",
resp->str);
deliver_completed(state->src, rcpt->offset);
rcpt->offset = 0;
#include <mymalloc.h>
#include <vstream.h>
+#include <stringops.h>
/* Application-specific. */
session->stream = stream;
session->host = mystrdup(host);
session->addr = mystrdup(addr);
+ session->namaddr = concatenate(host, "[", addr, "]", (char *) 0);
session->best = 1;
return (session);
}
vstream_fclose(session->stream);
myfree(session->host);
myfree(session->addr);
+ myfree(session->namaddr);
myfree((char *) session);
}
continue;
status = (soft_error ? defer_append : bounce_append)
(KEEP, request->queue_id, rcpt->address,
- session ? session->host : "none",
+ session ? session->namaddr : "none",
request->arrival_time, "%s", vstring_str(why));
if (status == 0) {
deliver_completed(state->src, rcpt->offset);
continue;
status = (SMTP_SOFT(code) ? defer_append : bounce_append)
(KEEP, request->queue_id, rcpt->address,
- session->host, request->arrival_time,
+ session->namaddr, request->arrival_time,
"%s", vstring_str(why));
if (status == 0) {
deliver_completed(state->src, rcpt->offset);
*/
va_start(ap, format);
status = (SMTP_SOFT(code) ? vdefer_append : vbounce_append)
- (KEEP, request->queue_id, rcpt->address, session->host,
+ (KEEP, request->queue_id, rcpt->address, session->namaddr,
request->arrival_time, format, ap);
va_end(ap);
if (status == 0) {
msg_panic("smtp_stream_except: unknown exception %d", code);
case SMTP_ERR_EOF:
vstring_sprintf(why, "lost connection with %s while %s",
- session->host, description);
+ session->namaddr, description);
break;
case SMTP_ERR_TIME:
vstring_sprintf(why, "conversation with %s timed out while %s",
- session->host, description);
+ session->namaddr, description);
break;
}
if (rcpt->offset == 0)
continue;
state->status |= defer_append(KEEP, request->queue_id,
- rcpt->address, session->host,
+ rcpt->address, session->namaddr,
request->arrival_time,
"%s", vstring_str(why));
}
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
mail_stream_cleanup(state->dest);
state->dest = 0;
state->cleanup = 0;
- state->err = 0;
}
+ state->err = 0;
if (state->queue_id != 0) {
myfree(state->queue_id);
state->queue_id = 0;
*/
if (strcasecmp(name, PERMIT_ALL) == 0) {
*status = SMTPD_CHECK_OK;
+ if ((*cpp)[1] != 0)
+ msg_warn("restriction `%s' after `%s' is ignored",
+ (*cpp)[1], PERMIT_ALL);
return (1);
}
if (strcasecmp(name, REJECT_ALL) == 0) {
*status = smtpd_check_reject(state, MAIL_ERROR_POLICY,
"%d <%s>: %s rejected: Access denied",
var_reject_code, reply_name, reply_class);
+ if ((*cpp)[1] != 0)
+ msg_warn("restriction `%s' after `%s' is ignored",
+ (*cpp)[1], REJECT_ALL);
return (1);
}
} else if (strcasecmp(name, CHECK_RELAY_DOMAINS) == 0) {
status = check_relay_domains(state, recipient,
recipient, SMTPD_NAME_RECIPIENT);
+ if (cpp[1] != 0)
+ msg_warn("restriction `%s' after `%s' is ignored",
+ cpp[1], CHECK_RELAY_DOMAINS);
} else if (strcasecmp(name, REJECT_UNKNOWN_RCPTDOM) == 0) {
status = reject_unknown_address(state, recipient,
recipient, SMTPD_NAME_RECIPIENT);
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
all: $(PROG)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
smtp-sink: smtp-sink.o $(LIBS)
$(CC) $(CFLAGS) -o $@ smtp-sink.o $(LIBS) $(SYSLIBS)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
-TDICT_ENV
-TDICT_HT
-TDICT_LDAP
+-TDICT_MYSQL
-TDICT_NI
-TDICT_NIS
-TDICT_NISPLUS
-TFILE
-TFORWARD_INFO
-THEADER_OPTS
+-THOST
-THTABLE
-THTABLE_INFO
-TINET_ADDR_LIST
-TMKMAP_OPEN_INFO
-TMULTI_SERVER
-TMVECT
+-TMYSQL_NAME
-TNAMADR_LIST
-TNAME_MASK
-TPEER_NAME
-TPICKUP_INFO
-TPIPE_ATTR
-TPIPE_PARAMS
+-TPLMYSQL
-TQMGR_ENTRY
-TQMGR_MESSAGE
-TQMGR_QUEUE
SHELL = /bin/sh
SRCS = argv.c argv_split.c attr.c basename.c binhash.c chroot_uid.c \
close_on_exec.c concatenate.c dict.c dict_db.c dict_dbm.c \
- dict_env.c dict_ht.c dict_ldap.c dict_ni.c dict_nis.c \
+ dict_env.c dict_ht.c dict_ldap.c dict_mysql.c dict_ni.c dict_nis.c \
dict_nisplus.c dict_open.c dir_forest.c doze.c environ.c \
events.c exec_command.c fifo_listen.c fifo_trigger.c file_limit.c \
find_inet.c fsspace.c fullname.c get_domainname.c get_hostname.c \
clean_env.c
OBJS = argv.o argv_split.o attr.o basename.o binhash.o chroot_uid.o \
close_on_exec.o concatenate.o dict.o dict_db.o dict_dbm.o \
- dict_env.o dict_ht.o dict_ldap.o dict_ni.o dict_nis.o \
+ dict_env.o dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \
dict_nisplus.o dict_open.o dir_forest.o doze.o environ.o \
events.o exec_command.o fifo_listen.o fifo_trigger.o file_limit.o \
find_inet.o fsspace.o fullname.o get_domainname.o get_hostname.o \
stream_connect.o stream_trigger.o dict_regexp.o mac_expand.o \
clean_env.o
HDRS = argv.h attr.h binhash.h chroot_uid.h connect.h dict.h dict_db.h \
- dict_dbm.h dict_env.h dict_ht.h dict_ldap.h dict_ni.h dict_nis.h \
- dict_nisplus.h dir_forest.h events.h exec_command.h find_inet.h \
- fsspace.h fullname.h get_domainname.h get_hostname.h htable.h \
- inet_addr_host.h inet_addr_list.h inet_addr_local.h inet_util.h \
- iostuff.h line_wrap.h listen.h lstat_as.h mac_parse.h make_dirs.h \
- match_list.h match_ops.h msg.h msg_output.h msg_syslog.h \
- msg_vstream.h mvect.h myflock.h mymalloc.h name_mask.h open_as.h \
- open_lock.h percentm.h posix_signals.h readlline.h ring.h safe.h \
- safe_open.h sane_accept.h scan_dir.h set_eugid.h set_ugid.h \
+ dict_dbm.h dict_env.h dict_ht.h dict_ldap.h dict_mysql.h \
+ dict_ni.h dict_nis.h dict_nisplus.h dir_forest.h events.h \
+ exec_command.h find_inet.h fsspace.h fullname.h get_domainname.h \
+ get_hostname.h htable.h inet_addr_host.h inet_addr_list.h \
+ inet_addr_local.h inet_util.h iostuff.h line_wrap.h listen.h lstat_as.h \
+ mac_parse.h make_dirs.h match_list.h match_ops.h msg.h msg_output.h \
+ msg_syslog.h msg_vstream.h mvect.h myflock.h mymalloc.h name_mask.h \
+ open_as.h open_lock.h percentm.h posix_signals.h readlline.h ring.h \
+ safe.h safe_open.h sane_accept.h scan_dir.h set_eugid.h set_ugid.h \
sigdelay.h split_at.h stat_as.h stringops.h sys_defs.h \
timed_connect.h timed_wait.h trigger.h username.h valid_hostname.h \
vbuf.h vbuf_print.h vstream.h vstring.h vstring_vstream.h \
dict_unix.h dict_pcre.h dict_regexp.h mac_expand.h clean_env.h
TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
- stream_test.c
+ stream_test.c dup2_pass_on_exec.c
WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
-Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
-Wunused
FILES = Makefile $(SRCS) $(HDRS)
INCL =
LIB = libutil.a
-TESTPROG= dict_open events exec_command fifo_open fifo_rdonly_bug \
- fifo_rdwr_bug fifo_trigger fsspace fullname inet_addr_host \
- inet_addr_local mac_parse make_dirs msg_syslog \
+TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
+ fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
+ inet_addr_host inet_addr_local mac_parse make_dirs msg_syslog \
mystrtok peer_name sigdelay translit valid_hostname vstream_popen \
vstring vstring_vstream doze select_bug stream_test mac_expand
all: $(LIB)
Makefile: Makefile.in
- (set -e; echo "# DO NOT EDIT"; $(OPTS) sh ../makedefs; cat $?) >$@
+ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../makedefs; cat $?) >$@
test: $(TESTPROG)
tidy: clean
+dup2_pass_on_exec: dup2_pass_on_exec.c
+ $(CC) $(CFLAGS) -o $@ $@.c $(SYSLIBS)
+
vstring: $(LIB)
mv $@.o junk
$(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
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
dict_ht.o: dict_ht.h
dict_ldap.o: dict_ldap.c
dict_ldap.o: sys_defs.h
+dict_mysql.o: dict_mysql.c
+dict_mysql.o: sys_defs.h
dict_ni.o: dict_ni.c
dict_ni.o: sys_defs.h
dict_nis.o: dict_nis.c
dict_open.o: dict_nisplus.h
dict_open.o: dict_ni.h
dict_open.o: dict_ldap.h
+dict_open.o: dict_mysql.h
dict_open.o: dict_pcre.h
dict_open.o: dict_regexp.h
dict_open.o: stringops.h
doze.o: sys_defs.h
doze.o: msg.h
doze.o: iostuff.h
+dup2_pass_on_exec.o: dup2_pass_on_exec.c
environ.o: environ.c
environ.o: sys_defs.h
events.o: events.c
get_hostname.o: msg.h
get_hostname.o: valid_hostname.h
get_hostname.o: get_hostname.h
-hattr.o: hattr.c
htable.o: htable.c
htable.o: sys_defs.h
htable.o: mymalloc.h
--- /dev/null
+/*++
+/* NAME
+/* dict_mysql 3
+/* SUMMARY
+/* dictionary manager interface to db files
+/* SYNOPSIS
+/* #include <dict.h>
+/* #include <dict_mysql.h>
+/*
+/*
+/* DICT *dict_mysql_open(name, dummy, unused_dict_flags)
+/* const char *name;
+/* int dummy;
+/* int unused_dict_flags;
+/* DESCRIPTION
+/* dict_mysql_open() opens the mysql databases with name dbname on
+/* each host in hostlist and registers under the given name with the
+/* dictionary manager. The result is a pointer to the installed dictionary,
+/* or a null pointer in case of problems.
+/*
+/* Arguments:
+/* .IP name
+/* The path of the MySQL configuration file. The file encodes a number of
+/* pieces of information: username, password, databasename, table,
+/* select_field, where_field, and hosts. For example, if you want the map to
+/* reference databases of the name "your_db" and execute a query like this:
+/* select forw_addr from aliases where alias like '<some username>' against
+/* any database called "vmailer_info" located on hosts host1.some.domain and
+/* host2.some.domain, logging in as user "vmailer" and password "passwd" then
+/* the configuration file should read:
+/*
+/* user = vmailer
+/* password = passwd
+/* DBname = vmailer_info
+/* table = aliases
+/* select_field = forw_addr
+/* where_field = alias
+/* hosts = host1.some.domain host2.some.domain
+/*
+/* .IP other_name
+/* reference for outside use.
+/* .IP unusued_flags
+/* unused flags
+/* SEE ALSO
+/* dict(3) generic dictionary manager
+/* AUTHOR(S)
+/* Scott Cotton
+/* IC Group, Inc.
+/* scott@icgroup.com
+/*
+/* Joshua Marcus
+/* IC Group, Inc.
+/* josh@icgroup.com
+/*--*/
+
+
+/* System library. */
+#include "sys_defs.h"
+
+#ifdef HAS_MYSQL
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <time.h>
+
+/* Utility library. */
+#include "dict.h"
+#include "msg.h"
+#include "mymalloc.h"
+#include "dict_mysql.h"
+#include "argv.h"
+#include "vstring.h"
+
+
+extern int dict_errno;
+
+typedef struct {
+ char *username;
+ char *password;
+ char *dbname;
+ char *table;
+ char *select_field;
+ char *where_field;
+ char *additional_conditions;
+ char **hostnames;
+ int len_hosts;
+} MYSQL_NAME;
+
+
+typedef struct {
+ DICT dict;
+ PLMYSQL *pldb;
+ MYSQL_NAME *name;
+} DICT_MYSQL;
+
+/* mysqlname_parse - parse mysql configuration file */
+
+static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
+{
+ int i;
+ char *nameval;
+ char *hosts;
+ MYSQL_NAME *name = (MYSQL_NAME *) mymalloc(sizeof(MYSQL_NAME));
+ ARGV *hosts_argv;
+
+
+ dict_load_file("mysql_options", mysqlcf_path);
+ /* mysql username lookup */
+ if ((nameval = (char *) dict_lookup("mysql_options", "user")) == NULL)
+ name->username = mystrdup("");
+ else
+ name->username = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("dict_mysql_parse: set username to '%s'", name->username);
+ /* password lookup */
+ if ((nameval = (char *) dict_lookup("mysql_options", "password")) == NULL)
+ name->password = mystrdup("");
+ else
+ name->password = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("dict_mysql_parse: set password to '%s'", name->password);
+
+ /* database name lookup */
+ if ((nameval = (char *) dict_lookup("mysql_options", "dbname")) == NULL)
+ msg_fatal("%s: mysql options file does not include database name", mysqlcf_path);
+ else
+ name->dbname = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("mysql_name_parse: set database name to '%s'", name->dbname);
+
+ /* table lookup */
+ if ((nameval = (char *) dict_lookup("mysql_options", "table")) == NULL)
+ msg_fatal("%s: mysql options file does not include table name", mysqlcf_path);
+ else
+ name->table = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("mysql_name_parse: set table name to '%s'", name->table);
+
+ /* select field lookup */
+ if ((nameval = (char *) dict_lookup("mysql_options", "select_field")) == NULL)
+ msg_fatal("%s: mysql options file does not include select field", mysqlcf_path);
+ else
+ name->select_field = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("mysql_name_parse: set select_field to '%s'", name->select_field);
+
+ /* where field lookup */
+ if ((nameval = (char *) dict_lookup("mysql_options", "where_field")) == NULL)
+ msg_fatal("%s: mysql options file does not include where field", mysqlcf_path);
+ else
+ name->where_field = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("mysql_name_parse: set where_field to '%s'", name->where_field);
+
+ /* additional conditions */
+ if ((nameval = (char *) dict_lookup("mysql_options", "additional_conditions")) == NULL)
+ name->additional_conditions = mystrdup("");
+ else
+ name->additional_conditions = mystrdup(nameval);
+ if (msg_verbose)
+ msg_info("mysql_name_parse: set additional_conditions to '%s'", name->additional_conditions);
+
+ /* mysql server hosts */
+ if ((nameval = (char *) dict_lookup("mysql_options", "hosts")) == NULL)
+ hosts = mystrdup("");
+ else
+ hosts = mystrdup(nameval);
+ /* coo argv interface */
+ hosts_argv = argv_split(hosts, " ");
+ argv_terminate(hosts_argv);
+
+ if (hosts_argv->argc == 0) { /* no hosts specified,
+ * default to 'localhost' */
+ msg_info("mysql_name_parse: no hostnames specified, defaulting to 'localhost'");
+ name->len_hosts = 1;
+ name->hostnames = (char **) mymalloc(sizeof(char *));
+ name->hostnames[0] = mystrdup("localhost");
+ } else {
+ name->len_hosts = hosts_argv->argc;
+ name->hostnames = (char **) mymalloc((sizeof(char *)) * name->len_hosts);
+ i = 0;
+ for (i = 0; hosts_argv->argv[i] != NULL; i++) {
+ name->hostnames[i] = mystrdup(hosts_argv->argv[i]);
+ if (msg_verbose)
+ msg_info("adding host '%s' to list of mysql server hosts", name->hostnames[i]);
+ }
+ }
+ myfree(hosts);
+ argv_free(hosts_argv);
+ return name;
+}
+
+
+/* dict_mysql_lookup - find database entry return 0 if no alias found */
+static const char *dict_mysql_lookup(DICT *dict, const char *name)
+{
+ MYSQL_RES *query_res;
+ MYSQL_ROW row;
+ int i,
+ numrows;
+ static VSTRING *result;
+ static VSTRING *query = 0;
+ char *name_escaped = 0;
+ DICT_MYSQL *dict_mysql;
+ PLMYSQL *pldb;
+
+ dict_mysql = (DICT_MYSQL *) dict;
+ pldb = dict_mysql->pldb;
+ /* initialization for query */
+ query = vstring_alloc(24);
+ vstring_strcpy(query, "");
+ if ((name_escaped = (char *) mymalloc((sizeof(char) * (strlen(name) * 2) +1))) == NULL) {
+ msg_fatal("dict_mysql_lookup: out of memory.");
+ }
+ /* prepare the query */
+ mysql_escape_string(name_escaped, name, (unsigned int) strlen(name));
+ vstring_sprintf(query, "select %s from %s where %s = '%s' %s", dict_mysql->name->select_field,
+ dict_mysql->name->table, dict_mysql->name->where_field, name_escaped,
+ dict_mysql->name->additional_conditions);
+ if (msg_verbose)
+ msg_info("dict_mysql_lookup using sql query: %s", vstring_str(query));
+ /* free mem associated with preparing the query */
+ myfree(name_escaped);
+ /* do the query */
+ if ((query_res = plmysql_query(pldb, vstring_str(query))) == NULL) {
+ dict_errno = DICT_ERR_RETRY;
+ vstring_free(query);
+ return 0;
+ }
+ /* free the vstring query */
+ vstring_free(query);
+ numrows = mysql_num_rows(query_res);
+ if (msg_verbose)
+ msg_info("dict_mysql_lookup: retrieved %d rows", numrows);
+ if (numrows == 0) {
+ mysql_free_result(query_res);
+ return 0;
+ }
+ if (result == 0)
+ result = vstring_alloc(10);
+ vstring_strcpy(result, "");
+ for (i = 0; i < numrows; i++) {
+ row = mysql_fetch_row(query_res);
+ if (msg_verbose > 1)
+ msg_info("dict_mysql_lookup: retrieved row: %d: %s", i, row[0]);
+ if (i > 0)
+ vstring_strcat(result, ",");
+ vstring_strcat(result, row[0]);
+ }
+ mysql_free_result(query_res);
+ return vstring_str(result);
+}
+
+
+/* dict_mysql_close - unregister, disassociate from database */
+static void dict_mysql_close(DICT *dict)
+{
+ int i;
+ DICT_MYSQL *dict_mysql = (DICT_MYSQL *) dict;
+
+ plmysql_dealloc(dict_mysql->pldb);
+ myfree(dict_mysql->name->username);
+ myfree(dict_mysql->name->password);
+ myfree(dict_mysql->name->dbname);
+ myfree(dict_mysql->name->table);
+ myfree(dict_mysql->name->select_field);
+ myfree(dict_mysql->name->where_field);
+ myfree(dict_mysql->name->additional_conditions);
+ for (i = 0; i < dict_mysql->name->len_hosts; i++) {
+ myfree(dict_mysql->name->hostnames[i]);
+ }
+ myfree((char *) dict_mysql->name);
+}
+
+
+/* dict_mysql_update - add or update table entry */
+static void dict_mysql_update(DICT *dict, const char *unused_name, const char *unused_value)
+{
+ DICT_MYSQL *dict_mysql = (DICT_MYSQL *) dict;
+
+ msg_fatal("dict_mysql_update: attempt to update mysql database");
+}
+
+/* dict_mysql_open - create association with database */
+DICT *dict_mysql_open(const char *name, int unused_flags, int unused_dict_flags)
+{
+ DICT_MYSQL *dict_mysql;
+ int connections;
+
+ dict_mysql = (DICT_MYSQL *) mymalloc(sizeof(DICT_MYSQL));
+ dict_mysql->dict.lookup = dict_mysql_lookup;
+ dict_mysql->dict.update = dict_mysql_update;
+ dict_mysql->dict.close = dict_mysql_close;
+ dict_mysql->dict.fd = -1; /* there's no file descriptor
+ * for locking */
+ dict_mysql->name = (MYSQL_NAME *) mymalloc(sizeof(MYSQL_NAME));
+ dict_mysql->name = mysqlname_parse(name);
+ dict_mysql->pldb = plmysql_init(dict_mysql->name->dbname,
+ dict_mysql->name->hostnames,
+ dict_mysql->name->len_hosts);
+ if (dict_mysql->pldb == NULL)
+ msg_fatal("couldn't intialize pldb!\n");
+ connections = plmysql_connect(dict_mysql->pldb, dict_mysql->name->username,
+ dict_mysql->name->password);
+ if (connections == 0)
+ /* the mysql lookup mechanism will try to reconnect anyway ... */
+ msg_warn("couldn't connect pldb to any database instances");
+ else
+ msg_info("pldb connected to %d database instances", connections);
+ dict_register(name, (DICT *) dict_mysql);
+ return &dict_mysql->dict;
+}
+
+/* host_init - initialize HOST structure */
+static HOST host_init(char *hostname)
+{
+ int stat;
+ MYSQL db;
+ time_t ts;
+ HOST host;
+
+ host.stat = STATUNTRIED;
+ host.hostname = hostname;
+ host.db = db;
+ host.ts = ts;
+ return host;
+}
+
+
+/*
+ * plmysql_init - initalize a MYSQL database.
+ * Return NULL on failure, or a PLMYSQL * on success.
+ */
+PLMYSQL *plmysql_init(char *dbname,
+ char *hostnames[],
+ int len_hosts)
+{
+ PLMYSQL *PLDB;
+ MYSQL *dbs;
+ int i;
+ HOST host;
+
+ if ((PLDB = (PLMYSQL *) mymalloc(sizeof(PLMYSQL))) == NULL) {
+ msg_fatal("mymalloc of pldb failed");
+ }
+ PLDB->dbname = dbname;
+ PLDB->len_hosts = len_hosts;
+ if ((PLDB->db_hosts = (HOST *) mymalloc(sizeof(HOST) * len_hosts)) == NULL)
+ return NULL;
+ for (i = 0; i < len_hosts; i++) {
+ PLDB->db_hosts[i] = host_init(hostnames[i]);
+ }
+ return PLDB;
+}
+
+/* plmysql_dealloc - free memory associated with PLMYSQL close databases */
+void plmysql_dealloc(PLMYSQL *PLDB)
+{
+ int i;
+
+ for (i = 0; i < PLDB->len_hosts; i++) {
+ mysql_close(&(PLDB->db_hosts[i].db));
+ myfree(PLDB->db_hosts[i].hostname);
+ }
+ myfree((char *) PLDB->db_hosts);
+ myfree((char *) (PLDB));
+}
+
+/* plmysql_down_host - down a HOST * */
+inline void plmysql_down_host(HOST *host)
+{
+ host->stat = STATFAIL;
+ host->ts = time(&(host->ts));
+}
+
+
+/* plmysql_connect_single -
+ * used to reconnect to a single database when one is down and as a helper for
+ * plmysql_connect
+ */
+int plmysql_connect_single(PLMYSQL *PLDB, int host)
+{
+ if ((mysql_connect(&(PLDB->db_hosts[host].db), PLDB->db_hosts[host].hostname,
+ PLDB->username, PLDB->password))) {
+ if (mysql_select_db(&(PLDB->db_hosts[host].db), PLDB->dbname) == 0) {
+ PLDB->db_hosts[host].stat = STATACTIVE;
+ return 1;
+ } else {
+ plmysql_down_host(&(PLDB->db_hosts[host]));
+ msg_warn("%s", mysql_error(&PLDB->db_hosts[host].db));
+ }
+ } else {
+ plmysql_down_host(&(PLDB->db_hosts[host]));
+ msg_warn("%s", mysql_error(&PLDB->db_hosts[host].db));
+ }
+ return 0;
+}
+
+
+/*
+ * plmysql_connect -
+ * given a PLMYSQL struct PLDB *, connect it and select db.
+ * return the number of databases successfully connected (0 for failure)
+ */
+int plmysql_connect(PLMYSQL *PLDB, char *username, char *password)
+{
+ int i,
+ res;
+
+ res = 0;
+
+ PLDB->username = username;
+ PLDB->password = password;
+
+ for (i = 0; i < PLDB->len_hosts; i++) {
+ res = res + plmysql_connect_single(PLDB, i);
+ }
+ return res;
+}
+
+/* plmysql_ready_reconn -
+ given a downed HOST, return whether or not it should retry connection
+*/
+int plmysql_ready_reconn(HOST host)
+{
+ time_t t;
+ long now;
+
+ now = (long) time(&t);
+ if ((now - ((long) host.ts)) >= RETRY_CONN_INTV)
+ return 1;
+ return 0;
+}
+
+/*
+ * plmysql_query - process a MySQL query. Return 0 on success.
+ * On failure, log failure and try other db instances.
+ */
+
+MYSQL_RES *plmysql_query(PLMYSQL *PLDB, const char *query)
+{
+ int i;
+ MYSQL_RES *res;
+
+ for (i = 0; i < PLDB->len_hosts; i++) {
+ if ((PLDB->db_hosts[i].stat != STATACTIVE) &&
+ (plmysql_ready_reconn(PLDB->db_hosts[i]))) {
+ msg_warn("attempting to reconnect to host");
+ plmysql_connect_single(PLDB, i);
+ continue;
+ }
+ if ((!(mysql_query(&(PLDB->db_hosts[i].db), query))) && \
+ (res = mysql_store_result(&(PLDB->db_hosts[i].db)))) {
+ return res;
+ }
+ msg_warn("%s", mysql_error(&PLDB->db_hosts[i].db));
+ plmysql_down_host(&(PLDB->db_hosts[i]));
+ }
+ return NULL;
+}
+
+#endif
--- /dev/null
+#ifdef HAS_MYSQL
+
+#include <time.h>
+#include "mysql.h"
+
+#define STATACTIVE 0
+#define STATFAIL 1
+#define STATUNTRIED 2
+#define RETRY_CONN_INTV 300 /* 5 minutes */
+
+extern DICT *dict_mysql_open(const char *name, int unused_flags, int dict_flags);
+
+typedef struct {
+ char *hostname;
+ int stat; /* STATUNTRIED | STATFAIL | STATCUR */
+ time_t ts; /* used for attempting reconnection
+ * every so often if a host is down */
+ MYSQL db;
+} HOST;
+
+
+typedef struct {
+ char *username; /* login for database */
+ char *password; /* password for database */
+ char *dbname; /* the name of the database on all
+ * the servers */
+ HOST *db_hosts; /* the hosts on which the databases
+ * reside */
+ int len_hosts; /* number of hosts */
+} PLMYSQL;
+
+extern PLMYSQL *plmysql_init(char *dbname, char *hostnames[], int len_hosts);
+
+extern int plmysql_connect(PLMYSQL *PLDB, char *username, char *password);
+
+MYSQL_RES *plmysql_query(PLMYSQL *PLDB, const char *query);
+
+void plmysql_dealloc(PLMYSQL *PLDB);
+
+inline void plmysql_down_host(HOST *host);
+
+int plmysql_connect_single(PLMYSQL *PLDB, int host);
+
+int plmysql_ready_reconn(HOST host);
+
+#endif
#include <dict_nisplus.h>
#include <dict_ni.h>
#include <dict_ldap.h>
+#include <dict_mysql.h>
#include <dict_pcre.h>
#include <dict_regexp.h>
#include <stringops.h>
#ifdef HAS_LDAP
"ldap", dict_ldap_open,
#endif
+#ifdef HAS_MYSQL
+ "mysql", dict_mysql_open,
+#endif
#ifdef HAS_PCRE
"pcre", dict_pcre_open,
#endif
#define MILLION 1000000
- tv.tv_sec = (delay > MILLION ? delay / MILLION : 0);
+ tv.tv_sec = delay / MILLION;
tv.tv_usec = delay % MILLION;
while (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &tv) < 0)
if (errno != EINTR)
--- /dev/null
+/*++
+/* NAME
+/* dup2_pass_on_exec 1
+/* SUMMARY
+/* dup2 close-on-exec behaviour test program
+/* SYNOPSIS
+/* dup2_pass_on_exec
+/* DESCRIPTION
+/* dup2_pass_on_exec sets the close-on-exec flag on its
+/* standard input and then dup2() to duplicate it.
+/* Posix-1003.1 specifies in section 6.2.1.2 that dup2(o,n) should behave
+/* as: close(n); n = fcntl(o, F_DUPFD, n); as long as o is a valid
+/* file-descriptor, n!=o, and 0<=n<=[OPEN_MAX].
+/* Section 6.5.2.2 states that the close-on-exec flag of the result of a
+/* successful fcntl(o, F_DUPFD, n) is cleared.
+/*
+/* At least Ultrix4.3a does not clear the close-on-exec flag of n on
+/* dup2(o, n).
+/* DIAGNOSTICS
+/* Problems are reported to the standard error stream.
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Christian von Roques <roques@pond.sub.org>
+/* Forststrasse 71
+/* 76131 Karlsruhe, GERMANY
+/*--*/
+
+#include <stdio.h>
+#include <fcntl.h>
+
+#define DO(s) if (s < 0) { perror(#s); exit(1); }
+
+int main(int unused_argc, char **unused_argv)
+{
+ int res;
+
+ printf("Setting the close-on-exec flag of file-descriptor 0.\n");
+ DO(fcntl(0, F_SETFD, 1));
+
+ printf("Duplicating file-descriptor 0 to 3.\n");
+ DO(dup2(0, 3));
+
+ printf("Testing if the close-on-exec flag of file-descriptor 3 is set.\n");
+ DO((res = fcntl(3, F_GETFD, 0)));
+ if (res & 1)
+ printf("Yes, a newly dup2()ed file-descriptor has the close-on-exec "
+ "flag cloned.\n"
+ "THIS VIOLATES Posix1003.1 section 6.2.1.2 or 6.5.2.2!\n"
+ "You should #define DUP2_DUPS_CLOSE_ON_EXEC in sys_defs.h "
+ "for your OS.\n");
+ else
+ printf("No, a newly dup2()ed file-descriptor has the close-on-exec "
+ "flag cleared.\n"
+ "This complies with Posix1003.1 section 6.2.1.2 and 6.5.2.2!\n");
+
+ return 0;
+}
#include <sys/vfs.h>
#elif defined(STATVFS_IN_SYS_STATVFS_H)
#include <sys/statvfs.h>
+#elif defined(STATFS_IN_SYS_STATFS_H)
+#include <sys/statfs.h>
#else
#ifdef USE_STATFS
#error "please specify the include file with `struct statfs'"
char *myname = "fsspace";
#ifdef USE_STATFS
+#ifdef USE_STRUCT_FS_DATA /* Ultrix */
+ struct fs_data fsbuf;
+
+ if (statfs(path, &fsbuf) < 0)
+ msg_fatal("statfs %s: %m", path);
+ sp->block_size = 1024;
+ sp->block_free = fsbuf.fd_bfreen;
+#else
struct statfs fsbuf;
if (statfs(path, &fsbuf) < 0)
sp->block_size = fsbuf.f_bsize;
sp->block_free = fsbuf.f_bavail;
#endif
+#endif
#ifdef USE_STATVFS
struct statvfs fsbuf;
/* int options;
/*
/* int setsid()
+/*
+/* void dup2_pass_on_exec(int oldd, int newd)
/* DESCRIPTION
/* These routines are compiled for platforms that lack the functionality
/* or that have broken versions that we prefer to stay away from.
#error MISSING_SETSID
#endif
+#endif
+
+ /*
+ * dup2_pass_on_exec() - dup2() and clear close-on-exec flag on the result
+ */
+#ifdef DUP2_DUPS_CLOSE_ON_EXEC
+
+#include "iostuff.h"
+
+int dup2_pass_on_exec(int oldd, int newd)
+{
+ int res;
+
+ if ((res = dup2(oldd, newd)) >= 0)
+ close_on_exec(newd, PASS_ON_EXEC);
+
+ return res;
+}
+
#endif
*/
#if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
|| defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
- || defined(OPENBSD2) || defined(NETBSD1)
+ || defined(OPENBSD2) || defined(NETBSD1) || defined(RHAPSODY5)
#define SUPPORTED
#include <sys/types.h>
#define USE_PATHS_H
#define USE_DOT_LOCK
#endif
+#if defined(RHAPSODY5)
+#define NORETURN void
+#endif
+
#ifdef ULTRIX4
#define SUPPORTED
#include <sys/types.h>
#define UNSAFE_CTYPE /* XXX verify */
-#define fpos_t long /* XXX verify */
-#define MISSING_SETENV /* XXX verify */
-#define MISSING_STRERROR /* XXX verify */
#define _PATH_MAILDIR "/var/spool/mail"
#define _PATH_BSHELL "/bin/sh"
#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
#define USE_FLOCK_LOCK
#define USE_DOT_LOCK
#define HAS_FSYNC
+/* might be set by makedef */
+#ifdef HAS_DB
+#define DEF_DB_TYPE "hash"
+#define ALIAS_DB_MAP "hash:/etc/aliases"
+#else
#define HAS_DBM
#define DEF_DB_TYPE "dbm"
#define ALIAS_DB_MAP "dbm:/etc/aliases"
-extern int optind; /* XXX verify */
-extern char *optarg; /* XXX verify */
-extern int opterr; /* XXX verify */
+#endif
+extern int optind;
+extern char *optarg;
+extern int opterr;
+#define MISSING_STRFTIME_E
#define HAS_NIS
#define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
-#define USE_STATFS /* XXX verify */
-#define STATFS_IN_SYS_VFS_H /* XXX verify */
-#define memmove(d,s,l) bcopy(s,d,l) /* XXX verify */
+#define USE_STATFS
+#define USE_STRUCT_FS_DATA
+#define STATFS_IN_SYS_MOUNT_H
+/* 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
#endif
#ifdef OSF1
#define HAS_VOLATILE_LOCKS
#endif
-#ifdef UW7 /* UnixWare 7 */
+#ifdef UW7 /* UnixWare 7 */
#define SUPPORTED
#include <sys/types.h>
#define _PATH_MAILDIR "/var/mail"
#define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
#endif
-#ifdef UW21 /* UnixWare 2.1.x */
-#define SUPPORTED
-#include <sys/types.h>
-#define _PATH_MAILDIR "/var/mail"
-#define _PATH_BSHELL "/bin/sh"
-#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
-#define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb"
-#define MISSING_SETENV
-#define USE_FCNTL_LOCK
-#define USE_DOT_LOCK
-#define HAS_FSYNC
+#ifdef UW21 /* UnixWare 2.1.x */
+#define SUPPORTED
+#include <sys/types.h>
+#define _PATH_MAILDIR "/var/mail"
+#define _PATH_BSHELL "/bin/sh"
+#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb"
+#define MISSING_SETENV
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
#define HAS_DBM
-#define DEF_DB_TYPE "dbm"
-#define ALIAS_DB_MAP "dbm:/etc/mail/aliases"
+#define DEF_DB_TYPE "dbm"
+#define ALIAS_DB_MAP "dbm:/etc/mail/aliases"
/* Uncomment the following line if you have NIS package installed
#define HAS_NIS */
-#define USE_SYS_SOCKIO_H
-#define GETTIMEOFDAY(t) gettimeofday(t,NULL)
+#define USE_SYS_SOCKIO_H
+#define GETTIMEOFDAY(t) gettimeofday(t,NULL)
#define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
-#define FIONREAD_IN_SYS_FILIO_H
-#define DBM_NO_TRAILING_NULL
-#define USE_STATVFS
-#define STATVFS_IN_SYS_STATVFS_H
+#define FIONREAD_IN_SYS_FILIO_H
+#define DBM_NO_TRAILING_NULL
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
#define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
#endif
#endif
+#ifdef AIX3
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_BSHELL "/bin/sh"
+#define _PATH_MAILDIR "/var/spool/mail" /* paths.h lies */
+#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
+#define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define USE_SYS_SELECT_H
+#define HAS_FSYNC
+#define HAS_DBM
+#define DEF_DB_TYPE "dbm"
+#define ALIAS_DB_MAP "dbm:/etc/aliases"
+#define HAS_NIS
+#define HAS_SA_LEN
+#define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0)
+#define RESOLVE_H_NEEDS_STDIO_H
+#define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define SOCKADDR_SIZE size_t
+#define SOCKOPT_SIZE size_t
+#define USE_STATFS
+#define STATFS_IN_SYS_STATFS_H
+#define STRCASECMP_IN_STRINGS_H
+extern time_t time(time_t *);
+extern int seteuid(uid_t);
+extern int setegid(gid_t);
+extern int initgroups(const char *, int);
+
+#endif
+
#if defined(IRIX5) || defined(IRIX6)
#define SUPPORTED
#include <sys/types.h>
#define WEXITSTATUS(x) ((x).w_retcode)
#define WTERMSIG(x) ((x).w_termsig)
#define NORETURN /* the native compiler */
+#endif
+
+#ifdef ReliantUnix543
+#define SUPPORTED
+#include <sys/types.h>
+#define MISSING_SETENV
+#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
+#define _PATH_BSHELL "/bin/sh"
+#define _PATH_MAILDIR "/var/spool/mail"
+#define USE_FCNTL_LOCK
+#define USE_DOT_LOCK
+#define HAS_FSYNC
+#define FIONREAD_IN_SYS_FILIO_H
+#define USE_SYS_SOCKIO_H
+#define HAS_DBM
+#define DEF_DB_TYPE "dbm"
+#define ALIAS_DB_MAP "dbm:/var/adm/sendmail/aliases"
+extern int optind; /* XXX use <getopt.h> */
+extern char *optarg; /* XXX use <getopt.h> */
+extern int opterr; /* XXX use <getopt.h> */
+
+#define HAS_NIS
+#define GETTIMEOFDAY(t) gettimeofday(t)
+#define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
+#define USE_STATVFS
+#define STATVFS_IN_SYS_STATVFS_H
+#define usleep doze
#endif
/*
#error "unsupported platform"
#endif
+#ifdef DUP2_DUPS_CLOSE_ON_EXEC
+/* dup2_pass_on_exec() can be found in util/sys_compat.c */
+extern int dup2_pass_on_exec(int oldd, int newd);
+
+#define DUP2 dup2_pass_on_exec
+#else
+#define DUP2 dup2
+#endif
+
#ifdef PREPEND_PLUS_TO_OPTSTRING
#define GETOPT(argc, argv, str) getopt((argc), (argv), "+" str)
#else
/* SUMMARY
/* connect operation with timeout
/* SYNOPSIS
+/* #include <sys/socket.h>
/* #include <timed_connect.h>
/* DESCRIPTION
/* .nf
- /*
- * System library.
- */
-#include <sys/socket.h>
-
/*
* External interface.
*/
msg_warn("close: %m");
for (fd = 0; fd < 2; fd++)
if (sockfd[0] != fd)
- if (dup2(sockfd[0], fd) < 0)
+ if (DUP2(sockfd[0], fd) < 0)
msg_fatal("dup2: %m");
if (sockfd[0] >= 2 && close(sockfd[0]))
msg_warn("close: %m");