2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-09-04 08:05:37 +00:00

postfix-3.4-20180403

This commit is contained in:
Wietse Venema
2018-04-03 00:00:00 -05:00
committed by Viktor Dukhovni
parent 787f2e15f7
commit 0b850f6840
10 changed files with 125 additions and 86 deletions

View File

@@ -23363,3 +23363,11 @@ Apologies for any names omitted.
Portability: FreeBSD 11 is supported. Files: makedefs, Portability: FreeBSD 11 is supported. Files: makedefs,
util/sys_defs.h. util/sys_defs.h.
20180403
Containers: "postfix start-fg" will now attempt to run the
master daemon as PID 1, and "postfix stop" will use a
stronger signal if the master does not stop. Files:
conf/postfix-script, master/master.c, master/master_sig.c,
postfix/postfix.c.

View File

@@ -150,11 +150,16 @@ start|start-fg)
;; ;;
start-fg) start-fg)
# Foreground start-up is incompatible with multi-instance mode. # Foreground start-up is incompatible with multi-instance mode.
# We can't use "exec $daemon_directory/master" here: that would # Use "exec $daemon_directory/master -i" only if PID == 1.
# break process group management, and "postfix stop" would kill # Otherwise, doing so would break process group management,
# too many processes. # and "postfix stop" would kill too many processes.
case $instances in case $instances in
"") $daemon_directory/master "") case $$ in
1) exec $daemon_directory/master -i
$FATAL "cannot start-fg the master daemon"
exit 1;;
*) $daemon_directory/master;;
esac
;; ;;
*) $FATAL "start-fg does not support multi_instance_directories" *) $FATAL "start-fg does not support multi_instance_directories"
exit 1 exit 1

View File

@@ -10,7 +10,7 @@ MASTER(8) MASTER(8)
master - Postfix master process master - Postfix master process
<b>SYNOPSIS</b> <b>SYNOPSIS</b>
<b>master</b> [<b>-Ddtvw</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-e</b> <i>exit</i><b>_</b><i>time</i>] <b>master</b> [<b>-Dditvw</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-e</b> <i>exit</i><b>_</b><i>time</i>]
<b>DESCRIPTION</b> <b>DESCRIPTION</b>
The <a href="master.8.html"><b>master</b>(8)</a> daemon is the resident process that runs Postfix daemons The <a href="master.8.html"><b>master</b>(8)</a> daemon is the resident process that runs Postfix daemons
@@ -47,6 +47,10 @@ MASTER(8) MASTER(8)
Terminate the master process after <i>exit</i><b>_</b><i>time</i> seconds. Child pro- Terminate the master process after <i>exit</i><b>_</b><i>time</i> seconds. Child pro-
cesses terminate at their convenience. cesses terminate at their convenience.
<b>-i</b> Enable <b>init</b> mode: do not attempt to become a session or process
group leader. This mode is allowed only if the process ID equals
1.
<b>-t</b> Test mode. Return a zero exit status when the <b>master.pid</b> lock <b>-t</b> Test mode. Return a zero exit status when the <b>master.pid</b> lock
file does not exist or when that file is not locked. This is file does not exist or when that file is not locked. This is
evidence that the <a href="master.8.html"><b>master</b>(8)</a> daemon is not running. evidence that the <a href="master.8.html"><b>master</b>(8)</a> daemon is not running.

View File

