From deb3380d06663c7a98db031431f00c031dad1e09 Mon Sep 17 00:00:00 2001 From: Devin Carraway Date: Fri, 29 Jul 2005 08:05:42 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@529 958fd67b-6ff1-0310-b445-bb7760255be9 --- Changes | 4 ++++ lib/Qpsmtpd.pm | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Changes b/Changes index 4b5a02e..2f0e11d 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/lib/Qpsmtpd.pm b/lib/Qpsmtpd.pm index b5b7169..6fb2a45 100644 --- a/lib/Qpsmtpd.pm +++ b/lib/Qpsmtpd.pm @@ -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; }