/[smeserver]/rpms/qpsmtpd/sme9/0030-Add-support-for-multiple-postfix-cleanup-sockets.patch
ViewVC logotype

Contents of /rpms/qpsmtpd/sme9/0030-Add-support-for-multiple-postfix-cleanup-sockets.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Feb 2 00:59:44 2013 UTC (11 years, 9 months ago) by slords
Branch: MAIN
CVS Tags: qpsmtpd-0_84-14_el6_sme, qpsmtpd-0_84-16_el6_sme, qpsmtpd-0_84-12_el6_sme, qpsmtpd-0_96-7_el6_sme, qpsmtpd-0_96-2_el6_sme, qpsmtpd-0_84-13_el6_sme, qpsmtpd-0_84-6_el6_sme, qpsmtpd-0_84-18_el6_sme, qpsmtpd-0_84-9_el6_sme, qpsmtpd-0_84-4_el6_sme, qpsmtpd-0_96-11_el6_sme, qpsmtpd-0_84-15_el6_sme, qpsmtpd-0_96-4_el6_sme, qpsmtpd-0_96-3_el6_sme, qpsmtpd-0_96-10_el6_sme, qpsmtpd-0_84-17_el6_sme, qpsmtpd-0_84-7_el6_sme, qpsmtpd-0_96-5_el6_sme, qpsmtpd-0_84-10_el6_sme, qpsmtpd-0_84-8_el6_sme, qpsmtpd-0_96-1_el6_sme, qpsmtpd-0_84-5_el6_sme, qpsmtpd-0_96-6_el6_sme, qpsmtpd-0_96-8_el6_sme, qpsmtpd-0_84-11_el6_sme, qpsmtpd-0_96-9_el6_sme, HEAD
* Fri Feb 1 2013 Shad L. Lords <slords@mail.com> 0.84-4.sme
- Update spec so building on rhel6 works [SME: 7263]

