1 |
stephdl |
1.1 |
From 2979c52b475533ce1fdff235800fb7d550806a29 Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Peter A Eisch <peterbokunet@hotmail.com> |
3 |
|
|
Date: Wed, 9 Dec 2009 06:52:33 +0800 |
4 |
|
|
Subject: Adds the ability to have multiple instances (each with different |
5 |
|
|
configs) running under Apache. |
6 |
|
|
|
7 |
|
|
--- |
8 |
|
|
lib/Apache/Qpsmtpd.pm | 35 ++++++++++++++++++++++++++++++++++- |
9 |
|
|
1 files changed, 34 insertions(+), 1 deletions(-) |
10 |
|
|
|
11 |
|
|
diff --git a/lib/Apache/Qpsmtpd.pm b/lib/Apache/Qpsmtpd.pm |
12 |
|
|
index f03e430..4281670 100644 |
13 |
|
|
--- a/lib/Apache/Qpsmtpd.pm |
14 |
|
|
+++ b/lib/Apache/Qpsmtpd.pm |
15 |
|
|
@@ -43,6 +43,25 @@ package Qpsmtpd::Apache; |
16 |
|
|
use Qpsmtpd::Constants; |
17 |
|
|
use base qw(Qpsmtpd::SMTP); |
18 |
|
|
|
19 |
|
|
+my %cdir_memo; |
20 |
|
|
+ |
21 |
|
|
+sub config_dir { |
22 |
|
|
+ my ($self, $config) = @_; |
23 |
|
|
+ if (exists $cdir_memo{$config}) { |
24 |
|
|
+ return $cdir_memo{$config}; |
25 |
|
|
+ } |
26 |
|
|
+ |
27 |
|
|
+ if (uc($ENV{QPSMTPD_CONFIG}) eq 'USE-VIRTUAL-DOMAINS') { |
28 |
|
|
+ my $cdir = $self->{conn}->base_server->dir_config("qpsmtpd.config_dir"); |
29 |
|
|
+ $cdir =~ /^(.*)$/; # detaint |
30 |
|
|
+ my $configdir = $1 if -e "$1/$config"; |
31 |
|
|
+ $cdir_memo{$config} = $configdir; |
32 |
|
|
+ } else { |
33 |
|
|
+ $cdir_memo{$config} = SUPER::config_dir(@_); |
34 |
|
|
+ } |
35 |
|
|
+ return $cdir_memo{$config}; |
36 |
|
|
+} |
37 |
|
|
+ |
38 |
|
|
sub start_connection { |
39 |
|
|
my $self = shift; |
40 |
|
|
my %opts = @_; |
41 |
|
|
@@ -183,6 +202,19 @@ Apache::Qpsmtpd - a mod_perl-2 connection handler for qpsmtpd |
42 |
|
|
PerlSetVar qpsmtpd.loglevel 4 |
43 |
|
|
</VirtualHost> |
44 |
|
|
|
45 |
|
|
+Using multiple instances of Qpsmtpd on the same server is also |
46 |
|
|
+possible by setting: |
47 |
|
|
+ |
48 |
|
|
+ $ENV{QPSMTPD_CONFIG} = "USE-VIRTUAL-DOMAINS"; |
49 |
|
|
+ |
50 |
|
|
+Then in the VirtualHost of each config define the configuration |
51 |
|
|
+directory: |
52 |
|
|
+ |
53 |
|
|
+ PerlSetVar qpsmtpd.config_dir /path/to/qpsmtpd/config |
54 |
|
|
+ |
55 |
|
|
+Several different configurations can be running on the same |
56 |
|
|
+server. |
57 |
|
|
+ |
58 |
|
|
=head1 DESCRIPTION |
59 |
|
|
|
60 |
|
|
This module implements a mod_perl/apache 2.0 connection handler |
61 |
|
|
@@ -208,6 +240,7 @@ connections, but could do with some enhancements specific to SMTP. |
62 |
|
|
Matt Sergeant, <matt@sergeant.org> |
63 |
|
|
|
64 |
|
|
Some credit goes to <mock@obscurity.org> for Apache::SMTP which gave |
65 |
|
|
-me the inspiration to do this. |
66 |
|
|
+me the inspiration to do this. <peter@boku.net> added the virtual |
67 |
|
|
+host support. |
68 |
|
|
|
69 |
|
|
=cut |
70 |
|
|
-- |
71 |
|
|
1.7.2.2 |
72 |
|
|
|