/[smeserver]/rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-peers_plugin.patch
ViewVC logotype

Contents of /rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-peers_plugin.patch

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


Revision 1.1 - (show annotations) (download)
Tue Jun 12 21:05:56 2007 UTC (17 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: smeserver-qpsmtpd-1_2_1-42_el5_sme, smeserver-qpsmtpd-1_2_1-39_el5_sme, smeserver-qpsmtpd-1_2_1-45_el5_sme, smeserver-qpsmtpd-1_2_1-51_el5_sme, smeserver-qpsmtpd-1_2_1-52_el5_sme, smeserver-qpsmtpd-1_2_1-40_el5_sme, smeserver-qpsmtpd-1_2_1-47_el5_sme, smeserver-qpsmtpd-1_2_1-49_el5_sme, smeserver-qpsmtpd-1_2_1-57_el5_sme, smeserver-qpsmtpd-1_2_1-44_el5_sme, smeserver-qpsmtpd-1_2_1-55_el5_sme, smeserver-qpsmtpd-1_2_1-56_el5_sme, smeserver-qpsmtpd-1_2_1-53_el5_sme, smeserver-qpsmtpd-1_2_1-54_el5_sme, smeserver-qpsmtpd-1_2_1-41_el5_sme, smeserver-qpsmtpd-1_2_1-50_el5_sme, smeserver-qpsmtpd-1_2_1-43_el5_sme, smeserver-qpsmtpd-1_2_1-46_el5_sme
Import on branch sme8 of package smeserver-qpsmtpd-1.2.1-39.el5.sme.src.rpm

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/peers mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/peers
2 --- smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/peers 1969-12-31 19:00:00.000000000 -0500
3 +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/peers 2006-09-08 10:40:49.000000000 -0400
4 @@ -0,0 +1,70 @@
5 +# this plugin checks the peers directory for config
6 +# file most closely matching the client IP address
7 +# and loads it if found.
8 +#
9 +# Note that init() borrows some internals from Qpsmtpd.pm - I
10 +# didn't see a suitable public interface.
11 +
12 +sub init {
13 + my $self = shift;
14 + my $qp = shift;
15 + my $plugins_list_file = shift;
16 + my @plugins = $qp->config($plugins_list_file);
17 + my $dir = $qp->plugin_dir;
18 +
19 + for my $plugin (@plugins) {
20 + my $plugin_name = $plugin;
21 + $plugin =~ s/:\d+$//; # after this point, only used for filename
22 +
23 + # Escape everything into valid perl identifiers
24 + $plugin_name =~ s/([^A-Za-z0-9_\/])/sprintf("_%2x",unpack("C",$1))/eg;
25 +
26 + # second pass cares for slashes and words starting with a digit
27 + $plugin_name =~ s{
28 + (/+) # directory
29 + (\d?) # package's first character
30 + }[
31 + "::" . (length $2 ? sprintf("_%2x",unpack("C",$2)) : "")
32 + ]egx;
33 +
34 + my $package = "Qpsmtpd::Plugin::$plugin_name";
35 +
36 + # don't reload plugins if they are already loaded
37 + unless ( defined &{"${package}::plugin_name"} ) {
38 + Qpsmtpd::Plugin->compile($plugin_name,
39 + $package, "$dir/$plugin", $self->{_test_mode});
40 + $self->log(LOGDEBUG, "Compiling $plugin")
41 + unless $plugin =~ /logging/;
42 + }
43 + }
44 +
45 + return 1;
46 +}
47 +sub _peer_plugins {
48 + my $qp = shift;
49 + my $config = shift;
50 + my @plugins = $qp->config($config);
51 + $qp->log(LOGNOTICE, "loading plugins @plugins from $config");
52 +
53 + return $qp->_load_plugins($qp->plugin_dir, @plugins);
54 +}
55 +
56 +sub hook_connect {
57 + my ($self, $transaction) = @_;
58 + my $qp = $self->qp;
59 + my $connection = $qp->connection;
60 +
61 + my $client_ip = $qp->connection->remote_ip;
62 + while ($client_ip) {
63 + if (-f "config/peers/$client_ip") {
64 + _peer_plugins($qp, "peers/$client_ip");
65 + return (DECLINED);
66 + }
67 + $client_ip =~ s/\.+\d+\.?$//; # strip off another 8 bits
68 + }
69 + if (-f "config/peers/0") {
70 + _peer_plugins($qp, "peers/0");
71 + return (DECLINED);
72 + }
73 + return (DENY);
74 +}

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