]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.4-20180403
authorWietse Venema <wietse@porcupine.org>
Tue, 3 Apr 2018 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Wed, 4 Apr 2018 17:17:22 +0000 (13:17 -0400)
postfix/HISTORY
postfix/conf/postfix-script
postfix/html/master.8.html
postfix/html/postfix.1.html
postfix/man/man1/postfix.1
postfix/man/man8/master.8
postfix/src/global/mail_version.h
postfix/src/master/master.c
postfix/src/master/master_sig.c
postfix/src/postfix/postfix.c

index 165e75670510ed95559919482e5ce5588b083c95..0d72eea39327c3787801182085c3688e927b06c0 100644 (file)
@@ -23363,3 +23363,11 @@ Apologies for any names omitted.
 
        Portability: FreeBSD 11 is supported. Files: makedefs,
        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.
index cd77dd9735c368b3949d633fc955229fa5ee37d5..4a14af7a6db4bc41c3c34f9ce7c3d0d72198ce20 100755 (executable)
@@ -150,11 +150,16 @@ start|start-fg)
            ;;
        start-fg)
            # Foreground start-up is incompatible with multi-instance mode.
-           # We can't use "exec $daemon_directory/master" here: that would
-           # break process group management, and "postfix stop" would kill
-           # too many processes.
+           # Use "exec $daemon_directory/master -i" only if PID == 1.
+           # Otherwise, doing so would break process group management,
+           # and "postfix stop" would kill too many processes.
            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"
                exit 1
index 4a064c784e4d70cd76da7a896dda361a6a5531c7..4376f74341cd90d1c8d01756e44b700776a3858f 100644 (file)
@@ -10,7 +10,7 @@ MASTER(8)                                                            MASTER(8)
        master - Postfix master process
 
 <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>
        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-
               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
               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.
index cff351cc3bbb8393ec9eeb4b02538715961c2f23..f994fc339601db53a59aa1b0e0654eba7175c543 100644 (file)
@@ -38,100 +38,101 @@ POSTFIX(1)                                                          POSTFIX(1)
 
        <b>start-fg</b>
               Like <b>start</b>, but keep the master  daemon  running  in  the  fore-
-              ground.  This  requires  that multi-instance support is disabled
-              (i.e. the <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a>  parameter  value  must  be
-              empty).  When running Postfix inside a container, mount the con-
-              tainer host's /dev/log socket  inside  the  container  (example:
-              "docker  run  -v /dev/log:/dev/log ...")  and specify a distinct
-              Postfix "<a href="postconf.5.html#syslog_name">syslog_name</a>" prefix that identifies  logging  from  the
-              Postfix instance.
+              ground,  if  possible  as  PID  1.  This  command  requires that
+              multi-instance     support     is     disabled     (i.e.     the
+              <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a> parameter value must be empty).  When
+              running Postfix inside a container, mount the  container  host's
+              /dev/log  socket  inside  the container (example: "docker run -v
+              /dev/log:/dev/log ...")  and specify a  distinct  Postfix  "sys-
+              log_name"  prefix  that  identifies  logging  from  the  Postfix
+              instance.
 
        <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
               convenience.
 
-              Note:  in  order to refresh the Postfix mail system after a con-
-              figuration change, do not use the <b>start</b>  and  <b>stop</b>  commands  in
+              Note: in order to refresh the Postfix mail system after  a  con-
+              figuration  change,  do  not  use the <b>start</b> and <b>stop</b> commands in
               succession. Use the <b>reload</b> command instead.
 
-       <b>abort</b>  Stop  the  Postfix  mail  system abruptly. Running processes are
+       <b>abort</b>  Stop the Postfix mail system  abruptly.  Running  processes  are
               signaled to stop immediately.
 
        <b>flush</b>  Force delivery: attempt to deliver every message in the deferred
               mail queue. Normally, attempts to deliver delayed mail happen at
-              regular intervals,  the  interval  doubling  after  each  failed
+              regular  intervals,  the  interval  doubling  after  each failed
               attempt.
 
-              Warning:  flushing  undeliverable mail frequently will result in
+              Warning: flushing undeliverable mail frequently will  result  in
               poor delivery performance of all other mail.
 
-       <b>reload</b> Re-read configuration  files.  Running  processes  terminate  at
+       <b>reload</b> Re-read  configuration  files.  Running  processes  terminate at
               their earliest convenience.
 
        <b>status</b> Indicate if the Postfix mail system is currently running.
 
        <b>set-permissions</b> [<i>name</i>=<i>value ...</i>]
-              Set  the  ownership and permissions of Postfix related files and
+              Set the ownership and permissions of Postfix related  files  and
               directories, as specified in the <b>postfix-files</b> file.
 
-              Specify <i>name</i>=<i>value</i> to override and update specific <a href="postconf.5.html">main.cf</a>  con-
-              figuration  parameters.  Use  this,  for  example, to change the
-              <b><a href="postconf.5.html#mail_owner">mail_owner</a></b> or <b><a href="postconf.5.html#setgid_group">setgid_group</a></b>  setting  for  an  already  installed
+              Specify  <i>name</i>=<i>value</i> to override and update specific <a href="postconf.5.html">main.cf</a> con-
+              figuration parameters. Use this,  for  example,  to  change  the
+              <b><a href="postconf.5.html#mail_owner">mail_owner</a></b>  or  <b><a href="postconf.5.html#setgid_group">setgid_group</a></b>  setting  for  an already installed
               Postfix system.
 
-              This  feature is available in Postfix 2.1 and later.  With Post-
-              fix  2.0  and   earlier,   use   "<b>$<a href="postconf.5.html#config_directory">config_directory</a>/post-install</b>
+              This feature is available in Postfix 2.1 and later.  With  Post-
+              fix   2.0   and   earlier,  use  "<b>$<a href="postconf.5.html#config_directory">config_directory</a>/post-install</b>
               <b>set-permissions</b>".
 
        <b>tls</b> <i>subcommand</i>
-              Enable  opportunistic  TLS in the Postfix SMTP client or server,
-              and manage Postfix SMTP server TLS  private  keys  and  certifi-
+              Enable opportunistic TLS in the Postfix SMTP client  or  server,
+              and  manage  Postfix  SMTP  server TLS private keys and certifi-
               cates.  See <a href="postfix-tls.1.html">postfix-tls(1)</a> for documentation.
 
               This feature is available in Postfix 3.1 and later.
 
        <b>upgrade-configuration</b> [<i>name</i>=<i>value ...</i>]
-              Update  the  <a href="postconf.5.html"><b>main.cf</b></a>  and  <a href="master.5.html"><b>master.cf</b></a> files with information that
-              Postfix needs in order to run: add or update services,  and  add
+              Update the <a href="postconf.5.html"><b>main.cf</b></a> and <a href="master.5.html"><b>master.cf</b></a>  files  with  information  that
+              Postfix  needs  in order to run: add or update services, and add
               or update configuration parameter settings.
 
-              Specify  <i>name</i>=<i>value</i> to override and update specific <a href="postconf.5.html">main.cf</a> con-
+              Specify <i>name</i>=<i>value</i> to override and update specific <a href="postconf.5.html">main.cf</a>  con-
               figuration parameters.
 
-              This feature is available in Postfix 2.1 and later.  With  Post-
-              fix   2.0   and   earlier,  use  "<b>$<a href="postconf.5.html#config_directory">config_directory</a>/post-install</b>
+              This  feature is available in Postfix 2.1 and later.  With Post-
+              fix  2.0  and   earlier,   use   "<b>$<a href="postconf.5.html#config_directory">config_directory</a>/post-install</b>
               <b>upgrade-configuration</b>".
 
        The following options are implemented:
 
        <b>-c</b> <i>config</i><b>_</b><i>dir</i>
-              Read the <a href="postconf.5.html"><b>main.cf</b></a> and <a href="master.5.html"><b>master.cf</b></a> configuration files in the  named
-              directory  instead  of the default configuration directory.  Use
-              this to distinguish between multiple Postfix  instances  on  the
+              Read  the <a href="postconf.5.html"><b>main.cf</b></a> and <a href="master.5.html"><b>master.cf</b></a> configuration files in the named
+              directory instead of the default configuration  directory.   Use
+              this  to  distinguish  between multiple Postfix instances on the
               same host.
 
-              With  Postfix  2.6  and later, this option forces the <a href="postfix.1.html">postfix(1)</a>
+              With Postfix 2.6 and later, this option  forces  the  <a href="postfix.1.html">postfix(1)</a>
               command to operate on the specified Postfix instance only.  This
-              behavior  is  inherited  by  <a href="postfix.1.html">postfix(1)</a>  commands  that run as a
+              behavior is inherited by  <a href="postfix.1.html">postfix(1)</a>  commands  that  run  as  a
               descendant of the current process.
 
        <b>-D</b> (with <b>postfix start</b> only)
               Run each Postfix daemon under control of a debugger as specified
               via the <b><a href="postconf.5.html#debugger_command">debugger_command</a></b> configuration parameter.
 
-       <b>-v</b>     Enable  verbose  logging  for  debugging  purposes.  Multiple <b>-v</b>
+       <b>-v</b>     Enable verbose  logging  for  debugging  purposes.  Multiple  <b>-v</b>
               options make the software increasingly verbose.
 
 <b>ENVIRONMENT</b>
-       The <a href="postfix.1.html"><b>postfix</b>(1)</a> command  exports  the  following  environment  variables
+       The  <a href="postfix.1.html"><b>postfix</b>(1)</a>  command  exports  the  following environment variables
        before executing the <b>postfix-script</b> file:
 
        <b>MAIL_CONFIG</b>
               This is set when the -c command-line option is present.
 
               With Postfix 2.6 and later, this environment variable forces the
-              <a href="postfix.1.html">postfix(1)</a> command to operate on the specified Postfix  instance
-              only.   This  behavior  is inherited by <a href="postfix.1.html">postfix(1)</a> commands that
+              <a href="postfix.1.html">postfix(1)</a>  command to operate on the specified Postfix instance
+              only.  This behavior is inherited by  <a href="postfix.1.html">postfix(1)</a>  commands  that
               run as a descendant of the current process.
 
        <b>MAIL_VERBOSE</b>
@@ -145,7 +146,7 @@ POSTFIX(1)                                                          POSTFIX(1)
        ment variables with the same names:
 
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The  default  location of the Postfix <a href="postconf.5.html">main.cf</a> and <a href="master.5.html">master.cf</a> con-
+              The default location of the Postfix <a href="postconf.5.html">main.cf</a> and  <a href="master.5.html">master.cf</a>  con-
               figuration files.
 
        <b><a href="postconf.5.html#command_directory">command_directory</a> (see 'postconf -d' output)</b>
@@ -155,22 +156,22 @@ POSTFIX(1)                                                          POSTFIX(1)
               The directory with Postfix support programs and daemon programs.
 
        <b><a href="postconf.5.html#html_directory">html_directory</a> (see 'postconf -d' output)</b>
-              The  location  of Postfix HTML files that describe how to build,
+              The location of Postfix HTML files that describe how  to  build,
               configure or operate a specific Postfix subsystem or feature.
 
        <b><a href="postconf.5.html#mail_owner">mail_owner</a> (postfix)</b>
-              The UNIX system account that owns the  Postfix  queue  and  most
+              The  UNIX  system  account  that owns the Postfix queue and most
               Postfix daemon processes.
 
        <b><a href="postconf.5.html#mailq_path">mailq_path</a> (see 'postconf -d' output)</b>
-              Sendmail  compatibility feature that specifies where the Postfix
+              Sendmail compatibility feature that specifies where the  Postfix
               <a href="mailq.1.html"><b>mailq</b>(1)</a> command is installed.
 
        <b><a href="postconf.5.html#manpage_directory">manpage_directory</a> (see 'postconf -d' output)</b>
               Where the Postfix manual pages are installed.
 
        <b><a href="postconf.5.html#newaliases_path">newaliases_path</a> (see 'postconf -d' output)</b>
-              Sendmail compatibility feature that specifies  the  location  of
+              Sendmail  compatibility  feature  that specifies the location of
               the <a href="newaliases.1.html"><b>newaliases</b>(1)</a> command.
 
        <b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
@@ -181,31 +182,31 @@ POSTFIX(1)                                                          POSTFIX(1)
               configure or operate a specific Postfix subsystem or feature.
 
        <b><a href="postconf.5.html#sendmail_path">sendmail_path</a> (see 'postconf -d' output)</b>
-              A Sendmail compatibility feature that specifies the location  of
+              A  Sendmail compatibility feature that specifies the location of
               the Postfix <a href="sendmail.1.html"><b>sendmail</b>(1)</a> command.
 
        <b><a href="postconf.5.html#setgid_group">setgid_group</a> (postdrop)</b>
-              The   group   ownership  of  set-gid  Postfix  commands  and  of
+              The  group  ownership  of  set-gid  Postfix  commands   and   of
               group-writable Postfix directories.
 
        Available in Postfix version 2.5 and later:
 
        <b><a href="postconf.5.html#data_directory">data_directory</a> (see 'postconf -d' output)</b>
-              The directory with Postfix-writable  data  files  (for  example:
+              The  directory  with  Postfix-writable  data files (for example:
               caches, pseudo-random numbers).
 
        Available in Postfix version 3.0 and later:
 
        <b><a href="postconf.5.html#meta_directory">meta_directory</a> (see 'postconf -d' output)</b>
-              The  location of non-executable files that are shared among mul-
-              tiple Postfix instances, such as postfix-files,  dynamicmaps.cf,
-              and  the  multi-instance  template  files <a href="postconf.5.html">main.cf</a>.proto and <a href="master.5.html">mas-
+              The location of non-executable files that are shared among  mul-
+              tiple  Postfix instances, such as postfix-files, dynamicmaps.cf,
+              and the multi-instance template  files  <a href="postconf.5.html">main.cf</a>.proto  and  <a href="master.5.html">mas-
               ter.cf</a>.proto.
 
        <b><a href="postconf.5.html#shlib_directory">shlib_directory</a> (see 'postconf -d' output)</b>
-              The location of Postfix dynamically-linked  libraries  (libpost-
-              fix-*.so),  and the default location of Postfix database plugins
-              (postfix-*.so) that have  a  relative  pathname  in  the  dynam-
+              The  location  of Postfix dynamically-linked libraries (libpost-
+              fix-*.so), and the default location of Postfix database  plugins
+              (postfix-*.so)  that  have  a  relative  pathname  in the dynam-
               icmaps.cf file.
 
        Available in Postfix version 3.1 and later:
@@ -216,29 +217,29 @@ POSTFIX(1)                                                          POSTFIX(1)
        Other configuration parameters:
 
        <b><a href="postconf.5.html#import_environment">import_environment</a> (see 'postconf -d' output)</b>
-              The  list  of  environment  parameters that a privileged Postfix
-              process will  import  from  a  non-Postfix  parent  process,  or
+              The list of environment parameters  that  a  privileged  Postfix
+              process  will  import  from  a  non-Postfix  parent  process, or
               name=value environment overrides.
 
        <b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
               The syslog facility of Postfix logging.
 
        <b><a href="postconf.5.html#syslog_name">syslog_name</a> (see 'postconf -d' output)</b>
-              A  prefix  that  is  prepended  to  the  process  name in syslog
+              A prefix that  is  prepended  to  the  process  name  in  syslog
               records, so that, for example, "smtpd" becomes "prefix/smtpd".
 
        Available in Postfix version 2.6 and later:
 
        <b><a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a> (empty)</b>
-              An optional list of non-default Postfix  configuration  directo-
-              ries;  these  directories belong to additional Postfix instances
-              that share the Postfix executable files and  documentation  with
-              the  default  Postfix  instance,  and that are started, stopped,
+              An  optional  list of non-default Postfix configuration directo-
+              ries; these directories belong to additional  Postfix  instances
+              that  share  the Postfix executable files and documentation with
+              the default Postfix instance, and  that  are  started,  stopped,
               etc., together with the default Postfix instance.
 
        <b><a href="postconf.5.html#multi_instance_wrapper">multi_instance_wrapper</a> (empty)</b>
-              The pathname of a multi-instance manager command that the  <a href="postfix.1.html"><b>post-</b></a>
-              <a href="postfix.1.html"><b>fix</b>(1)</a>   command  invokes  when  the  <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a>
+              The  pathname of a multi-instance manager command that the <a href="postfix.1.html"><b>post-</b></a>
+              <a href="postfix.1.html"><b>fix</b>(1)</a>  command  invokes  when  the   <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a>
               parameter value is non-empty.
 
        <b><a href="postconf.5.html#multi_instance_group">multi_instance_group</a> (empty)</b>
@@ -248,15 +249,15 @@ POSTFIX(1)                                                          POSTFIX(1)
               The optional instance name of this Postfix instance.
 
        <b><a href="postconf.5.html#multi_instance_enable">multi_instance_enable</a> (no)</b>
-              Allow this Postfix instance to be started, stopped, etc.,  by  a
+              Allow  this  Postfix instance to be started, stopped, etc., by a
               multi-instance manager.
 
 <b>FILES</b>
-       Prior  to Postfix version 2.6, all of the following files were in <b>$<a href="postconf.5.html#config_directory">con</a>-</b>
+       Prior to Postfix version 2.6, all of the following files were in  <b>$<a href="postconf.5.html#config_directory">con</a>-</b>
        <b><a href="postconf.5.html#config_directory">fig_directory</a></b>. Some files are now in <b>$<a href="postconf.5.html#daemon_directory">daemon_directory</a></b> so that they can
        be shared among multiple instances that run the same Postfix version.
 
-       Use  the command "<b>postconf <a href="postconf.5.html#config_directory">config_directory</a></b>" or "<b>postconf <a href="postconf.5.html#daemon_directory">daemon_direc</a>-</b>
+       Use the command "<b>postconf <a href="postconf.5.html#config_directory">config_directory</a></b>" or "<b>postconf  <a href="postconf.5.html#daemon_directory">daemon_direc</a>-</b>
        <b><a href="postconf.5.html#daemon_directory">tory</a></b>" to expand the names into their actual values.
 
        $<a href="postconf.5.html#config_directory">config_directory</a>/<a href="postconf.5.html">main.cf</a>, Postfix configuration parameters
index fa0216050aef23323844e64cbbd7d1ea4f00f106..d2a78285d2aa5b6d92f8400236ac39ab80ee1553 100644 (file)
@@ -39,13 +39,14 @@ Start the Postfix mail system. This also runs the configuration
 check described above.
 .IP \fBstart\-fg\fR
 Like \fBstart\fR, but keep the master daemon running in the
-foreground. This requires that multi\-instance support is
-disabled (i.e. the multi_instance_directories parameter
-value must be empty). When running Postfix inside a container,
-mount the container host's /dev/log socket inside the
-container (example: "docker run \-v /dev/log:/dev/log ...")
-and specify a distinct Postfix "syslog_name" prefix that
-identifies logging from the Postfix instance.
+foreground, if possible as PID 1. This command requires
+that multi\-instance support is disabled (i.e. the
+multi_instance_directories parameter value must be empty).
+When running Postfix inside a container, mount the container
+host's /dev/log socket inside the container (example: "docker
+run \-v /dev/log:/dev/log ...")  and specify a distinct
+Postfix "syslog_name" prefix that identifies logging from
+the Postfix instance.
 .IP \fBstop\fR
 Stop the Postfix mail system in an orderly fashion. If
 possible, running processes are allowed to terminate at
index 1eda9afe799d0821da809a8f2ab2e2a3e2b8a231..9316dea1706d1eff3c99da8f6f233b6030ceb8d3 100644 (file)
@@ -8,7 +8,7 @@ Postfix master process
 .SH "SYNOPSIS"
 .na
 .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
 .ad
 .fi
@@ -43,6 +43,10 @@ for debugging only.
 .IP "\fB\-e \fIexit_time\fR"
 Terminate the master process after \fIexit_time\fR seconds. Child
 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
 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
index e636521618a6b70b17f6354a5cda1e9175dc76fa..86fd40339ef03d91d1c57cea0c3c876398d23875 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20180401"
+#define MAIL_RELEASE_DATE      "20180403"
 #define MAIL_VERSION_NUMBER    "3.4"
 
 #ifdef SNAPSHOT
index 846b2a415a499bd21e01d3e3b07a7bc7d7e2f77e..6e9e604aa7b0f8969f5837acc75d1f4e25e2b85f 100644 (file)
@@ -4,7 +4,7 @@
 /* SUMMARY
 /*     Postfix master process
 /* 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
 /*     The \fBmaster\fR(8) daemon is the resident process that runs Postfix
 /*     daemons on demand: daemons to send or receive messages via the
 /* .IP "\fB-e \fIexit_time\fR"
 /*     Terminate the master process after \fIexit_time\fR seconds. Child
 /*     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
 /*     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
@@ -266,6 +270,7 @@ int     main(int argc, char **argv)
     ARGV   *import_env;
     int     wait_flag = 0;
     int     monitor_fd = -1;
+    int     init_mode = 0;
 
     /*
      * Fingerprint executables and core dumps.
@@ -334,7 +339,7 @@ int     main(int argc, char **argv)
     /*
      * Process JCL.
      */
-    while ((ch = GETOPT(argc, argv, "c:Dde:tvw")) > 0) {
+    while ((ch = GETOPT(argc, argv, "c:Dde:itvw")) > 0) {
        switch (ch) {
        case 'c':
            if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
@@ -346,6 +351,11 @@ int     main(int argc, char **argv)
        case 'e':
            event_request_timer(master_exit_event, (void *) 0, atoi(optarg));
            break;
+       case 'i':
+           if (getpid() != 1)
+               msg_fatal("-i is allowed with for PID 1 process");
+           init_mode = 1;
+           break;
        case 'D':
            debug_me = 1;
            break;
@@ -375,6 +385,8 @@ int     main(int argc, char **argv)
      */
     if (test_lock && wait_flag)
        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
@@ -403,7 +415,8 @@ int     main(int argc, char **argv)
      * all MTA processes cleanly. Give up if we can't separate from our
      * 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");
 
     /*
index 81ae7f4606aa4412eee63d8e762216dd2e81a7cc..88f6f23059ea432b5ae3ac70d5083db503c7128e 100644 (file)
@@ -210,6 +210,8 @@ static void master_sigdeath(int sig)
        msg_fatal("%s: sigaction: %m", myname);
     if (kill(pid, sig) < 0)
        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 */
index c9b3174e838591cf7eca14a9d8be001f21b31323..4ca42f1931272de350ab626251793c461fcf76cd 100644 (file)
 /*     check described above.
 /* .IP \fBstart-fg\fR
 /*     Like \fBstart\fR, but keep the master daemon running in the
-/*     foreground. This requires that multi-instance support is
-/*     disabled (i.e. the multi_instance_directories parameter
-/*     value must be empty). When running Postfix inside a container,
-/*     mount the container host's /dev/log socket inside the
-/*     container (example: "docker run -v /dev/log:/dev/log ...")
-/*     and specify a distinct Postfix "syslog_name" prefix that
-/*     identifies logging from the Postfix instance.
+/*     foreground, if possible as PID 1. This command requires
+/*     that multi-instance support is disabled (i.e. the
+/*     multi_instance_directories parameter value must be empty).
+/*     When running Postfix inside a container, mount the container
+/*     host's /dev/log socket inside the container (example: "docker
+/*     run -v /dev/log:/dev/log ...")  and specify a distinct
+/*     Postfix "syslog_name" prefix that identifies logging from
+/*     the Postfix instance.
 /* .IP \fBstop\fR
 /*     Stop the Postfix mail system in an orderly fashion. If
 /*     possible, running processes are allowed to terminate at