[svn:qpsmtpd] rev 529 - in branches/0.31: . lib

[email protected] 29 Jul 2005 08:05:43 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: aqua
Date: Fri Jul 29 01:05:42 2005
New Revision: 529

Modified:
   branches/0.31/Changes
   branches/0.31/lib/Qpsmtpd.pm
Log:
Apply slight variation on patch from Peter Holzer to allow specification of
an explicit $QPSMTPD_CONFIG variable to specify where the config lives,
overriding $QMAIL/control and /var/qmail/control if set.  The usual "last
location with the file wins" rule still applies.


Modified: branches/0.31/Changes
==============================================================================
--- branches/0.31/Changes	(original)
+++ branches/0.31/Changes	Fri Jul 29 01:05:42 2005
@@ -17,6 +17,10 @@
   The unrecognized_command hook now uses DENY_DISCONNECT return
   for disconnecting the user.
 
+  If the environment variable $QPSMTPD_CONFIG is set, qpsmtpd will look
+  for its config files in the directory given therein, in addition to (and
+  in preference to) other locations. (Peter J. Holzer)
+
   Updated documentation
 
 

Modified: branches/0.31/lib/Qpsmtpd.pm
==============================================================================
--- branches/0.31/lib/Qpsmtpd.pm	(original)
+++ branches/0.31/lib/Qpsmtpd.pm	Fri Jul 29 01:05:42 2005
@@ -114,6 +114,10 @@ sub config_dir {
   my $configdir = ($ENV{QMAIL} || '/var/qmail') . '/control';
   my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
   $configdir = "$name/config" if (-e "$name/config/$config");
+  if (exists $ENV{QPSMTPD_CONFIG}) {
+    $ENV{QPSMTPD_CONFIG} =~ /^(.*)$/; # detaint
+    $configdir = $1 if -e "$1/$config";
+  }
   return $configdir;
 }