1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/createlinks mezzanine_patched_smeserver-qpsmtpd-1.2.1/createlinks |
2 |
--- smeserver-qpsmtpd-1.2.1/createlinks 2007-06-14 17:09:21.000000000 -0600 |
3 |
+++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/createlinks 2007-06-14 16:55:03.000000000 -0600 |
4 |
@@ -89,7 +89,7 @@ |
5 |
require_resolvable_fromhost |
6 |
rhsbl_zones |
7 |
signatures_patterns |
8 |
- plugin_dir |
9 |
+ plugin_dirs |
10 |
smtpgreeting |
11 |
spool_dir |
12 |
invalid_resolvable_fromhost |
13 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dir/template-begin mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dir/template-begin |
14 |
--- smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dir/template-begin 2005-10-06 19:21:58.000000000 -0600 |
15 |
+++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dir/template-begin 1969-12-31 17:00:00.000000000 -0700 |
16 |
@@ -1 +0,0 @@ |
17 |
-/usr/share/qpsmtpd/plugins |
18 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dirs/template-begin mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dirs/template-begin |
19 |
--- smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dirs/template-begin 1969-12-31 17:00:00.000000000 -0700 |
20 |
+++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugin_dirs/template-begin 2005-10-06 19:21:58.000000000 -0600 |
21 |
@@ -0,0 +1 @@ |
22 |
+/usr/share/qpsmtpd/plugins |
23 |
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 |
24 |
--- smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/peers 2007-06-14 17:09:21.000000000 -0600 |
25 |
+++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/peers 2007-06-14 17:08:54.000000000 -0600 |
26 |
@@ -10,33 +10,56 @@ |
27 |
my $qp = shift; |
28 |
my $plugins_list_file = shift || 'peers/0'; |
29 |
my @plugins = $qp->config($plugins_list_file); |
30 |
- my $dir = $qp->plugin_dir; |
31 |
+ my @plugin_dirs = $qp->plugin_dirs; |
32 |
|
33 |
for my $plugin_line (@plugins) { |
34 |
my ($plugin, @args) = split ' ', $plugin_line; |
35 |
|
36 |
- my $plugin_name = $plugin; |
37 |
- $plugin =~ s/:\d+$//; # after this point, only used for filename |
38 |
+ my $package; |
39 |
|
40 |
- # Escape everything into valid perl identifiers |
41 |
- $plugin_name =~ s/([^A-Za-z0-9_\/])/sprintf("_%2x",unpack("C",$1))/eg; |
42 |
- |
43 |
- # second pass cares for slashes and words starting with a digit |
44 |
- $plugin_name =~ s{ |
45 |
- (/+) # directory |
46 |
- (\d?) # package's first character |
47 |
- }[ |
48 |
- "::" . (length $2 ? sprintf("_%2x",unpack("C",$2)) : "") |
49 |
- ]egx; |
50 |
- |
51 |
- my $package = "Qpsmtpd::Plugin::$plugin_name"; |
52 |
- |
53 |
- # don't reload plugins if they are already loaded |
54 |
- unless ( defined &{"${package}::plugin_name"} ) { |
55 |
- Qpsmtpd::Plugin->compile($plugin_name, |
56 |
- $package, "$dir/$plugin", $self->{_test_mode}); |
57 |
- $self->log(LOGDEBUG, "Compiling $plugin") |
58 |
- unless $plugin =~ /logging/; |
59 |
+ if ($plugin =~ m/::/) { |
60 |
+ # "full" package plugin (My::Plugin) |
61 |
+ $package = $plugin; |
62 |
+ $package =~ s/[^_a-z0-9:]+//gi; |
63 |
+ my $eval = qq[require $package;\n] |
64 |
+ .qq[sub ${plugin}::plugin_name { '$plugin' }]; |
65 |
+ $eval =~ m/(.*)/s; |
66 |
+ $eval = $1; |
67 |
+ eval $eval; |
68 |
+ die "Failed loading $package - eval $@" if $@; |
69 |
+ $self->log(LOGDEBUG, "Loading $package ($plugin_line)") |
70 |
+ unless $plugin_line =~ /logging/; |
71 |
+ } |
72 |
+ else { |
73 |
+ # regular plugins/$plugin plugin |
74 |
+ my $plugin_name = $plugin; |
75 |
+ $plugin =~ s/:\d+$//; # after this point, only used for filename |
76 |
+ |
77 |
+ # Escape everything into valid perl identifiers |
78 |
+ $plugin_name =~ s/([^A-Za-z0-9_\/])/sprintf("_%2x",unpack("C",$1))/eg; |
79 |
+ |
80 |
+ # second pass cares for slashes and words starting with a digit |
81 |
+ $plugin_name =~ s{ |
82 |
+ (/+) # directory |
83 |
+ (\d?) # package's first character |
84 |
+ }[ |
85 |
+ "::" . (length $2 ? sprintf("_%2x",unpack("C",$2)) : "") |
86 |
+ ]egx; |
87 |
+ |
88 |
+ $package = "Qpsmtpd::Plugin::$plugin_name"; |
89 |
+ |
90 |
+ # don't reload plugins if they are already loaded |
91 |
+ unless ( defined &{"${package}::plugin_name"} ) { |
92 |
+ PLUGIN_DIR: for my $dir (@plugin_dirs) { |
93 |
+ if (-e "$dir/$plugin") { |
94 |
+ Qpsmtpd::Plugin->compile($plugin_name, $package, |
95 |
+ "$dir/$plugin", $self->{_test_mode}, $plugin); |
96 |
+ $self->log(LOGDEBUG, "Loading $plugin_line from $dir/$plugin") |
97 |
+ unless $plugin_line =~ /logging/; |
98 |
+ last PLUGIN_DIR; |
99 |
+ } |
100 |
+ } |
101 |
+ } |
102 |
} |
103 |
} |
104 |
|