@@ -38,13 +38,14 @@ POSTFIX(1) POSTFIX(1)
<b>start-fg</b> <b>start-fg</b>
Like <b>start</b>, but keep the master daemon running in the fore- Like <b>start</b>, but keep the master daemon running in the fore-
ground. This requires that multi-instance support is disabled ground, if possible as PID 1. This command requires that
(i.e. the <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a> parameter value must be multi-instance support is disabled (i.e. the
empty). When running Postfix inside a container, mount the con- <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a> parameter value must be empty). When
tainer host's /dev/log socket inside the container (example: running Postfix inside a container, mount the container host's
"docker run -v /dev/log:/dev/log ...") and specify a distinct /dev/log socket inside the container (example: "docker run -v
Postfix "<a href="postconf.5.html#syslog_name">syslog_name</a>" prefix that identifies logging from the /dev/log:/dev/log ...") and specify a distinct Postfix "sys-
Postfix instance. log_name" prefix that identifies logging from the Postfix
instance.
<b>stop</b> Stop the Postfix mail system in an orderly fashion. If possible, <b>stop</b> Stop the Postfix mail system in an orderly fashion. If possible,
running processes are allowed to terminate at their earliest running processes are allowed to terminate at their earliest

View File

@@ -39,13 +39,14 @@ Start the Postfix mail system. This also runs the configuration
check described above. check described above.
.IP \fBstart\-fg\fR .IP \fBstart\-fg\fR
Like \fBstart\fR, but keep the master daemon running in the Like \fBstart\fR, but keep the master daemon running in the
foreground. This requires that multi\-instance support is foreground, if possible as PID 1. This command requires
disabled (i.e. the multi_instance_directories parameter that multi\-instance support is disabled (i.e. the
value must be empty). When running Postfix inside a container, multi_instance_directories parameter value must be empty).
mount the container host's /dev/log socket inside the When running Postfix inside a container, mount the container
container (example: "docker run \-v /dev/log:/dev/log ...") host's /dev/log socket inside the container (example: "docker
and specify a distinct Postfix "syslog_name" prefix that run \-v /dev/log:/dev/log ...") and specify a distinct
identifies logging from the Postfix instance. Postfix "syslog_name" prefix that identifies logging from
the Postfix instance.
.IP \fBstop\fR .IP \fBstop\fR
Stop the Postfix mail system in an orderly fashion. If Stop the Postfix mail system in an orderly fashion. If
possible, running processes are allowed to terminate at possible, running processes are allowed to terminate at

View File

@@ -8,7 +8,7 @@ Postfix master process
.SH "SYNOPSIS" .SH "SYNOPSIS"
.na .na
.nf .nf
\fBmaster\fR [\fB\-Ddtvw\fR] [\fB\-c \fIconfig_dir\fR] [\fB\-e \fIexit_time\fR] \fBmaster\fR [\fB\-Dditvw\fR] [\fB\-c \fIconfig_dir\fR] [\fB\-e \fIexit_time\fR]
.SH DESCRIPTION .SH DESCRIPTION
.ad .ad
.fi .fi
@@ -43,6 +43,10 @@ for debugging only.
.IP "\fB\-e \fIexit_time\fR" .IP "\fB\-e \fIexit_time\fR"
Terminate the master process after \fIexit_time\fR seconds. Child Terminate the master process after \fIexit_time\fR seconds. Child
processes terminate at their convenience. processes terminate at their convenience.
.IP \fB\-i\fR
Enable \fBinit\fR mode: do not attempt to become a session
or process group leader. This mode is allowed only if the
process ID equals 1.
.IP \fB\-t\fR .IP \fB\-t\fR
Test mode. Return a zero exit status when the \fBmaster.pid\fR lock Test mode. Return a zero exit status when the \fBmaster.pid\fR lock
file does not exist or when that file is not locked. This is evidence file does not exist or when that file is not locked. This is evidence

View File

@@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no * Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only. * patchlevel; they change the release date only.
*/ */
#define MAIL_RELEASE_DATE "20180401" #define MAIL_RELEASE_DATE "20180403"
#define MAIL_VERSION_NUMBER "3.4" #define MAIL_VERSION_NUMBER "3.4"
#ifdef SNAPSHOT #ifdef SNAPSHOT

View File

@@ -4,7 +4,7 @@
/* SUMMARY /* SUMMARY
/* Postfix master process /* Postfix master process
/* SYNOPSIS /* SYNOPSIS
/* \fBmaster\fR [\fB-Ddtvw\fR] [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR] /* \fBmaster\fR [\fB-Dditvw\fR] [\fB-c \fIconfig_dir\fR] [\fB-e \fIexit_time\fR]
/* DESCRIPTION /* DESCRIPTION
/* The \fBmaster\fR(8) daemon is the resident process that runs Postfix /* The \fBmaster\fR(8) daemon is the resident process that runs Postfix
/* daemons on demand: daemons to send or receive messages via the /* daemons on demand: daemons to send or receive messages via the
@@ -37,6 +37,10 @@
/* .IP "\fB-e \fIexit_time\fR" /* .IP "\fB-e \fIexit_time\fR"
/* Terminate the master process after \fIexit_time\fR seconds. Child /* Terminate the master process after \fIexit_time\fR seconds. Child
/* processes terminate at their convenience. /* processes terminate at their convenience.
/* .IP \fB-i\fR
/* Enable \fBinit\fR mode: do not attempt to become a session
/* or process group leader. This mode is allowed only if the
/* process ID equals 1.
/* .IP \fB-t\fR /* .IP \fB-t\fR
/* Test mode. Return a zero exit status when the \fBmaster.pid\fR lock /* Test mode. Return a zero exit status when the \fBmaster.pid\fR lock
/* file does not exist or when that file is not locked. This is evidence /* file does not exist or when that file is not locked. This is evidence
@@ -266,6 +270,7 @@ int main(int argc, char **argv)
ARGV *import_env; ARGV *import_env;
int wait_flag = 0; int wait_flag = 0;
int monitor_fd = -1; int monitor_fd = -1;
int init_mode = 0;
/* /*
* Fingerprint executables and core dumps. * Fingerprint executables and core dumps.
@@ -334,7 +339,7 @@ int main(int argc, char **argv)
/* /*
* Process JCL. * Process JCL.
*/ */
while ((ch = GETOPT(argc, argv, "c:Dde:tvw")) > 0) { while ((ch = GETOPT(argc, argv, "c:Dde:itvw")) > 0) {
switch (ch) { switch (ch) {
case 'c': case 'c':
if (setenv(CONF_ENV_PATH, optarg, 1) < 0) if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
@@ -346,6 +351,11 @@ int main(int argc, char **argv)
case 'e': case 'e':
event_request_timer(master_exit_event, (void *) 0, atoi(optarg)); event_request_timer(master_exit_event, (void *) 0, atoi(optarg));
break; break;
case 'i':
if (getpid() != 1)
msg_fatal("-i is allowed with for PID 1 process");
init_mode = 1;
break;
case 'D': case 'D':
debug_me = 1; debug_me = 1;
break; break;
@@ -375,6 +385,8 @@ int main(int argc, char **argv)
*/ */
if (test_lock && wait_flag) if (test_lock && wait_flag)
msg_fatal("the -t and -w options cannot be used together"); msg_fatal("the -t and -w options cannot be used together");
if (init_mode + debug_me + !master_detach + wait_flag > 1)
msg_fatal("specify one of -i, -D, -d, or -w");
/* /*
* Run a foreground monitor process that returns an exit status of 0 when * Run a foreground monitor process that returns an exit status of 0 when
@@ -403,7 +415,8 @@ int main(int argc, char **argv)
* all MTA processes cleanly. Give up if we can't separate from our * all MTA processes cleanly. Give up if we can't separate from our
* parent process. We're not supposed to blow away the parent. * parent process. We're not supposed to blow away the parent.
*/ */
if (debug_me == 0 && master_detach != 0 && setsid() == -1 && getsid(0) != getpid()) if (init_mode == 0 && debug_me == 0 && master_detach != 0
&& setsid() == -1 && getsid(0) != getpid())
msg_fatal("unable to set session and process group ID: %m"); msg_fatal("unable to set session and process group ID: %m");
/* /*

View File

@@ -210,6 +210,8 @@ static void master_sigdeath(int sig)
msg_fatal("%s: sigaction: %m", myname); msg_fatal("%s: sigaction: %m", myname);
if (kill(pid, sig) < 0) if (kill(pid, sig) < 0)
msg_fatal("%s: kill myself: %m", myname); msg_fatal("%s: kill myself: %m", myname);
if (kill(pid, SIGKILL) < 0)
msg_fatal("%s: kill myself: %m", myname);
} }
/* master_sigsetup - set up signal handlers */ /* master_sigsetup - set up signal handlers */

View File

@@ -33,13 +33,14 @@
/* check described above. /* check described above.
/* .IP \fBstart-fg\fR /* .IP \fBstart-fg\fR
/* Like \fBstart\fR, but keep the master daemon running in the /* Like \fBstart\fR, but keep the master daemon running in the
/* foreground. This requires that multi-instance support is /* foreground, if possible as PID 1. This command requires
/* disabled (i.e. the multi_instance_directories parameter /* that multi-instance support is disabled (i.e. the
/* value must be empty). When running Postfix inside a container, /* multi_instance_directories parameter value must be empty).
/* mount the container host's /dev/log socket inside the /* When running Postfix inside a container, mount the container
/* container (example: "docker run -v /dev/log:/dev/log ...") /* host's /dev/log socket inside the container (example: "docker
/* and specify a distinct Postfix "syslog_name" prefix that /* run -v /dev/log:/dev/log ...") and specify a distinct
/* identifies logging from the Postfix instance. /* Postfix "syslog_name" prefix that identifies logging from
/* the Postfix instance.
/* .IP \fBstop\fR /* .IP \fBstop\fR
/* Stop the Postfix mail system in an orderly fashion. If /* Stop the Postfix mail system in an orderly fashion. If
/* possible, running processes are allowed to terminate at /* possible, running processes are allowed to terminate at