2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 13:48:06 +00:00

snapshot-20011217

This commit is contained in:
Wietse Venema
2001-12-17 00:00:00 -05:00
committed by Viktor Dukhovni
parent 468ab80791
commit c0b942fbaa
29 changed files with 215 additions and 94 deletions

View File

@@ -5795,8 +5795,22 @@ Apologies for any names omitted.
when the next line starts with whitespace; a comment that when the next line starts with whitespace; a comment that
is preceded by whitespace does not break multi-line input. is preceded by whitespace does not break multi-line input.
20011217
Compatibility: Sendmail now has a -L option to set the
syslogging label. Postfix sendmail uses syslog_name instead,
and ignores the -L option.
Security: subtle hardening of the Postfix chroot jail,
Postfix queue file permissions and access methods, in case
someone compromises the postfix account. Michael Tokarev
claims he got the insights from Solar Designer. Files:
master/master_wakeup.c, util/fifo_trigger.c, postfix-script.
Open problems: Open problems:
Low: warn about undomained hostnames instead of aborting.
Low: after reorganizing configuration parameters, add flags Low: after reorganizing configuration parameters, add flags
to all parameters whose value can be read from file. to all parameters whose value can be read from file.

View File

@@ -1,16 +1,18 @@
Incompatible changes with snapshot-20011216 Incompatible changes with snapshot-20011217
=========================================== ===========================================
Postfix configuration file comments no longer span multiple lines Postfix configuration file comments no longer continue on the next
when the next line starts with whitespace. This may cause unexpected line when that next line starts with whitespace. This change avoids
behavior with existing, improperly formatted, configuration files. surprises, but it may cause unexpected behavior with existing,
poorly formatted, configuration files. Caveat user.
Major changes with snapshot-20011216 Major changes with snapshot-20011217
==================================== ====================================
Postfix configuration files now support whitespace before comments. Postfix configuration files now support whitespace before comments.
This allows you to comment out just one line in the middle of a This allows you to comment out just one line in the middle of a
block of multi-line input. block of multi-line input. A comment that starts at the beginning
of a line always terminates previous data.
Incompatible changes with snapshot-20011210 Incompatible changes with snapshot-20011210
=========================================== ===========================================

View File