1 From 295474503f4fde32012b43a00d6813088cd47747 Mon Sep 17 00:00:00 2001
2 From: jaredj <jaredj@nmgi.com>
3 Date: Thu, 5 Mar 2009 08:06:50 +0800
4 Subject: Add support for multiple postfix cleanup sockets
5
6 The current postfix-queue plugin allows the administrator to set a
7 single path to a local postfix cleanup socket file from the plugin
8 'command line'. This adds a 'cleanup_sockets' configuration directive
9 that can contain a list of paths as well as host/port combinations
10 pointing to postfix cleanup services, which will be tried in the order
11 that they appear. Not yet tested.
12 ---
13 lib/Qpsmtpd/Postfix.pm | 29 ++++++++++++++++++++++-------
14 plugins/queue/postfix-queue | 16 ++++++++++------
15 2 files changed, 32 insertions(+), 13 deletions(-)
16
17 diff --git a/lib/Qpsmtpd/Postfix.pm b/lib/Qpsmtpd/Postfix.pm
18 index f045f7f..519e5f6 100644
19 --- a/lib/Qpsmtpd/Postfix.pm
20 +++ b/lib/Qpsmtpd/Postfix.pm
21 @@ -14,6 +14,7 @@ details.
22
23 use strict;
24 use IO::Socket::UNIX;
25 +use IO::Socket::INET;
26 use vars qw(@ISA);
27 @ISA = qw(IO::Socket::UNIX);
28
29 @@ -92,12 +93,22 @@ sub print_rec_time {
30 sub open_cleanup {
31 my ($class, $socket) = @_;
32
33 - $socket = "/var/spool/postfix/public/cleanup"
34 - unless defined $socket;
35 -
36 - my $self = IO::Socket::UNIX->new(Type => SOCK_STREAM,
37 - Peer => $socket);
38 - die qq(Couldn't open unix socket "$socket": $!) unless ref $self;
39 + my $self;
40 + if ($socket =~ m#^(/.+)#) {
41 + $socket = $1; # un-taint socket path
42 + $self = IO::Socket::UNIX->new(Type => SOCK_STREAM,
43 + Peer => $socket) if $socket;
44 +
45 + } elsif ($socket =~ /(.*):(\d+)/) {
46 + my ($host,$port) = ($1,$2); # un-taint address and port
47 + $self = IO::Socket::INET->new(Proto => 'tcp',
48 + PeerAddr => $host,PeerPort => $port)
49 + if $host and $port;
50 + }
51 + unless (ref $self) {
52 + warn "Couldn't open \"$socket\": $!";
53 + return;
54 + }
55 # allow buffered writes
56 $self->autoflush(0);
57 bless ($self, $class);
58 @@ -163,7 +174,11 @@ $transaction is supposed to be a Qpsmtpd::Transaction object.
59 sub inject_mail {
60 my ($class, $transaction) = @_;
61
62 - my $strm = $class->open_cleanup($transaction->notes('postfix-queue-socket'));
63 + my @sockets = @{$transaction->notes('postfix-queue-sockets')
64 + // ['/var/spool/postfix/public/cleanup']};
65 + my $strm;
66 + $strm = $class->open_cleanup($_) and last for @sockets;
67 + die "Unable to open any cleanup sockets!" unless $strm;
68
69 my %at = $strm->get_attr;
70 my $qid = $at{queue_id};
71 diff --git a/plugins/queue/postfix-queue b/plugins/queue/postfix-queue
72 index 8b3a3c0..28fa44f 100644
73 --- a/plugins/queue/postfix-queue
74 +++ b/plugins/queue/postfix-queue
75 @@ -11,7 +11,10 @@ This plugin passes mails on to the postfix cleanup daemon.
76
77 The first optional parameter is the location of the cleanup socket. If it does
78 not start with a ``/'', it is treated as a flag for cleanup (see below).
79 -If set, the environment variable POSTFIXQUEUE overrides this setting.
80 +The 'postfix_queue' plugin can also contain a list of cleanup socket paths
81 +and/or remote postfix cleanup service hosts specified in the form of
82 +'address:port'. If set, the environment variable POSTFIXQUEUE overrides both
83 +of these settings.
84
85 All other parameters are flags for cleanup, no flags are enabled by default.
86 See below in ``POSTFIX COMPATIBILITY'' for flags understood by your postfix
87 @@ -133,9 +136,6 @@ sub register {
88 $self->{_queue_socket} = $1;
89 shift @args;
90 }
91 - else {
92 - $self->{_queue_socket} = "/var/spool/postfix/public/cleanup";
93 - }
94
95 foreach (@args) {
96 if ($self->can("CLEANUP_".$_) and /^(FLAG_[A-Z0-9_]+)$/) {
97 @@ -152,14 +152,18 @@ sub register {
98 $self->{_queue_socket} = "/var/spool/postfix/public/cleanup";
99 }
100
101 - $self->{_queue_socket} = $ENV{POSTFIXQUEUE} if $ENV{POSTFIXQUEUE};
102 + $self->{_queue_socket_env} = $ENV{POSTFIXQUEUE} if $ENV{POSTFIXQUEUE};
103
104 }
105
106 sub hook_queue {
107 my ($self, $transaction) = @_;
108 $transaction->notes('postfix-queue-flags', $self->{_queue_flags});
109 - $transaction->notes('postfix-queue-socket', $self->{_queue_socket});
110 + my @queue;
111 + @queue = ($self->{_queue_socket_env}) if $self->{_queue_socket_env};
112 + @queue = $self->qp->config('cleanup_sockets') unless @queue;
113 + @queue = ($self->{_queue_socket} // ()) unless @queue;
114 + $transaction->notes('postfix-queue-sockets', \@queue) if @queue;
115
116 # $self->log(LOGDEBUG, "queue-flags=".$transaction->notes('postfix-queue-flags'));
117 my ($status, $qid, $reason) = Qpsmtpd::Postfix->inject_mail($transaction);
118 --
119 1.7.2.2
120

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed