Mercurial > packages > rhel6 > postfwd
diff postfwd-fix-pidfile-permissions.patch @ 0:e03652c59c7d
Initial revision
author | Guido Berhoerster <guido+packaging@berhoerster.name> |
---|---|
date | Wed, 09 Jan 2013 17:46:39 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfwd-fix-pidfile-permissions.patch Wed Jan 09 17:46:39 2013 +0100 @@ -0,0 +1,92 @@ +Index: Notizen/sbin/postfwd +=================================================================== +--- Notizen.orig/sbin/postfwd ++++ Notizen/sbin/postfwd +@@ -19,6 +19,7 @@ use POSIX qw(setsid setuid setgid setloc + use IO::Socket qw(SOCK_STREAM); + use Net::DNS; + use Net::Server::Multiplex; ++use Net::Server::Daemonize qw(create_pid_file); + use vars qw(@ISA); + @ISA = qw(Net::Server::Multiplex); + our($TIMEHIRES); our($STORABLE); +@@ -2681,7 +2682,6 @@ if ($opt_daemon) { + group => $net_group, + chroot => $net_chroot ? $net_chroot : undef, + setsid => $opt_daemon ? 1 : undef, +- pid_file => $net_pid ? $net_pid : undef, + log_level => $opt_perfmon ? 0 : ($opt_verbose + 2), + log_file => $opt_perfmon ? undef : 'Sys::Syslog', + syslog_logsock => $syslog_socktype, +@@ -2736,6 +2736,23 @@ if ($opt_daemon) { + log_info "$NAME $VERSION ready for input"; + }; + ++ # create pid_file ourselves in order to control permissions ++ sub post_configure_hook { ++ my $self = shift; ++ my $prop = $self->{'server'}; ++ ++ $prop->{'pid_file'} = $net_pid ? $net_pid : undef; ++ umask oct('0022'); ++ if ($prop->{'pid_file'}) { ++ if (eval { create_pid_file($prop->{'pid_file'}) }) { ++ $prop->{'pid_file_unlink'} = 1; ++ } else { ++ $self->fatal(my $e = $@); ++ } ++ } ++ umask oct($net_umask); ++ } ++ + # main loop + sub mux_input() { + +@@ -3637,7 +3654,7 @@ The following arguments will control it' + Changes real and effective group to <name>. + + --umask <mask> +- Changes the umask for filepermissions (unix domain sockets, pidfiles). ++ Changes the umask for filepermissions (unix domain sockets). + Attention: This is umask, not chmod - you have to specify the bits that + should NOT apply. E.g.: umask 077 equals to chmod 700. + +Index: Notizen/man/man8/postfwd.8 +=================================================================== +--- Notizen.orig/man/man8/postfwd.8 ++++ Notizen/man/man8/postfwd.8 +@@ -1198,7 +1198,7 @@ The following arguments will control it' + .PP + .Vb 4 + \& --umask <mask> +-\& Changes the umask for filepermissions (unix domain sockets, pidfiles). ++\& Changes the umask for filepermissions (unix domain sockets). + \& Attention: This is umask, not chmod - you have to specify the bits that + \& should NOT apply. E.g.: umask 077 equals to chmod 700. + .Ve +Index: Notizen/doc/postfwd.html +=================================================================== +--- Notizen.orig/doc/postfwd.html ++++ Notizen/doc/postfwd.html +@@ -822,7 +822,7 @@ The following arguments will control it' + Changes real and effective group to <name>.</pre> + <pre> + --umask <mask> +- Changes the umask for filepermissions (unix domain sockets, pidfiles). ++ Changes the umask for filepermissions (unix domain sockets). + Attention: This is umask, not chmod - you have to specify the bits that + should NOT apply. E.g.: umask 077 equals to chmod 700.</pre> + <pre> +Index: Notizen/doc/postfwd.txt +=================================================================== +--- Notizen.orig/doc/postfwd.txt ++++ Notizen/doc/postfwd.txt +@@ -876,7 +876,7 @@ DESCRIPTION + Changes real and effective group to <name>. + + --umask <mask> +- Changes the umask for filepermissions (unix domain sockets, pidfiles). ++ Changes the umask for filepermissions (unix domain sockets). + Attention: This is umask, not chmod - you have to specify the bits that + should NOT apply. E.g.: umask 077 equals to chmod 700. +