@@ -184,7 +184,6 @@ check)
$WARN creating missing Postfix pid directory $WARN creating missing Postfix pid directory
mkdir pid || exit 1 mkdir pid || exit 1
chmod 755 pid chmod 755 pid
chown $mail_owner pid
} }
for dir in incoming active bounce defer deferred flush saved corrupt; do for dir in incoming active bounce defer deferred flush saved corrupt; do
test -d $dir || { test -d $dir || {

View File

@@ -185,7 +185,6 @@ check)
$WARN creating missing Postfix pid directory $WARN creating missing Postfix pid directory
mkdir pid || exit 1 mkdir pid || exit 1
chmod 755 pid chmod 755 pid
chown $mail_owner pid
} }
for dir in incoming active bounce defer deferred flush saved corrupt; do for dir in incoming active bounce defer deferred flush saved corrupt; do
test -d $dir || { test -d $dir || {

View File

@@ -79,64 +79,68 @@ SENDMAIL(1) SENDMAIL(1)
<b>-I</b> Initialize alias database. See the <b>newaliases</b> com- <b>-I</b> Initialize alias database. See the <b>newaliases</b> com-
mand above. mand above.
<b>-L</b> <i>label</i> (ignored)
The logging label. Use the <b>syslog</b><i>_</i><b>name</b> configura-
tion parameter instead.
<b>-N</b> <i>dsn</i> (ignored) <b>-N</b> <i>dsn</i> (ignored)
Delivery status notification control. Currently, Delivery status notification control. Currently,
Postfix does not implement <b>DSN</b>. Postfix does not implement <b>DSN</b>.
<b>-R</b> <i>return_limit</i> (ignored) <b>-R</b> <i>return_limit</i> (ignored)
Limit the size of bounced mail. Use the Limit the size of bounced mail. Use the
<b>bounce</b><i>_</i><b>size</b><i>_</i><b>limit</b> configuration parameter instead. <b>bounce</b><i>_</i><b>size</b><i>_</i><b>limit</b> configuration parameter instead.
<b>-X</b> <i>log_file</i> (ignored) <b>-X</b> <i>log_file</i> (ignored)
Log mailer traffic. Use the <b>debug</b><i>_</i><b>peer</b><i>_</i><b>list</b> and Log mailer traffic. Use the <b>debug</b><i>_</i><b>peer</b><i>_</i><b>list</b> and
<b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> configuration parameters instead. <b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> configuration parameters instead.
<b>-U</b> (ignored) <b>-U</b> (ignored)
Initial user submission. Initial user submission.
<b>-V</b> Variable Envelope Return Path. Given an envelope <b>-V</b> Variable Envelope Return Path. Given an envelope
sender address of the form <i>owner-listname</i>@<i>origin</i>, sender address of the form <i>owner-listname</i>@<i>origin</i>,
each recipient <i>user</i>@<i>domain</i> receives mail with a each recipient <i>user</i>@<i>domain</i> receives mail with a
personalized envelope sender address. personalized envelope sender address.
By default, the personalized envelope sender By default, the personalized envelope sender
address is <i>owner-listname</i><b>+</b><i>user</i><b>=</b><i>domain</i>@<i>origin</i>. The address is <i>owner-listname</i><b>+</b><i>user</i><b>=</b><i>domain</i>@<i>origin</i>. The
default <b>+</b> and <b>=</b> characters are configurable with default <b>+</b> and <b>=</b> characters are configurable with
the <b>default</b><i>_</i><b>verp</b><i>_</i><b>delimiters</b> configuration parame-
ter.
<b>-V</b><i>xy</i> As <b>-V</b>, but uses <i>x</i> and <i>y</i> as the VERP delimiter char-
acters, instead of the characters specified with
the <b>default</b><i>_</i><b>verp</b><i>_</i><b>delimiters</b> configuration parame- the <b>default</b><i>_</i><b>verp</b><i>_</i><b>delimiters</b> configuration parame-
ter. ter.
<b>-bd</b> Go into daemon mode. This mode of operation is <b>-V</b><i>xy</i> As <b>-V</b>, but uses <i>x</i> and <i>y</i> as the VERP delimiter char-
acters, instead of the characters specified with
the <b>default</b><i>_</i><b>verp</b><i>_</i><b>delimiters</b> configuration parame-
ter.
<b>-bd</b> Go into daemon mode. This mode of operation is
implemented by executing the <b>postfix</b> <b>start</b> command. implemented by executing the <b>postfix</b> <b>start</b> command.
<b>-bi</b> Initialize alias database. See the <b>newaliases</b> com- <b>-bi</b> Initialize alias database. See the <b>newaliases</b> com-
mand above. mand above.
<b>-bm</b> Read mail from standard input and arrange for <b>-bm</b> Read mail from standard input and arrange for
delivery. This is the default mode of operation. delivery. This is the default mode of operation.
<b>-bp</b> List the mail queue. See the <b>mailq</b> command above. <b>-bp</b> List the mail queue. See the <b>mailq</b> command above.
<b>-bs</b> Stand-alone SMTP server mode. Read SMTP commands <b>-bs</b> Stand-alone SMTP server mode. Read SMTP commands
from standard input, and write responses to stan- from standard input, and write responses to stan-
dard output. This mode of operation is implemented dard output. This mode of operation is implemented
by running the <a href="smtpd.8.html"><b>smtpd</b>(8)</a> daemon. by running the <a href="smtpd.8.html"><b>smtpd</b>(8)</a> daemon.
<b>-f</b> <i>sender</i> <b>-f</b> <i>sender</i>
Set the envelope sender address. This is the Set the envelope sender address. This is the
address where delivery problems are sent to, unless address where delivery problems are sent to, unless
the message contains an <b>Errors-To:</b> message header. the message contains an <b>Errors-To:</b> message header.
<b>-h</b> <i>hop_count</i> (ignored) <b>-h</b> <i>hop_count</i> (ignored)
Hop count limit. Use the <b>hopcount</b><i>_</i><b>limit</b> configura- Hop count limit. Use the <b>hopcount</b><i>_</i><b>limit</b> configura-
tion parameter instead. tion parameter instead.
<b>-i</b> When reading a message from standard input, don't <b>-i</b> When reading a message from standard input, don't
treat a line with only a <b>.</b> character as the end of treat a line with only a <b>.</b> character as the end of
input. input.
<b>-m</b> (ignored) <b>-m</b> (ignored)
@@ -146,67 +150,67 @@ SENDMAIL(1) SENDMAIL(1)
Backwards compatibility. Backwards compatibility.
<b>-oA</b><i>alias_database</i> <b>-oA</b><i>alias_database</i>
Non-default alias database. Specify <i>pathname</i> or Non-default alias database. Specify <i>pathname</i> or
<i>type</i>:<i>pathname</i>. See <a href="postalias.1.html"><b>postalias</b>(1)</a> for details. <i>type</i>:<i>pathname</i>. See <a href="postalias.1.html"><b>postalias</b>(1)</a> for details.
<b>-o7</b> (ignored) <b>-o7</b> (ignored)
<b>-o8</b> (ignored) <b>-o8</b> (ignored)
The message body type. Currently, Postfix imple- The message body type. Currently, Postfix imple-
ments <b>just-send-eight</b>. ments <b>just-send-eight</b>.
<b>-oi</b> When reading a message from standard input, don't <b>-oi</b> When reading a message from standard input, don't
treat a line with only a <b>.</b> character as the end of treat a line with only a <b>.</b> character as the end of
input. input.
<b>-om</b> (ignored) <b>-om</b> (ignored)
The sender is never eliminated from alias etc. The sender is never eliminated from alias etc.
expansions. expansions.
<b>-o</b> <i>x</i> <i>value</i> (ignored) <b>-o</b> <i>x</i> <i>value</i> (ignored)
Set option <i>x</i> to <i>value</i>. Use the equivalent configu- Set option <i>x</i> to <i>value</i>. Use the equivalent configu-
ration parameter in <b>main.cf</b> instead. ration parameter in <b>main.cf</b> instead.
<b>-r</b> <i>sender</i> <b>-r</b> <i>sender</i>
Set the envelope sender address. This is the Set the envelope sender address. This is the
address where delivery problems are sent to, unless address where delivery problems are sent to, unless
the message contains an <b>Errors-To:</b> message header. the message contains an <b>Errors-To:</b> message header.
<b>-q</b> Attempt to deliver all queued mail. This is imple- <b>-q</b> Attempt to deliver all queued mail. This is imple-
mented by kicking the <a href="qmgr.8.html"><b>qmgr</b>(8)</a> daemon. mented by kicking the <a href="qmgr.8.html"><b>qmgr</b>(8)</a> daemon.
<b>-q</b><i>interval</i> (ignored) <b>-q</b><i>interval</i> (ignored)
The interval between queue runs. Use the The interval between queue runs. Use the
<b>queue</b><i>_</i><b>run</b><i>_</i><b>delay</b> configuration parameter instead. <b>queue</b><i>_</i><b>run</b><i>_</i><b>delay</b> configuration parameter instead.
<b>-qR</b><i>site</i> <b>-qR</b><i>site</i>
Schedule immediate delivery of all mail that is Schedule immediate delivery of all mail that is
queued for the named <i>site</i>. This option accepts only queued for the named <i>site</i>. This option accepts only
<i>site</i> names that are eligible for the "fast flush" <i>site</i> names that are eligible for the "fast flush"
service, and is implemented by connecting to the service, and is implemented by connecting to the
local SMTP server at <b>$myhostname</b>. See <a href="flushd.8.html"><b>flush</b>(8)</a> for local SMTP server at <b>$myhostname</b>. See <a href="flushd.8.html"><b>flush</b>(8)</a> for
more information about the "fast flush" service. more information about the "fast flush" service.
<b>-qS</b><i>site</i> <b>-qS</b><i>site</i>
This command is not implemented. Use the slower This command is not implemented. Use the slower
<b>sendmail</b> <b>-q</b> command instead. <b>sendmail</b> <b>-q</b> command instead.
<b>-t</b> Extract recipients from message headers. This <b>-t</b> Extract recipients from message headers. This
requires that no recipients be specified on the requires that no recipients be specified on the
command line. command line.
<b>-v</b> Enable verbose logging for debugging purposes. Mul- <b>-v</b> Enable verbose logging for debugging purposes. Mul-
tiple <b>-v</b> options make the software increasingly tiple <b>-v</b> options make the software increasingly
verbose. verbose.
<b>SECURITY</b> <b>SECURITY</b>
By design, this program is not set-user (or group) id. By design, this program is not set-user (or group) id.
However, it must handle data from untrusted users or However, it must handle data from untrusted users or
untrusted machines. Thus, the usual precautions need to untrusted machines. Thus, the usual precautions need to
be taken against malicious inputs. be taken against malicious inputs.
<b>DIAGNOSTICS</b> <b>DIAGNOSTICS</b>
Problems are logged to <b>syslogd</b>(8) and to the standard Problems are logged to <b>syslogd</b>(8) and to the standard
error stream. error stream.
<b>ENVIRONMENT</b> <b>ENVIRONMENT</b>
@@ -218,7 +222,7 @@ SENDMAIL(1) SENDMAIL(1)
<b>MAIL</b><i>_</i><b>DEBUG</b> <b>MAIL</b><i>_</i><b>DEBUG</b>
Enable debugging with an external command, as spec- Enable debugging with an external command, as spec-
ified with the <b>debugger</b><i>_</i><b>command</b> configuration ified with the <b>debugger</b><i>_</i><b>command</b> configuration
parameter. parameter.
<b>FILES</b> <b>FILES</b>
@@ -226,13 +230,13 @@ SENDMAIL(1) SENDMAIL(1)
/etc/postfix, configuration files /etc/postfix, configuration files
<b>CONFIGURATION</b> <b>PARAMETERS</b> <b>CONFIGURATION</b> <b>PARAMETERS</b>
See the Postfix <b>main.cf</b> file for syntax details and for See the Postfix <b>main.cf</b> file for syntax details and for
default values. Use the <b>postfix</b> <b>reload</b> command after a default values. Use the <b>postfix</b> <b>reload</b> command after a
configuration change. configuration change.
<b>alias</b><i>_</i><b>database</b> <b>alias</b><i>_</i><b>database</b>
Default alias database(s) for <b>newaliases</b>. The Default alias database(s) for <b>newaliases</b>. The
default value for this parameter is system-spe- default value for this parameter is system-spe-
cific. cific.
<b>bounce</b><i>_</i><b>size</b><i>_</i><b>limit</b> <b>bounce</b><i>_</i><b>size</b><i>_</i><b>limit</b>
@@ -248,64 +252,64 @@ SENDMAIL(1) SENDMAIL(1)
initialized. initialized.
<b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> <b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b>
Increment in verbose logging level when a remote Increment in verbose logging level when a remote
host matches a pattern in the <b>debug</b><i>_</i><b>peer</b><i>_</i><b>list</b> host matches a pattern in the <b>debug</b><i>_</i><b>peer</b><i>_</i><b>list</b>
parameter. parameter.
<b>debug</b><i>_</i><b>peer</b><i>_</i><b>list</b> <b>debug</b><i>_</i><b>peer</b><i>_</i><b>list</b>
List of domain or network patterns. When a remote List of domain or network patterns. When a remote
host matches a pattern, increase the verbose log- host matches a pattern, increase the verbose log-
ging level by the amount specified in the ging level by the amount specified in the
<b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> parameter. <b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> parameter.
<b>default</b><i>_</i><b>verp</b><i>_</i><b>delimiters</b> <b>default</b><i>_</i><b>verp</b><i>_</i><b>delimiters</b>
The VERP delimiter characters that are used when The VERP delimiter characters that are used when
the <b>-V</b> command line option is specified without the <b>-V</b> command line option is specified without
delimiter characters. delimiter characters.
<b>fast</b><i>_</i><b>flush</b><i>_</i><b>domains</b> <b>fast</b><i>_</i><b>flush</b><i>_</i><b>domains</b>
List of domains that will receive "fast flush" ser- List of domains that will receive "fast flush" ser-
vice (default: all domains that this system is vice (default: all domains that this system is
willing to relay mail to). This greatly improves willing to relay mail to). This greatly improves
the performance of the SMTP <b>ETRN</b> request, and of the performance of the SMTP <b>ETRN</b> request, and of
the <b>sendmail</b> <b>-qR</b> command. For domains not in the the <b>sendmail</b> <b>-qR</b> command. For domains not in the
list, Postfix simply attempts to deliver all queued list, Postfix simply attempts to deliver all queued
mail. mail.
<b>fork</b><i>_</i><b>attempts</b> <b>fork</b><i>_</i><b>attempts</b>
Number of attempts to <b>fork</b>() a process before giv- Number of attempts to <b>fork</b>() a process before giv-
ing up. ing up.
<b>fork</b><i>_</i><b>delay</b> <b>fork</b><i>_</i><b>delay</b>
Delay in seconds between successive <b>fork</b>() Delay in seconds between successive <b>fork</b>()
attempts. attempts.
<b>hopcount</b><i>_</i><b>limit</b> <b>hopcount</b><i>_</i><b>limit</b>
Limit the number of <b>Received:</b> message headers. Limit the number of <b>Received:</b> message headers.
<b>mail</b><i>_</i><b>owner</b> <b>mail</b><i>_</i><b>owner</b>
The owner of the mail queue and of most Postfix The owner of the mail queue and of most Postfix
processes. processes.
<b>command</b><i>_</i><b>directory</b> <b>command</b><i>_</i><b>directory</b>
Directory with Postfix support commands (default: Directory with Postfix support commands (default:
<b>$program</b><i>_</i><b>directory</b>). <b>$program</b><i>_</i><b>directory</b>).
<b>daemon</b><i>_</i><b>directory</b> <b>daemon</b><i>_</i><b>directory</b>
Directory with Postfix daemon programs (default: Directory with Postfix daemon programs (default:
<b>$program</b><i>_</i><b>directory</b>). <b>$program</b><i>_</i><b>directory</b>).
<b>queue</b><i>_</i><b>directory</b> <b>queue</b><i>_</i><b>directory</b>
Top-level directory of the Postfix queue. This is Top-level directory of the Postfix queue. This is
also the root directory of Postfix daemons that run also the root directory of Postfix daemons that run
chrooted. chrooted.
<b>queue</b><i>_</i><b>run</b><i>_</i><b>delay</b> <b>queue</b><i>_</i><b>run</b><i>_</i><b>delay</b>
The time between successive scans of the deferred The time between successive scans of the deferred
queue. queue.
<b>verp</b><i>_</i><b>delimiter</b><i>_</i><b>filter</b> <b>verp</b><i>_</i><b>delimiter</b><i>_</i><b>filter</b>
The characters that Postfix accepts as VERP delim- The characters that Postfix accepts as VERP delim-
iter characters. iter characters.
<b>SEE</b> <b>ALSO</b> <b>SEE</b> <b>ALSO</b>
@@ -321,7 +325,7 @@ SENDMAIL(1) SENDMAIL(1)
syslogd(8) system logging syslogd(8) system logging
<b>LICENSE</b> <b>LICENSE</b>
The Secure Mailer license must be distributed with this The Secure Mailer license must be distributed with this
software. software.
<b>AUTHOR(S)</b> <b>AUTHOR(S)</b>

View File

@@ -71,6 +71,9 @@ Gateway (relay) submission, as opposed to initial user submission.
.IP \fB-I\fR .IP \fB-I\fR
Initialize alias database. See the \fBnewaliases\fR Initialize alias database. See the \fBnewaliases\fR
command above. command above.
.IP "\fB-L \fIlabel\fR (ignored)"
The logging label. Use the \fBsyslog_name\fR configuration
parameter instead.
.IP "\fB-N \fIdsn\fR (ignored)" .IP "\fB-N \fIdsn\fR (ignored)"
Delivery status notification control. Currently, Postfix does Delivery status notification control. Currently, Postfix does
not implement \fBDSN\fR. not implement \fBDSN\fR.

View File

View File

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

View File

@@ -203,11 +203,14 @@ master_wakeup.o: ../../include/sys_defs.h
master_wakeup.o: ../../include/msg.h master_wakeup.o: ../../include/msg.h
master_wakeup.o: ../../include/trigger.h master_wakeup.o: ../../include/trigger.h
master_wakeup.o: ../../include/events.h master_wakeup.o: ../../include/events.h
master_wakeup.o: ../../include/set_eugid.h
master_wakeup.o: ../../include/set_ugid.h
master_wakeup.o: ../../include/mail_proto.h master_wakeup.o: ../../include/mail_proto.h
master_wakeup.o: ../../include/vstream.h master_wakeup.o: ../../include/vstream.h
master_wakeup.o: ../../include/vbuf.h master_wakeup.o: ../../include/vbuf.h
master_wakeup.o: ../../include/iostuff.h master_wakeup.o: ../../include/iostuff.h
master_wakeup.o: ../../include/attr.h master_wakeup.o: ../../include/attr.h
master_wakeup.o: ../../include/mail_params.h
master_wakeup.o: mail_server.h master_wakeup.o: mail_server.h
master_wakeup.o: master.h master_wakeup.o: master.h
multi_server.o: multi_server.c multi_server.o: multi_server.c

View File

@@ -58,10 +58,13 @@
#include <msg.h> #include <msg.h>
#include <trigger.h> #include <trigger.h>
#include <events.h> #include <events.h>
#include <set_eugid.h>
#include <set_ugid.h>
/* Global library. */ /* Global library. */
#include <mail_proto.h> /* triggers */ #include <mail_proto.h> /* triggers */
#include <mail_params.h>
/* Application-specific. */ /* Application-specific. */
@@ -101,8 +104,29 @@ static void master_wakeup_timer_event(int unused_event, char *context)
case MASTER_SERV_TYPE_UNIX: case MASTER_SERV_TYPE_UNIX:
status = LOCAL_TRIGGER(serv->name, &wakeup, sizeof(wakeup), BRIEFLY); status = LOCAL_TRIGGER(serv->name, &wakeup, sizeof(wakeup), BRIEFLY);
break; break;
/*
* If someone compromises the postfix account then this must not
* overwrite files outside the chroot jail. Countermeasures:
*
* - Limit the damage by accessing the FIFO as postfix not root.
*
* - Have fifo_trigger() call safe_open() so we won't follow
* arbitrary hard/symlinks to files in/outside the chroot jail.
*
* - All non-chroot postfix-related files must be root owned (or
* postfix check complains).
*
* - The postfix user and group ID must not be shared with other
* applications (says the INSTALL documentation).
*
* Result of a discussion with Michael Tokarev who claims het got
* his insights from Solar Designer.
*/
case MASTER_SERV_TYPE_FIFO: case MASTER_SERV_TYPE_FIFO:
set_eugid(var_owner_uid, var_owner_gid);
status = fifo_trigger(serv->name, &wakeup, sizeof(wakeup), BRIEFLY); status = fifo_trigger(serv->name, &wakeup, sizeof(wakeup), BRIEFLY);
set_ugid(getuid(), getgid());
break; break;
default: default:
msg_panic("%s: unknown service type: %d", myname, serv->type); msg_panic("%s: unknown service type: %d", myname, serv->type);

View File

@@ -21,10 +21,36 @@ $(PROG): $(OBJS) $(LIBS)
Makefile: Makefile.in Makefile: Makefile.in
(set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@
test: $(TESTPROG)
update: ../../bin/$(PROG) update: ../../bin/$(PROG)
test: test1 test2
test1: $(PROG) map.in map-abc1.ref map-ghi1.ref map-ABC1.ref
./$(PROG) map.in
for key in abc ghi; \
do \
./$(PROG) -q $${key} map.in | diff map-$${key}1.ref -; \
done
./$(PROG) -f map.in
for key in ABC; \
do \
./$(PROG) -fq $${key} map.in | diff map-$${key}1.ref -; \
done
rm -f map.in.db
test2: $(PROG) map.in map-abc2.ref map-ghi2.ref map-ABC2.ref
./$(PROG) map.in
for key in abc ghi; \
do \
echo $${key} | ./$(PROG) -q - map.in | diff map-$${key}2.ref -; \
done
./$(PROG) -f map.in
for key in ABC; \
do \
echo $${key} | ./$(PROG) -fq - map.in | diff map-$${key}2.ref -; \
done
rm -f map.in.db
../../bin/$(PROG): $(PROG) ../../bin/$(PROG): $(PROG)
cp $(PROG) ../../bin cp $(PROG) ../../bin

View File

@@ -0,0 +1 @@
DEF

View File

@@ -0,0 +1 @@
ABC: DEF

View File

@@ -0,0 +1 @@
DEF

View File

@@ -0,0 +1 @@
abc: DEF

View File

@@ -0,0 +1 @@
jkl

View File

@@ -0,0 +1 @@
ghi: jkl

View File

@@ -0,0 +1,2 @@
ABC: DEF
ghi: jkl

View File

@@ -21,13 +21,39 @@ $(PROG): $(OBJS) $(LIBS)
Makefile: Makefile.in Makefile: Makefile.in
(set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@ (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@
test: $(TESTPROG)
update: ../../bin/$(PROG) update: ../../bin/$(PROG)
../../bin/$(PROG): $(PROG) ../../bin/$(PROG): $(PROG)
cp $(PROG) ../../bin cp $(PROG) ../../bin
test: test1 test2
test1: $(PROG) map.in map-abc1.ref map-ghi1.ref map-ABC1.ref
./$(PROG) map.in
for key in abc ghi; \
do \
./$(PROG) -q $${key} map.in | diff map-$${key}1.ref -; \
done
./$(PROG) -f map.in
for key in ABC; \
do \
./$(PROG) -fq $${key} map.in | diff map-$${key}1.ref -; \
done
rm -f map.in.db
test2: $(PROG) map.in map-abc2.ref map-ghi2.ref map-ABC2.ref
./$(PROG) map.in
for key in abc ghi; \
do \
echo $${key} | ./$(PROG) -q - map.in | diff map-$${key}2.ref -; \
done
./$(PROG) -f map.in
for key in ABC; \
do \
echo $${key} | ./$(PROG) -fq - map.in | diff map-$${key}2.ref -; \
done
rm -f map.in.db
printfck: $(OBJS) $(PROG) printfck: $(OBJS) $(PROG)
rm -rf printfck rm -rf printfck
mkdir printfck mkdir printfck
@@ -39,7 +65,7 @@ lint:
lint $(DEFS) $(SRCS) $(LINTFIX) lint $(DEFS) $(SRCS) $(LINTFIX)
clean: clean:
rm -f *.o *core $(PROG) $(TESTPROG) junk rm -f *.o *core $(PROG) $(TESTPROG) junk map.in.db
rm -rf printfck rm -rf printfck
tidy: clean tidy: clean

View File

@@ -0,0 +1 @@
DEF

View File

@@ -0,0 +1 @@
ABC DEF

View File

@@ -0,0 +1 @@
DEF

View File

@@ -0,0 +1 @@
abc DEF

View File

@@ -0,0 +1 @@
jkl

View File

@@ -0,0 +1 @@
ghi jkl

View File

@@ -0,0 +1,2 @@
ABC DEF
ghi jkl

View File

@@ -65,6 +65,9 @@
/* .IP \fB-I\fR /* .IP \fB-I\fR
/* Initialize alias database. See the \fBnewaliases\fR /* Initialize alias database. See the \fBnewaliases\fR
/* command above. /* command above.
/* .IP "\fB-L \fIlabel\fR (ignored)"
/* The logging label. Use the \fBsyslog_name\fR configuration
/* parameter instead.
/* .IP "\fB-N \fIdsn\fR (ignored)" /* .IP "\fB-N \fIdsn\fR (ignored)"
/* Delivery status notification control. Currently, Postfix does /* Delivery status notification control. Currently, Postfix does
/* not implement \fBDSN\fR. /* not implement \fBDSN\fR.
@@ -860,7 +863,7 @@ int main(int argc, char **argv)
optind++; optind++;
continue; continue;
} }
if ((c = GETOPT(argc, argv, "B:C:F:GIN:R:UV:X:b:ce:f:h:imno:p:r:q:tvx")) <= 0) if ((c = GETOPT(argc, argv, "B:C:F:GIL:N:R:UV:X:b:ce:f:h:imno:p:r:q:tvx")) <= 0)
break; break;
switch (c) { switch (c) {
default: default:
@@ -869,20 +872,12 @@ int main(int argc, char **argv)
break; break;
case 'n': case 'n':
fatal_error(EX_USAGE, "-%c option not supported", c); fatal_error(EX_USAGE, "-%c option not supported", c);
case 'B': /* body type */
break;
case 'F': /* full name */ case 'F': /* full name */
full_name = optarg; full_name = optarg;
break; break;
case 'G': /* gateway submission */
break;
case 'I': /* newaliases */ case 'I': /* newaliases */
mode = SM_MODE_NEWALIAS; mode = SM_MODE_NEWALIAS;
break; break;
case 'N': /* DSN */
break;
case 'R': /* DSN */
break;
case 'V': /* VERP */ case 'V': /* VERP */
if (verp_delims_verify(optarg) != 0) if (verp_delims_verify(optarg) != 0)
fatal_error(EX_USAGE, "-V requires two characters from %s", fatal_error(EX_USAGE, "-V requires two characters from %s",

View File

@@ -690,6 +690,10 @@ fifo_trigger.o: fifo_trigger.c
fifo_trigger.o: sys_defs.h fifo_trigger.o: sys_defs.h
fifo_trigger.o: msg.h fifo_trigger.o: msg.h
fifo_trigger.o: iostuff.h fifo_trigger.o: iostuff.h
fifo_trigger.o: safe_open.h
fifo_trigger.o: vstream.h
fifo_trigger.o: vbuf.h
fifo_trigger.o: vstring.h
fifo_trigger.o: trigger.h fifo_trigger.o: trigger.h
file_limit.o: file_limit.c file_limit.o: file_limit.c
file_limit.o: sys_defs.h file_limit.o: sys_defs.h

View File

@@ -49,6 +49,7 @@
#include <msg.h> #include <msg.h>
#include <iostuff.h> #include <iostuff.h>
#include <safe_open.h>
#include <trigger.h> #include <trigger.h>
/* fifo_trigger - wakeup fifo server */ /* fifo_trigger - wakeup fifo server */
@@ -56,18 +57,23 @@
int fifo_trigger(const char *service, const char *buf, int len, int timeout) int fifo_trigger(const char *service, const char *buf, int len, int timeout)
{ {
char *myname = "fifo_trigger"; char *myname = "fifo_trigger";
VSTREAM *fp;
int fd; int fd;
/* /*
* Write the request to the service fifo. According to POSIX, the open * Write the request to the service fifo. According to POSIX, the open
* shall always return immediately, and shall return an error when no * shall always return immediately, and shall return an error when no
* process is reading from the FIFO. * process is reading from the FIFO.
*
* Use safe_open() so that we don't follow arbitrary symlinks.
*/ */
if ((fd = open(service, O_WRONLY | O_NONBLOCK, 0)) < 0) { if ((fp = safe_open(service, O_WRONLY | O_NONBLOCK, 0,
(struct stat *) 0, -1, -1, (VSTRING *) 0)) == 0) {
if (msg_verbose) if (msg_verbose)
msg_info("%s: open %s: %m", myname, service); msg_info("%s: open %s: %m", myname, service);
return (-1); return (-1);
} }
fd = vstream_fileno(fp);
/* /*
* Write the request... * Write the request...
@@ -80,7 +86,7 @@ int fifo_trigger(const char *service, const char *buf, int len, int timeout)
/* /*
* Disconnect. * Disconnect.
*/ */
if (close(fd)) if (vstream_fclose(fp))
if (msg_verbose) if (msg_verbose)
msg_warn("%s: close %s: %m", myname, service); msg_warn("%s: close %s: %m", myname, service);
return (0); return (0);