From: Wietse Venema Date: Sun, 27 Jun 1999 05:00:00 +0000 (-0500) Subject: snapshot-19990627 X-Git-Tag: v20010228~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8367417bc61f697e65d2241219668d4c45e93403;p=thirdparty%2Fpostfix.git snapshot-19990627 --- diff --git a/postfix/.indent.pro b/postfix/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/.indent.pro +++ b/postfix/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/0README b/postfix/0README index 0ba0a5255..6f5012997 100644 --- a/postfix/0README +++ b/postfix/0README @@ -39,8 +39,8 @@ On-line resources devoted to the Postfix mail system 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): @@ -81,14 +81,17 @@ an absolute path) for UNIX-style on-line manual pages. These pages 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 @@ -125,6 +128,7 @@ Postfix daemons: bounce/ Bounce or defer mail cleanup/ Canonicalize and enqueue mail + error/ Trivial error mailer local/ Local delivery master/ Postfix resident superserver pickup/ Local pickup @@ -142,7 +146,8 @@ Test programs: Miscellaneous: - bin/ Installed programs + bin/ Postfix command executables conf/ Sample configuration files include/ Installed include files lib/ Installed object libraries + libexec/ Postfix daemon executables diff --git a/postfix/HISTORY b/postfix/HISTORY index cc6a04edf..4c8056521 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -1977,7 +1977,8 @@ Apologies for any names omitted. 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(). @@ -2796,8 +2797,93 @@ Apologies for any names omitted. 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. diff --git a/postfix/LICENSE b/postfix/LICENSE index 5e83ceb25..2f1ba0c2f 100644 --- a/postfix/LICENSE +++ b/postfix/LICENSE @@ -1,59 +1,221 @@ -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. diff --git a/postfix/MYSQL_README b/postfix/MYSQL_README new file mode 100644 index 000000000..97735bd1e --- /dev/null +++ b/postfix/MYSQL_README @@ -0,0 +1,89 @@ +[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. + diff --git a/postfix/Makefile.in b/postfix/Makefile.in index af7264a69..008a183c2 100644 --- a/postfix/Makefile.in +++ b/postfix/Makefile.in @@ -13,7 +13,7 @@ makefiles Makefiles: (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 \ @@ -36,7 +36,7 @@ tidy: clean 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 diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 9744e68cf..cfa6d220f 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -1,3 +1,34 @@ +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: =========================================== @@ -167,11 +198,6 @@ queues. - 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 diff --git a/postfix/ULTRIX_README b/postfix/ULTRIX_README new file mode 100644 index 000000000..ef43fe6d0 --- /dev/null +++ b/postfix/ULTRIX_README @@ -0,0 +1,34 @@ +To: wietse@porcupine.org (Wietse Venema) +Subject: postfix-19990317-pl05 on Ultrix4.3a +From: Christian von Roques +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] diff --git a/postfix/bin/.keep b/postfix/bin/.keep old mode 100644 new mode 100755 diff --git a/postfix/bounce/.indent.pro b/postfix/bounce/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/bounce/.indent.pro +++ b/postfix/bounce/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/bounce/Makefile.in b/postfix/bounce/Makefile.in index f8e313286..f2070a7ce 100644 --- a/postfix/bounce/Makefile.in +++ b/postfix/bounce/Makefile.in @@ -21,7 +21,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/cleanup/.indent.pro b/postfix/cleanup/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/cleanup/.indent.pro +++ b/postfix/cleanup/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/cleanup/Makefile.in b/postfix/cleanup/Makefile.in index 2ee78f30e..717854cec 100644 --- a/postfix/cleanup/Makefile.in +++ b/postfix/cleanup/Makefile.in @@ -25,7 +25,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) @@ -117,6 +117,8 @@ cleanup_extracted.o: ../include/mymalloc.h 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 diff --git a/postfix/cleanup/cleanup_envelope.c b/postfix/cleanup/cleanup_envelope.c index e7c29bf1c..dab3525e0 100644 --- a/postfix/cleanup/cleanup_envelope.c +++ b/postfix/cleanup/cleanup_envelope.c @@ -78,7 +78,8 @@ void cleanup_envelope(void) } 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) @@ -90,7 +91,8 @@ void cleanup_envelope(void) 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; } @@ -117,7 +119,8 @@ void cleanup_envelope(void) 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; } diff --git a/postfix/cleanup/cleanup_extracted.c b/postfix/cleanup/cleanup_extracted.c index 3bd442b79..1057273f5 100644 --- a/postfix/cleanup/cleanup_extracted.c +++ b/postfix/cleanup/cleanup_extracted.c @@ -90,7 +90,8 @@ void cleanup_extracted(void) } 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(); diff --git a/postfix/cleanup/cleanup_map11.c b/postfix/cleanup/cleanup_map11.c index 0680191a8..96069324a 100644 --- a/postfix/cleanup/cleanup_map11.c +++ b/postfix/cleanup/cleanup_map11.c @@ -103,8 +103,8 @@ void cleanup_map11_external(VSTRING *addr, MAPS *maps, int propagate) 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)); diff --git a/postfix/cleanup/cleanup_message.c b/postfix/cleanup/cleanup_message.c index 592a8696d..2a862e54c 100644 --- a/postfix/cleanup/cleanup_message.c +++ b/postfix/cleanup/cleanup_message.c @@ -391,7 +391,8 @@ void cleanup_message(void) 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; } diff --git a/postfix/cleanup/cleanup_out.c b/postfix/cleanup/cleanup_out.c index dd51383e6..7be237040 100644 --- a/postfix/cleanup/cleanup_out.c +++ b/postfix/cleanup/cleanup_out.c @@ -84,7 +84,8 @@ void cleanup_out(int type, char *string, int len) 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); diff --git a/postfix/cleanup/cleanup_skip.c b/postfix/cleanup/cleanup_skip.c index 00f73aa4b..d9d22ed5c 100644 --- a/postfix/cleanup/cleanup_skip.c +++ b/postfix/cleanup/cleanup_skip.c @@ -46,7 +46,7 @@ void cleanup_skip(void) { 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. diff --git a/postfix/conf/LICENSE b/postfix/conf/LICENSE index 5e83ceb25..2f1ba0c2f 100644 --- a/postfix/conf/LICENSE +++ b/postfix/conf/LICENSE @@ -1,59 +1,221 @@ -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. diff --git a/postfix/conf/main.cf b/postfix/conf/main.cf index 79e998acc..46e964de2 100644 --- a/postfix/conf/main.cf +++ b/postfix/conf/main.cf @@ -192,6 +192,18 @@ program_directory = /some/where/postfix/bin #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 diff --git a/postfix/conf/main.cf.default b/postfix/conf/main.cf.default deleted file mode 100644 index f95f192c4..000000000 --- a/postfix/conf/main.cf.default +++ /dev/null @@ -1,136 +0,0 @@ -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 = diff --git a/postfix/conf/postfix-script-nosgid b/postfix/conf/postfix-script-nosgid index c0786dff7..471856d1f 100755 --- a/postfix/conf/postfix-script-nosgid +++ b/postfix/conf/postfix-script-nosgid @@ -66,6 +66,10 @@ cd $daemon_directory || { $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 diff --git a/postfix/conf/postfix-script-sgid b/postfix/conf/postfix-script-sgid index 68327e610..2ba58b979 100755 --- a/postfix/conf/postfix-script-sgid +++ b/postfix/conf/postfix-script-sgid @@ -66,6 +66,10 @@ cd $daemon_directory || { $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 diff --git a/postfix/conf/sample-local.cf b/postfix/conf/sample-local.cf index e46b20592..b07c1c9d6 100644 --- a/postfix/conf/sample-local.cf +++ b/postfix/conf/sample-local.cf @@ -149,3 +149,15 @@ local_destination_concurrency_limit = 2 # 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 diff --git a/postfix/dns/.indent.pro b/postfix/dns/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/dns/.indent.pro +++ b/postfix/dns/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/dns/Makefile.in b/postfix/dns/Makefile.in index f44595382..5deff368a 100644 --- a/postfix/dns/Makefile.in +++ b/postfix/dns/Makefile.in @@ -20,7 +20,7 @@ INC_DIR = ../include 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) diff --git a/postfix/error/.indent.pro b/postfix/error/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/error/.indent.pro +++ b/postfix/error/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/error/Makefile.in b/postfix/error/Makefile.in index 62f013b27..5e0542b9c 100644 --- a/postfix/error/Makefile.in +++ b/postfix/error/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/fsstone/.indent.pro b/postfix/fsstone/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/fsstone/.indent.pro +++ b/postfix/fsstone/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/fsstone/Makefile.in b/postfix/fsstone/Makefile.in index 21d5d58de..92dbdc3f6 100644 --- a/postfix/fsstone/Makefile.in +++ b/postfix/fsstone/Makefile.in @@ -18,7 +18,7 @@ LIBS = ../lib/libglobal.a ../lib/libutil.a 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) diff --git a/postfix/global/.indent.pro b/postfix/global/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/global/.indent.pro +++ b/postfix/global/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/global/Makefile.in b/postfix/global/Makefile.in index cc1c3b7cc..887f2af41 100644 --- a/postfix/global/Makefile.in +++ b/postfix/global/Makefile.in @@ -16,7 +16,8 @@ SRCS = been_here.c bounce.c canon_addr.c cleanup_strerror.c clnt_stream.c \ 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 \ @@ -34,7 +35,8 @@ OBJS = been_here.o bounce.o canon_addr.o cleanup_strerror.o clnt_stream.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 \ @@ -48,7 +50,7 @@ HDRS = been_here.h bounce.h canon_addr.h cleanup_user.h clnt_stream.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 \ @@ -72,7 +74,7 @@ MAKES = 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) @@ -330,6 +332,14 @@ dot_lockfile.o: ../include/stringops.h 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 diff --git a/postfix/global/dot_lockfile.c b/postfix/global/dot_lockfile.c index 599343679..6921298d8 100644 --- a/postfix/global/dot_lockfile.c +++ b/postfix/global/dot_lockfile.c @@ -107,6 +107,7 @@ int dot_lockfile(const char *path, VSTRING *why) 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); diff --git a/postfix/global/dot_lockfile_as.c b/postfix/global/dot_lockfile_as.c new file mode 100644 index 000000000..7ee84d9e5 --- /dev/null +++ b/postfix/global/dot_lockfile_as.c @@ -0,0 +1,99 @@ +/*++ +/* NAME +/* dot_lockfile_as 3 +/* SUMMARY +/* dotlock file as user +/* SYNOPSIS +/* #include +/* +/* 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 +#include + +/* 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); +} diff --git a/postfix/global/dot_lockfile_as.h b/postfix/global/dot_lockfile_as.h new file mode 100644 index 000000000..539a70a4f --- /dev/null +++ b/postfix/global/dot_lockfile_as.h @@ -0,0 +1,36 @@ +#ifndef _DOT_LOCKFILE_AS_H_INCLUDED_ +#define _DOT_LOCKFILE_AS_H_INCLUDED_ + +/*++ +/* NAME +/* dot_lockfile_as 3h +/* SUMMARY +/* dotlock file management +/* SYNOPSIS +/* #include +/* DESCRIPTION +/* .nf + + /* + * Utility library. + */ +#include + + /* + * 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 diff --git a/postfix/global/mail_params.c b/postfix/global/mail_params.c index a98e2b018..00d15ef8f 100644 --- a/postfix/global/mail_params.c +++ b/postfix/global/mail_params.c @@ -272,7 +272,7 @@ void mail_params_init() 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, diff --git a/postfix/global/mail_params.h b/postfix/global/mail_params.h index 517e6fc5a..ca210bf3c 100644 --- a/postfix/global/mail_params.h +++ b/postfix/global/mail_params.h @@ -342,9 +342,13 @@ abcdefghijklmnopqrstuvwxyz\ 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 diff --git a/postfix/global/mail_version.h b/postfix/global/mail_version.h index bdc015579..1533094f1 100644 --- a/postfix/global/mail_version.h +++ b/postfix/global/mail_version.h @@ -15,7 +15,7 @@ * 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 diff --git a/postfix/global/pipe_command.c b/postfix/global/pipe_command.c index 9d3bd5abd..f697a19e0 100644 --- a/postfix/global/pipe_command.c +++ b/postfix/global/pipe_command.c @@ -368,9 +368,9 @@ int pipe_command(VSTREAM *src, VSTRING *why,...) */ 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]); diff --git a/postfix/html/Makefile.in b/postfix/html/Makefile.in index 7180aced6..70cbbba4a 100644 --- a/postfix/html/Makefile.in +++ b/postfix/html/Makefile.in @@ -13,7 +13,7 @@ CONFIG = access.5.html aliases.5.html canonical.5.html relocated.5.html \ 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 diff --git a/postfix/html/faq.html b/postfix/html/faq.html index 0564efbd2..d942cb7af 100644 --- a/postfix/html/faq.html +++ b/postfix/html/faq.html @@ -531,19 +531,32 @@ making Postfix more secure than ordinary mailers.

Getting rid of Delivered-To:

-Some people will complain about the ugly Delivered-To: -message header that Postfix prepends to their mail. +Some people will complain about the ugly Delivered-To: +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.

-With the Postfix architecture, Delivered-To: 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 ~/.mailrc -and /usr/lib/Mail.rc). +Solutions, ranging from fighting symptoms to turning off the +Delivered-To: header:

+

    + +
  • + +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 ~/.mailrc and /usr/lib/Mail.rc). + +

    + +

  • + With mailing lists, Delivered-To: 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 @@ -584,6 +597,17 @@ Postfix source directory.

    +

  • + +The prepend_delivered_header configuration parameter controls +when Delivered-To: is prepended. The default setting is +command, file, forward. Turning off Delivered-To: +when forwarding mail is not recommended. + +
+ +

+ See also the FAQ item for problems with the majordomo approve command. diff --git a/postfix/html/local.8.html b/postfix/html/local.8.html index 3440d9bee..11f21fcc3 100644 --- a/postfix/html/local.8.html +++ b/postfix/html/local.8.html @@ -120,11 +120,11 @@ LOCAL(8) LOCAL(8) In the case of UNIX-style mailbox delivery, the local dae- mon prepends a "From sender time_stamp" envelope header to - each message, prepends a Delivered-To: header with the - envelope recipient address, prepends a Return-Path: header - with the envelope sender address, prepends a > character - to lines beginning with "From ", and appends an empty - line. The mailbox is locked for exclusive access while + each message, prepends an optional Delivered-To: header + with the envelope recipient address, prepends a Return- + Path: header with the envelope sender address, prepends a + > character to lines beginning with "From ", and appends + an empty line. The mailbox is locked for exclusive access @@ -137,34 +137,35 @@ LOCAL(8) LOCAL(8) 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 maildir delivery, the local daemon prepends - a Delivered-To: header with the envelope recipient address - and prepends a Return-Path: header with the envelope - sender address. + an optional Delivered-To: header with the envelope recipi- + ent address and prepends a Return-Path: header with the + envelope sender address. EXTERNAL COMMAND DELIVERY - The allow_mail_to_commands configuration parameter - restricts delivery to external commands. The default set- - ting (alias, forward) forbids command destinations in + The allow_mail_to_commands configuration parameter + restricts delivery to external commands. The default set- + ting (alias, forward) forbids command destinations in :include: files. - The command is executed directly where possible. Assis- - tance by the shell (/bin/sh 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 (/bin/sh 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 command_time_limit 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 command_time_limit seconds. + Command exit status codes are expected to follow the con- ventions defined in <sysexits.h>. - 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 command_expan- sion_filter configuration parameter. @@ -190,7 +191,6 @@ LOCAL(8) LOCAL(8) The entire recipient address. The PATH environment variable is always reset to a system- - dependent default path, and the TZ (time zone) environment @@ -203,37 +203,39 @@ LOCAL(8) LOCAL(8) LOCAL(8) LOCAL(8) + dependent default path, and the TZ (time zone) environment variable is always passed on without change. The current working directory is the mail queue directory. The local daemon prepends a "From sender time_stamp" enve- - lope header to each message, prepends a Delivered-To: - header with the recipient envelope address, prepends a - Return-Path: header with the sender envelope address, and - appends an empty line. + lope header to each message, prepends an optional Deliv- + ered-To: header with the recipient envelope address, + prepends a Return-Path: header with the sender envelope + address, and appends an empty line. EXTERNAL FILE DELIVERY - The allow_mail_to_files configuration parameter restricts - delivery to external files. The default setting (alias, - forward) forbids file destinations in :include: files. + The allow_mail_to_files configuration parameter restricts + delivery to external files. The default setting (alias, + forward) forbids file destinations in :include: files. Specify a pathname ending in / for qmail-compatible maildir delivery. The local daemon prepends a "From sender time_stamp" enve- - lope header to each message, prepends a Delivered-To: - header with the recipient envelope address, prepends a > - character to lines beginning with "From ", and appends an - empty line. The envelope sender address is available in - the Return-Path: 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 Deliv- + ered-To: header with the recipient envelope address, + prepends a > character to lines beginning with "From ", + and appends an empty line. The envelope sender address is + available in the Return-Path: 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 maildir delivery, the local daemon prepends - a Delivered-To: header with the envelope recipient - address. The envelope sender address is available in the - Return-Path: header. + an optional Delivered-To: header with the envelope recipi- + ent address. The envelope sender address is available in + the Return-Path: header. ADDRESS EXTENSION The optional recipient_delimiter configuration parameter @@ -246,8 +248,8 @@ LOCAL(8) LOCAL(8) ward+foo or in ~name/.forward, to the mailbox owned by the user name, or it is sent back as undeliverable. - In all cases the local daemon prepends a `Delivered-To: - name+foo' header line. + In all cases the local daemon prepends an opional `Deliv- + ered-To: name+foo' header line. DELIVERY RIGHTS Deliveries to external files and external commands are @@ -255,8 +257,6 @@ LOCAL(8) LOCAL(8) the delivery is made. In the absence of a user context, the local daemon uses the owner rights of the :include: file or alias database. When those files are owned by the - superuser, delivery is made with the rights specified with - the default_privs configuration parameter. @@ -269,6 +269,9 @@ LOCAL(8) LOCAL(8) LOCAL(8) LOCAL(8) + superuser, delivery is made with the rights specified with + the default_privs configuration parameter. + STANDARDS RFC 822 (ARPA Internet Text Messages) @@ -302,27 +305,24 @@ LOCAL(8) LOCAL(8) alias_maps List of alias databases. + expand_owner_alias + 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. + forward_path Search list for .forward files. The names are sub- ject to $name expansion. local_command_shell - 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. - owner_request_special - Give special treatment to owner-xxx and xxx-request - addresses. - recipient_delimiter - Separator between username and address extension. - -Mailbox delivery - fallback_transport - Message transport for recipients that are not found @@ -335,43 +335,72 @@ LOCAL(8) LOCAL(8) LOCAL(8) LOCAL(8) - in the UNIX passwd database. This parameter over- + prepend_delivered_header + Prepend an optional Delivered-To: header upon + external forwarding, delivery to command or file. + Specify zero or more of: command, file, forward. + Turning off Delivered-To: when forwarding mail is + not recommended. + + owner_request_special + Give special treatment to owner-xxx and xxx-request + addresses. + + recipient_delimiter + Separator between username and address extension. + +Mailbox delivery + fallback_transport + Message transport for recipients that are not found + in the UNIX passwd database. This parameter over- rides luser_relay. home_mailbox - 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 / for maildir- style delivery. luser_relay - Destination (@domain or address) for non-existent - users. The address is subjected to $name expan- + Destination (@domain or address) for non-existent + users. The address is subjected to $name expan- sion. mail_spool_directory - Directory with UNIX-style mailboxes. The default + Directory with UNIX-style mailboxes. The default pathname is system dependent. mailbox_command - 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. mailbox_transport - 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 luser_relay. Locking controls deliver_lock_attempts - 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. deliver_lock_delay - Time in seconds between successive attempts to + Time in seconds between successive attempts to + + + + 6 + + + + + +LOCAL(8) LOCAL(8) + + acquire an exclusive lock. stale_lock_time @@ -379,63 +408,65 @@ LOCAL(8) LOCAL(8) Resource controls command_time_limit - Limit the amount of time for delivery to external + Limit the amount of time for delivery to external command. duplicate_filter_limit - Limit the size of the duplicate filter for results + Limit the size of the duplicate filter for results from alias etc. expansion. line_length_limit - 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) - - local_destination_concurrency_limit 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 default_destination_concurrency_limit parameter. local_destination_recipient_limit - 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 default_destination_recipient_limit parameter. Security controls allow_mail_to_commands - Restrict the usage of mail delivery to external + Restrict the usage of mail delivery to external command. allow_mail_to_files - Restrict the usage of mail delivery to external + Restrict the usage of mail delivery to external file. command_expansion_filter - 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. default_privs - Default rights for delivery to external file or + Default rights for delivery to external file or command. HISTORY - The Delivered-To: header appears in the qmail system by + The Delivered-To: header appears in the qmail system by Daniel Bernstein. - The maildir structure appears in the qmail system by + The maildir structure appears in the qmail system by Daniel Bernstein. + + + + + 7 + + + + + +LOCAL(8) LOCAL(8) + + SEE ALSO aliases(5) format of alias database bounce(8) non-delivery status reports @@ -444,7 +475,7 @@ LOCAL(8) LOCAL(8) qmgr(8) queue manager LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) @@ -458,7 +489,42 @@ LOCAL(8) LOCAL(8) - 7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 diff --git a/postfix/html/postalias.1.html b/postfix/html/postalias.1.html index c91c73756..af47d3897 100644 --- a/postfix/html/postalias.1.html +++ b/postfix/html/postalias.1.html @@ -39,7 +39,7 @@ POSTALIAS(1) POSTALIAS(1) tiple -v options make the software increasingly verbose. - B-w Do not warn about duplicate entries; silently + -w Do not warn about duplicate entries; silently ignore them. Arguments: diff --git a/postfix/html/uce.html b/postfix/html/uce.html index 1f206e176..a4654e46d 100644 --- a/postfix/html/uce.html +++ b/postfix/html/uce.html @@ -337,6 +337,8 @@ code for REJECT results (default: 554).

+

reject_maps_rbl +
reject_unknown_client
permit_mynetworks @@ -447,6 +449,8 @@ response code to rejected requests (default: 504).

+

reject_maps_rbl +
reject_unknown_client
permit_mynetworks @@ -589,6 +593,8 @@ response code to rejected requests (default: 504).

+

reject_maps_rbl +
reject_unknown_client
permit_mynetworks @@ -677,6 +683,8 @@ the request if the result is anything else. The access_map_reject_code

+

reject_maps_rbl +
reject_unknown_client
permit_mynetworks diff --git a/postfix/libexec/.keep b/postfix/libexec/.keep old mode 100644 new mode 100755 diff --git a/postfix/local/.indent.pro b/postfix/local/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/local/.indent.pro +++ b/postfix/local/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/local/Makefile.in b/postfix/local/Makefile.in index 38e36a2bb..44ebc090a 100644 --- a/postfix/local/Makefile.in +++ b/postfix/local/Makefile.in @@ -1,11 +1,11 @@ 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 = @@ -25,7 +25,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) @@ -97,8 +97,6 @@ command.o: ../include/vstring.h 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 @@ -169,22 +167,6 @@ dotforward.o: ../include/tok822.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 @@ -200,6 +182,7 @@ file.o: ../include/defer.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 @@ -408,9 +391,11 @@ token.o: ../include/htable.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 diff --git a/postfix/local/alias.c b/postfix/local/alias.c index cd975ebcd..00c241eec 100644 --- a/postfix/local/alias.c +++ b/postfix/local/alias.c @@ -135,6 +135,7 @@ int deliver_alias(LOCAL_STATE state, USER_ATTR usr_attr, struct mypasswd *alias_pwd; VSTRING *canon_owner; DICT *dict; + const char *owner_rhs; /* owner alias, RHS */ /* * Make verbose logging easier to understand. @@ -249,9 +250,10 @@ int deliver_alias(LOCAL_STATE state, USER_ATTR usr_attr, 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; diff --git a/postfix/local/command.c b/postfix/local/command.c index edf29d47f..ee1c84308 100644 --- a/postfix/local/command.c +++ b/postfix/local/command.c @@ -130,7 +130,7 @@ int deliver_command(LOCAL_STATE state, USER_ATTR usr_attr, char *command) * 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); diff --git a/postfix/local/deliver_attr.c b/postfix/local/deliver_attr.c index 11dbf09a5..7a77bce75 100644 --- a/postfix/local/deliver_attr.c +++ b/postfix/local/deliver_attr.c @@ -62,7 +62,6 @@ void deliver_attr_init(DELIVER_ATTR *attrp) attrp->relay = 0; attrp->exp_type = 0; attrp->exp_from = 0; - attrp->features = 0; } /* deliver_attr_dump - log message delivery attributes */ @@ -87,5 +86,4 @@ void deliver_attr_dump(DELIVER_ATTR *attrp) 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); } diff --git a/postfix/local/dotforward.c b/postfix/local/dotforward.c index ed1e13429..51568bbf7 100644 --- a/postfix/local/dotforward.c +++ b/postfix/local/dotforward.c @@ -147,7 +147,6 @@ int deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp) * these are the rights of root, the /file and |command delivery routines * will use unprivileged default rights instead. Better safe than sorry. */ - if (mypwd->pw_uid != 0) SET_USER_ATTR(usr_attr, mypwd, state.level); /* diff --git a/postfix/local/feature.c b/postfix/local/feature.c deleted file mode 100644 index 1a1db60f4..000000000 --- a/postfix/local/feature.c +++ /dev/null @@ -1,91 +0,0 @@ -/*++ -/* 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 -#include - -#ifdef STRCASECMP_IN_STRINGS_H -#include -#endif - -/* Utility library. */ - -#include -#include -#include - -/* Global library. */ - -#include - -/* 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); -} diff --git a/postfix/local/file.c b/postfix/local/file.c index 3b8dcc449..488c5df01 100644 --- a/postfix/local/file.c +++ b/postfix/local/file.c @@ -68,6 +68,7 @@ #include #include #include +#include /* Application-specific. */ @@ -87,6 +88,11 @@ int deliver_file(LOCAL_STATE state, USER_ATTR usr_attr, char *path) int status; int copy_flags; +#ifdef USE_DOT_LOCK + int lock = -1; + +#endif + /* * Make verbose logging easier to understand. */ @@ -143,7 +149,7 @@ int deliver_file(LOCAL_STATE state, USER_ATTR usr_attr, char *path) * 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) ( \ @@ -166,6 +172,14 @@ int deliver_file(LOCAL_STATE state, USER_ATTR usr_attr, char *path) 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), @@ -178,6 +192,10 @@ int deliver_file(LOCAL_STATE state, USER_ATTR usr_attr, char *path) /* * 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); } diff --git a/postfix/local/forward.c b/postfix/local/forward.c index 2c9060ad0..3d66a8cff 100644 --- a/postfix/local/forward.c +++ b/postfix/local/forward.c @@ -205,8 +205,9 @@ static int forward_send(FORWARD_INFO *info, DELIVER_ATTR attr, char *delivered) 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:", diff --git a/postfix/local/local.c b/postfix/local/local.c index 91cdfc96a..e75c9a149 100644 --- a/postfix/local/local.c +++ b/postfix/local/local.c @@ -102,7 +102,8 @@ /* /* 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. @@ -111,7 +112,8 @@ /* 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 @@ -162,7 +164,8 @@ /* 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. @@ -176,7 +179,8 @@ /* \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. @@ -187,7 +191,8 @@ /* 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 @@ -204,7 +209,7 @@ /* 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 @@ -246,6 +251,10 @@ /* .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. @@ -254,6 +263,11 @@ /* /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. @@ -415,10 +429,13 @@ char *var_fallback_transport; 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 */ @@ -536,10 +553,17 @@ static void local_mask_init(void) "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 */ @@ -578,17 +602,18 @@ int main(int argc, char **argv) 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, }; diff --git a/postfix/local/local.h b/postfix/local/local.h index 63e7b1fcc..0332cebc0 100644 --- a/postfix/local/local.h +++ b/postfix/local/local.h @@ -79,7 +79,6 @@ typedef struct DELIVER_ATTR { 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 *); @@ -89,8 +88,6 @@ extern void deliver_attr_dump(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 @@ -169,6 +166,15 @@ extern int local_cmd_deliver_mask; */ 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 */ diff --git a/postfix/local/mailbox.c b/postfix/local/mailbox.c index da51c7ddd..31beaa179 100644 --- a/postfix/local/mailbox.c +++ b/postfix/local/mailbox.c @@ -176,7 +176,7 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) * 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); diff --git a/postfix/local/maildir.c b/postfix/local/maildir.c index 50d843606..ec8eca5e9 100644 --- a/postfix/local/maildir.c +++ b/postfix/local/maildir.c @@ -101,7 +101,7 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path) 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); diff --git a/postfix/local/recipient.c b/postfix/local/recipient.c index 5cc549d12..f962c7608 100644 --- a/postfix/local/recipient.c +++ b/postfix/local/recipient.c @@ -204,7 +204,6 @@ int deliver_recipient(LOCAL_STATE state, USER_ATTR usr_attr) 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. diff --git a/postfix/local/token.c b/postfix/local/token.c index 6f788a328..d9ca86d4c 100644 --- a/postfix/local/token.c +++ b/postfix/local/token.c @@ -26,7 +26,10 @@ /* 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. @@ -88,16 +91,43 @@ #include #include #include +#include /* Global library. */ #include #include +#include /* 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) @@ -115,6 +145,8 @@ 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) { diff --git a/postfix/makedefs b/postfix/makedefs index 50e58dec2..dbdd3b3e5 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -116,11 +116,32 @@ case "$SYSTEM.$RELEASE" in 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" ;; @@ -170,6 +191,12 @@ HP-UX.B.11.*) SYSTYPE=HPUX11 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;}'` diff --git a/postfix/man/Makefile.in b/postfix/man/Makefile.in index df598450a..c776af6da 100644 --- a/postfix/man/Makefile.in +++ b/postfix/man/Makefile.in @@ -13,7 +13,7 @@ CONFIG = man5/access.5 man5/aliases.5 man5/canonical.5 man5/relocated.5 \ 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?/* diff --git a/postfix/man/man1/postalias.1 b/postfix/man/man1/postalias.1 index 22e0ca9fd..e81b4d17f 100644 --- a/postfix/man/man1/postalias.1 +++ b/postfix/man/man1/postalias.1 @@ -34,7 +34,7 @@ a new database from the entries in \fBfile_name\fR. .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: diff --git a/postfix/man/man8/local.8 b/postfix/man/man8/local.8 index 9142b6a0f..b0b165d6d 100644 --- a/postfix/man/man8/local.8 +++ b/postfix/man/man8/local.8 @@ -114,7 +114,8 @@ for recipients that are not found in the UNIX passwd database. 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. @@ -123,7 +124,8 @@ progress. In case of problems, an attempt is made to truncate the 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 @@ -176,7 +178,8 @@ environment variable is always passed on without change. 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. @@ -192,7 +195,8 @@ Specify a pathname ending in \fB/\fR for \fBqmail\fR-compatible \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. @@ -203,7 +207,8 @@ 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 \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 @@ -222,7 +227,7 @@ or to the alias \fIname\fR, to the destinations listed in 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 @@ -274,6 +279,10 @@ a configuration change. .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. @@ -282,6 +291,11 @@ Shell to use for external command execution (for example, /some/where/smrsh -c). When a shell is specified, it is invoked even when the command contains no shell built-in commands or meta characters. +.IP \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. diff --git a/postfix/master/.indent.pro b/postfix/master/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/master/.indent.pro +++ b/postfix/master/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/master/Makefile.in b/postfix/master/Makefile.in index fe194f86e..9f9c4285a 100644 --- a/postfix/master/Makefile.in +++ b/postfix/master/Makefile.in @@ -27,7 +27,7 @@ BIN_DIR = ../libexec 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) diff --git a/postfix/master/master_spawn.c b/postfix/master/master_spawn.c index a1b5215c2..8568004da 100644 --- a/postfix/master/master_spawn.c +++ b/postfix/master/master_spawn.c @@ -178,14 +178,14 @@ void master_spawn(MASTER_SERV *serv) 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]); diff --git a/postfix/pickup/.indent.pro b/postfix/pickup/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/pickup/.indent.pro +++ b/postfix/pickup/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/pickup/Makefile.in b/postfix/pickup/Makefile.in index 1701c087b..d3b0f35d9 100644 --- a/postfix/pickup/Makefile.in +++ b/postfix/pickup/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/pipe/.indent.pro b/postfix/pipe/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/pipe/.indent.pro +++ b/postfix/pipe/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/pipe/Makefile.in b/postfix/pipe/Makefile.in index 0a24077ea..f58fbf045 100644 --- a/postfix/pipe/Makefile.in +++ b/postfix/pipe/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postalias/.indent.pro b/postfix/postalias/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postalias/.indent.pro +++ b/postfix/postalias/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postalias/Makefile.in b/postfix/postalias/Makefile.in index 3869efbb2..3c4690eaf 100644 --- a/postfix/postalias/Makefile.in +++ b/postfix/postalias/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postalias/postalias.c b/postfix/postalias/postalias.c index 9e6408165..d912c6750 100644 --- a/postfix/postalias/postalias.c +++ b/postfix/postalias/postalias.c @@ -28,7 +28,7 @@ /* .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: diff --git a/postfix/postcat/.indent.pro b/postfix/postcat/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postcat/.indent.pro +++ b/postfix/postcat/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postcat/Makefile.in b/postfix/postcat/Makefile.in index 490136661..68175a8ba 100644 --- a/postfix/postcat/Makefile.in +++ b/postfix/postcat/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postconf/.indent.pro b/postfix/postconf/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postconf/.indent.pro +++ b/postfix/postconf/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postconf/Makefile.in b/postfix/postconf/Makefile.in index 44875dc5d..187178306 100644 --- a/postfix/postconf/Makefile.in +++ b/postfix/postconf/Makefile.in @@ -26,7 +26,7 @@ $(PROG): $(OBJS) $(LIBS) ./$(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) diff --git a/postfix/postdrop/.indent.pro b/postfix/postdrop/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postdrop/.indent.pro +++ b/postfix/postdrop/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postdrop/Makefile.in b/postfix/postdrop/Makefile.in index 0ebc839e8..cb8ed7547 100644 --- a/postfix/postdrop/Makefile.in +++ b/postfix/postdrop/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postfix/.indent.pro b/postfix/postfix/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postfix/.indent.pro +++ b/postfix/postfix/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postfix/Makefile.in b/postfix/postfix/Makefile.in index 76135b5ea..d807c878b 100644 --- a/postfix/postfix/Makefile.in +++ b/postfix/postfix/Makefile.in @@ -20,7 +20,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postkick/.indent.pro b/postfix/postkick/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postkick/.indent.pro +++ b/postfix/postkick/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postkick/Makefile.in b/postfix/postkick/Makefile.in index 97bfe052d..9a0fd6b02 100644 --- a/postfix/postkick/Makefile.in +++ b/postfix/postkick/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postlock/.indent.pro b/postfix/postlock/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postlock/.indent.pro +++ b/postfix/postlock/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postlock/Makefile.in b/postfix/postlock/Makefile.in index dca43797f..6117bc9e7 100644 --- a/postfix/postlock/Makefile.in +++ b/postfix/postlock/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postlog/.indent.pro b/postfix/postlog/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postlog/.indent.pro +++ b/postfix/postlog/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postlog/Makefile.in b/postfix/postlog/Makefile.in index cd8afeffc..fbfad473f 100644 --- a/postfix/postlog/Makefile.in +++ b/postfix/postlog/Makefile.in @@ -20,7 +20,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postmap/.indent.pro b/postfix/postmap/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postmap/.indent.pro +++ b/postfix/postmap/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postmap/Makefile.in b/postfix/postmap/Makefile.in index d09444900..436b7d748 100644 --- a/postfix/postmap/Makefile.in +++ b/postfix/postmap/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/postsuper/.indent.pro b/postfix/postsuper/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/postsuper/.indent.pro +++ b/postfix/postsuper/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/postsuper/Makefile.in b/postfix/postsuper/Makefile.in index fa73f4a05..1b58244f9 100644 --- a/postfix/postsuper/Makefile.in +++ b/postfix/postsuper/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/qmgr/.indent.pro b/postfix/qmgr/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/qmgr/.indent.pro +++ b/postfix/qmgr/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/qmgr/Makefile.in b/postfix/qmgr/Makefile.in index 1b9d18192..41c570bc2 100644 --- a/postfix/qmgr/Makefile.in +++ b/postfix/qmgr/Makefile.in @@ -23,7 +23,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/sendmail/.indent.pro b/postfix/sendmail/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/sendmail/.indent.pro +++ b/postfix/sendmail/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/sendmail/Makefile.in b/postfix/sendmail/Makefile.in index b50388300..54ba8d538 100644 --- a/postfix/sendmail/Makefile.in +++ b/postfix/sendmail/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/showq/.indent.pro b/postfix/showq/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/showq/.indent.pro +++ b/postfix/showq/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/showq/Makefile.in b/postfix/showq/Makefile.in index da83116c4..55a1e0879 100644 --- a/postfix/showq/Makefile.in +++ b/postfix/showq/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/smtp/.indent.pro b/postfix/smtp/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/smtp/.indent.pro +++ b/postfix/smtp/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/smtp/Makefile.in b/postfix/smtp/Makefile.in index edff7061b..cd78128a3 100644 --- a/postfix/smtp/Makefile.in +++ b/postfix/smtp/Makefile.in @@ -21,7 +21,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) @@ -173,6 +173,7 @@ smtp_session.o: ../include/sys_defs.h 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 diff --git a/postfix/smtp/smtp.h b/postfix/smtp/smtp.h index 0d34d8372..e236d9a07 100644 --- a/postfix/smtp/smtp.h +++ b/postfix/smtp/smtp.h @@ -54,6 +54,7 @@ typedef struct SMTP_SESSION { VSTREAM *stream; /* network connection */ char *host; /* mail exchanger */ char *addr; /* mail exchanger */ + char *namaddr; /* mail exchanger */ int best; /* most preferred host */ } SMTP_SESSION; diff --git a/postfix/smtp/smtp_chat.c b/postfix/smtp/smtp_chat.c index 7d3547461..de11387a1 100644 --- a/postfix/smtp/smtp_chat.c +++ b/postfix/smtp/smtp_chat.c @@ -142,7 +142,7 @@ void smtp_chat_cmd(SMTP_STATE *state, char *fmt,...) * 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. @@ -177,9 +177,9 @@ SMTP_RESP *smtp_chat_resp(SMTP_STATE *state) 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 ? @@ -256,9 +256,9 @@ void smtp_chat_notify(SMTP_STATE *state) 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, ""); diff --git a/postfix/smtp/smtp_connect.c b/postfix/smtp/smtp_connect.c index 1cd81061a..429119ebe 100644 --- a/postfix/smtp/smtp_connect.c +++ b/postfix/smtp/smtp_connect.c @@ -76,6 +76,7 @@ /* System library. */ #include +#include #include #include #include @@ -158,7 +159,7 @@ static SMTP_SESSION *smtp_connect_addr(DNS_RR *addr, unsigned port, 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) @@ -274,6 +275,8 @@ SMTP_SESSION *smtp_connect_domain(char *name, unsigned port, VSTRING *why) 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); diff --git a/postfix/smtp/smtp_proto.c b/postfix/smtp/smtp_proto.c index b29b5c418..cb0080354 100644 --- a/postfix/smtp/smtp_proto.c +++ b/postfix/smtp/smtp_proto.c @@ -166,7 +166,7 @@ int smtp_helo(SMTP_STATE *state) 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 @@ -179,7 +179,7 @@ int smtp_helo(SMTP_STATE *state) 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)); @@ -201,7 +201,7 @@ int smtp_helo(SMTP_STATE *state) 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", " "))); } @@ -441,7 +441,7 @@ int smtp_xfer(SMTP_STATE *state) 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; } @@ -461,7 +461,7 @@ int smtp_xfer(SMTP_STATE *state) } 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 */ } @@ -479,7 +479,7 @@ int smtp_xfer(SMTP_STATE *state) 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; } @@ -500,14 +500,15 @@ int smtp_xfer(SMTP_STATE *state) 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; diff --git a/postfix/smtp/smtp_session.c b/postfix/smtp/smtp_session.c index 549bf1403..4e9558723 100644 --- a/postfix/smtp/smtp_session.c +++ b/postfix/smtp/smtp_session.c @@ -40,6 +40,7 @@ #include #include +#include /* Application-specific. */ @@ -55,6 +56,7 @@ SMTP_SESSION *smtp_session_alloc(VSTREAM *stream, char *host, char *addr) session->stream = stream; session->host = mystrdup(host); session->addr = mystrdup(addr); + session->namaddr = concatenate(host, "[", addr, "]", (char *) 0); session->best = 1; return (session); } @@ -66,6 +68,7 @@ void smtp_session_free(SMTP_SESSION *session) vstream_fclose(session->stream); myfree(session->host); myfree(session->addr); + myfree(session->namaddr); myfree((char *) session); } diff --git a/postfix/smtp/smtp_trouble.c b/postfix/smtp/smtp_trouble.c index 0cf53a289..2bf2c64b7 100644 --- a/postfix/smtp/smtp_trouble.c +++ b/postfix/smtp/smtp_trouble.c @@ -168,7 +168,7 @@ int smtp_site_fail(SMTP_STATE *state, int code, char *format,...) 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); @@ -215,7 +215,7 @@ int smtp_mesg_fail(SMTP_STATE *state, int code, char *format,...) 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); @@ -248,7 +248,7 @@ void smtp_rcpt_fail(SMTP_STATE *state, int code, RECIPIENT *rcpt, */ 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) { @@ -277,11 +277,11 @@ int smtp_stream_except(SMTP_STATE *state, int code, char *description) 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; } @@ -294,7 +294,7 @@ int smtp_stream_except(SMTP_STATE *state, int code, char *description) 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)); } diff --git a/postfix/smtpd/.indent.pro b/postfix/smtpd/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/smtpd/.indent.pro +++ b/postfix/smtpd/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/smtpd/Makefile.in b/postfix/smtpd/Makefile.in index ca0276f1a..a39502921 100644 --- a/postfix/smtpd/Makefile.in +++ b/postfix/smtpd/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/smtpd/smtpd.c b/postfix/smtpd/smtpd.c index c5939921e..84d740024 100644 --- a/postfix/smtpd/smtpd.c +++ b/postfix/smtpd/smtpd.c @@ -506,8 +506,8 @@ static void mail_reset(SMTPD_STATE *state) 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; diff --git a/postfix/smtpd/smtpd_check.c b/postfix/smtpd/smtpd_check.c index 1ad395d29..c3ad748e3 100644 --- a/postfix/smtpd/smtpd_check.c +++ b/postfix/smtpd/smtpd_check.c @@ -1200,12 +1200,18 @@ static int generic_checks(SMTPD_STATE *state, char *name, */ 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); } @@ -1486,6 +1492,9 @@ char *smtpd_check_rcpt(SMTPD_STATE *state, char *recipient) } 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); diff --git a/postfix/smtpstone/.indent.pro b/postfix/smtpstone/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/smtpstone/.indent.pro +++ b/postfix/smtpstone/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/smtpstone/Makefile.in b/postfix/smtpstone/Makefile.in index d96d09920..90cd11386 100644 --- a/postfix/smtpstone/Makefile.in +++ b/postfix/smtpstone/Makefile.in @@ -18,7 +18,7 @@ LIBS = ../lib/libglobal.a ../lib/libutil.a 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) diff --git a/postfix/trivial-rewrite/.indent.pro b/postfix/trivial-rewrite/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/trivial-rewrite/.indent.pro +++ b/postfix/trivial-rewrite/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/trivial-rewrite/Makefile.in b/postfix/trivial-rewrite/Makefile.in index 3c4a26354..471f06ef0 100644 --- a/postfix/trivial-rewrite/Makefile.in +++ b/postfix/trivial-rewrite/Makefile.in @@ -24,7 +24,7 @@ $(PROG): $(OBJS) $(LIBS) $(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) diff --git a/postfix/util/.indent.pro b/postfix/util/.indent.pro index 4972290d9..1817f82e0 100644 --- a/postfix/util/.indent.pro +++ b/postfix/util/.indent.pro @@ -21,6 +21,7 @@ -TDICT_ENV -TDICT_HT -TDICT_LDAP +-TDICT_MYSQL -TDICT_NI -TDICT_NIS -TDICT_NISPLUS @@ -38,6 +39,7 @@ -TFILE -TFORWARD_INFO -THEADER_OPTS +-THOST -THTABLE -THTABLE_INFO -TINET_ADDR_LIST @@ -58,12 +60,14 @@ -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 diff --git a/postfix/util/Makefile.in b/postfix/util/Makefile.in index 8ad363f7b..9d34b33fc 100644 --- a/postfix/util/Makefile.in +++ b/postfix/util/Makefile.in @@ -1,7 +1,7 @@ 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 \ @@ -23,7 +23,7 @@ SRCS = argv.c argv_split.c attr.c basename.c binhash.c chroot_uid.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 \ @@ -44,21 +44,21 @@ OBJS = argv.o argv_split.o attr.o basename.o binhash.o chroot_uid.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 @@ -67,9 +67,9 @@ CFLAGS = $(DEBUG) $(OPT) $(DEFS) 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 @@ -81,7 +81,7 @@ INC_DIR = ../include 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) @@ -120,6 +120,9 @@ clean: 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) @@ -294,6 +297,7 @@ close_on_exec.o: close_on_exec.c close_on_exec.o: sys_defs.h close_on_exec.o: msg.h close_on_exec.o: iostuff.h +compat.o: compat.c concatenate.o: concatenate.c concatenate.o: sys_defs.h concatenate.o: mymalloc.h @@ -343,6 +347,8 @@ dict_ht.o: vbuf.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 @@ -379,6 +385,7 @@ dict_open.o: dict_nis.h 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 @@ -418,6 +425,7 @@ doze.o: doze.c 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 @@ -476,7 +484,6 @@ get_hostname.o: mymalloc.h 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 diff --git a/postfix/util/dict_mysql.c b/postfix/util/dict_mysql.c new file mode 100644 index 000000000..c4f488700 --- /dev/null +++ b/postfix/util/dict_mysql.c @@ -0,0 +1,463 @@ +/*++ +/* NAME +/* dict_mysql 3 +/* SUMMARY +/* dictionary manager interface to db files +/* SYNOPSIS +/* #include +/* #include +/* +/* +/* 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 '' 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 +#include +#include +#include +#include + +/* 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 diff --git a/postfix/util/dict_mysql.h b/postfix/util/dict_mysql.h new file mode 100644 index 000000000..601ccda34 --- /dev/null +++ b/postfix/util/dict_mysql.h @@ -0,0 +1,46 @@ +#ifdef HAS_MYSQL + +#include +#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 diff --git a/postfix/util/dict_open.c b/postfix/util/dict_open.c index 87f00c59b..56696ee1d 100644 --- a/postfix/util/dict_open.c +++ b/postfix/util/dict_open.c @@ -159,6 +159,7 @@ #include #include #include +#include #include #include #include @@ -195,6 +196,9 @@ static DICT_OPEN_INFO dict_open_info[] = { #ifdef HAS_LDAP "ldap", dict_ldap_open, #endif +#ifdef HAS_MYSQL + "mysql", dict_mysql_open, +#endif #ifdef HAS_PCRE "pcre", dict_pcre_open, #endif diff --git a/postfix/util/doze.c b/postfix/util/doze.c index d33da8ad9..28d56693a 100644 --- a/postfix/util/doze.c +++ b/postfix/util/doze.c @@ -47,7 +47,7 @@ void doze(unsigned delay) #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) diff --git a/postfix/util/dup2_pass_on_exec.c b/postfix/util/dup2_pass_on_exec.c new file mode 100644 index 000000000..54bca2397 --- /dev/null +++ b/postfix/util/dup2_pass_on_exec.c @@ -0,0 +1,60 @@ +/*++ +/* 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 +/* Forststrasse 71 +/* 76131 Karlsruhe, GERMANY +/*--*/ + +#include +#include + +#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; +} diff --git a/postfix/util/fsspace.c b/postfix/util/fsspace.c index 491cdb59e..e96daf5d5 100644 --- a/postfix/util/fsspace.c +++ b/postfix/util/fsspace.c @@ -48,6 +48,8 @@ #include #elif defined(STATVFS_IN_SYS_STATVFS_H) #include +#elif defined(STATFS_IN_SYS_STATFS_H) +#include #else #ifdef USE_STATFS #error "please specify the include file with `struct statfs'" @@ -68,6 +70,14 @@ void fsspace(const char *path, struct fsspace * sp) 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) @@ -75,6 +85,7 @@ void fsspace(const char *path, struct fsspace * sp) sp->block_size = fsbuf.f_bsize; sp->block_free = fsbuf.f_bavail; #endif +#endif #ifdef USE_STATVFS struct statvfs fsbuf; diff --git a/postfix/util/sys_compat.c b/postfix/util/sys_compat.c index 28e39bc62..c00d10f43 100644 --- a/postfix/util/sys_compat.c +++ b/postfix/util/sys_compat.c @@ -30,6 +30,8 @@ /* 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. @@ -212,4 +214,23 @@ int setsid(void) #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 diff --git a/postfix/util/sys_defs.h b/postfix/util/sys_defs.h index 850db0978..70126fa8b 100644 --- a/postfix/util/sys_defs.h +++ b/postfix/util/sys_defs.h @@ -21,7 +21,7 @@ */ #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 #define USE_PATHS_H @@ -47,13 +47,14 @@ #define USE_DOT_LOCK #endif +#if defined(RHAPSODY5) +#define NORETURN void +#endif + #ifdef ULTRIX4 #define SUPPORTED #include #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" @@ -61,19 +62,34 @@ #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 @@ -160,7 +176,7 @@ extern int opterr; #define HAS_VOLATILE_LOCKS #endif -#ifdef UW7 /* UnixWare 7 */ +#ifdef UW7 /* UnixWare 7 */ #define SUPPORTED #include #define _PATH_MAILDIR "/var/mail" @@ -185,29 +201,29 @@ extern int opterr; #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT #endif -#ifdef UW21 /* UnixWare 2.1.x */ -#define SUPPORTED -#include -#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 +#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 @@ -243,6 +259,38 @@ extern int initgroups(const char *, int); #endif +#ifdef AIX3 +#define SUPPORTED +#include +#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 @@ -475,6 +523,33 @@ extern int opterr; #define WEXITSTATUS(x) ((x).w_retcode) #define WTERMSIG(x) ((x).w_termsig) #define NORETURN /* the native compiler */ +#endif + +#ifdef ReliantUnix543 +#define SUPPORTED +#include +#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 */ +extern char *optarg; /* XXX use */ +extern int opterr; /* XXX use */ + +#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 /* @@ -484,6 +559,15 @@ extern int opterr; #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 diff --git a/postfix/util/timed_connect.h b/postfix/util/timed_connect.h index eb2802f98..76ac7159c 100644 --- a/postfix/util/timed_connect.h +++ b/postfix/util/timed_connect.h @@ -7,15 +7,11 @@ /* SUMMARY /* connect operation with timeout /* SYNOPSIS +/* #include /* #include /* DESCRIPTION /* .nf - /* - * System library. - */ -#include - /* * External interface. */ diff --git a/postfix/util/vstream_popen.c b/postfix/util/vstream_popen.c index 46116a19e..4e741603c 100644 --- a/postfix/util/vstream_popen.c +++ b/postfix/util/vstream_popen.c @@ -218,7 +218,7 @@ VSTREAM *vstream_popen_vargs(int flags,...) 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");