comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:e03652c59c7d
1 Index: Notizen/sbin/postfwd
2 ===================================================================
3 --- Notizen.orig/sbin/postfwd
4 +++ Notizen/sbin/postfwd
5 @@ -19,6 +19,7 @@ use POSIX qw(setsid setuid setgid setloc
6 use IO::Socket qw(SOCK_STREAM);
7 use Net::DNS;
8 use Net::Server::Multiplex;
9 +use Net::Server::Daemonize qw(create_pid_file);
10 use vars qw(@ISA);
11 @ISA = qw(Net::Server::Multiplex);
12 our($TIMEHIRES); our($STORABLE);
13 @@ -2681,7 +2682,6 @@ if ($opt_daemon) {
14 group => $net_group,
15 chroot => $net_chroot ? $net_chroot : undef,
16 setsid => $opt_daemon ? 1 : undef,
17 - pid_file => $net_pid ? $net_pid : undef,
18 log_level => $opt_perfmon ? 0 : ($opt_verbose + 2),
19 log_file => $opt_perfmon ? undef : 'Sys::Syslog',
20 syslog_logsock => $syslog_socktype,
21 @@ -2736,6 +2736,23 @@ if ($opt_daemon) {
22 log_info "$NAME $VERSION ready for input";
23 };
24
25 + # create pid_file ourselves in order to control permissions
26 + sub post_configure_hook {
27 + my $self = shift;
28 + my $prop = $self->{'server'};
29 +
30 + $prop->{'pid_file'} = $net_pid ? $net_pid : undef;
31 + umask oct('0022');
32 + if ($prop->{'pid_file'}) {
33 + if (eval { create_pid_file($prop->{'pid_file'}) }) {
34 + $prop->{'pid_file_unlink'} = 1;
35 + } else {
36 + $self->fatal(my $e = $@);
37 + }
38 + }
39 + umask oct($net_umask);
40 + }
41 +
42 # main loop
43 sub mux_input() {
44
45 @@ -3637,7 +3654,7 @@ The following arguments will control it'
46 Changes real and effective group to <name>.
47
48 --umask <mask>
49 - Changes the umask for filepermissions (unix domain sockets, pidfiles).
50 + Changes the umask for filepermissions (unix domain sockets).
51 Attention: This is umask, not chmod - you have to specify the bits that
52 should NOT apply. E.g.: umask 077 equals to chmod 700.
53
54 Index: Notizen/man/man8/postfwd.8
55 ===================================================================
56 --- Notizen.orig/man/man8/postfwd.8
57 +++ Notizen/man/man8/postfwd.8
58 @@ -1198,7 +1198,7 @@ The following arguments will control it'
59 .PP
60 .Vb 4
61 \& --umask <mask>
62 -\& Changes the umask for filepermissions (unix domain sockets, pidfiles).
63 +\& Changes the umask for filepermissions (unix domain sockets).
64 \& Attention: This is umask, not chmod - you have to specify the bits that
65 \& should NOT apply. E.g.: umask 077 equals to chmod 700.
66 .Ve
67 Index: Notizen/doc/postfwd.html
68 ===================================================================
69 --- Notizen.orig/doc/postfwd.html
70 +++ Notizen/doc/postfwd.html
71 @@ -822,7 +822,7 @@ The following arguments will control it'
72 Changes real and effective group to &lt;name&gt;.</pre>
73 <pre>
74 --umask &lt;mask&gt;
75 - Changes the umask for filepermissions (unix domain sockets, pidfiles).
76 + Changes the umask for filepermissions (unix domain sockets).
77 Attention: This is umask, not chmod - you have to specify the bits that
78 should NOT apply. E.g.: umask 077 equals to chmod 700.</pre>
79 <pre>
80 Index: Notizen/doc/postfwd.txt
81 ===================================================================
82 --- Notizen.orig/doc/postfwd.txt
83 +++ Notizen/doc/postfwd.txt
84 @@ -876,7 +876,7 @@ DESCRIPTION
85 Changes real and effective group to <name>.
86
87 --umask <mask>
88 - Changes the umask for filepermissions (unix domain sockets, pidfiles).
89 + Changes the umask for filepermissions (unix domain sockets).
90 Attention: This is umask, not chmod - you have to specify the bits that
91 should NOT apply. E.g.: umask 077 equals to chmod 700.
92