Allow configuration of spool_dir permissions

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@964 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Jared Johnson 2008-12-31 21:44:59 +00:00 committed by Ask Bjørn Hansen
parent a248ed56ad
commit 9e7a4c8e3b
3 changed files with 13 additions and 11 deletions

View File

@ -59,6 +59,9 @@
(Jared Johnson)
http://groups.google.com/group/perl.qpsmtpd/browse_thread/thread/35e3a187d8e75cbe
New config option "spool_perms" to set permissions of spool_dir
(Jared Johnson)
0.43 - February 5, 2008
(This release was mostly done by Matt Sergeant and Hanno Hecker)

3
README
View File

@ -77,7 +77,8 @@ some other way.
The smtpd user needs write access to ~smtpd/qpsmtpd/tmp/ but should
not need to write anywhere else. This directory can be configured
with the "spool_dir" configuration.
with the "spool_dir" configuration and permissions can be set with
"spool_perms".
As per version 0.25 the distributed ./run script runs tcpserver with
the -R flag to disable identd lookups. Remove the -R flag if that's

View File

@ -529,18 +529,16 @@ sub spool_dir {
$Spool_dir =~ /^(.+)$/ or die "spool_dir not configured properly";
$Spool_dir = $1; # cleanse the taint
my $Spool_perms = $self->config('spool_perms') || '0700';
# Make sure the spool dir has appropriate rights
if (-e $Spool_dir) {
my $mode = (stat($Spool_dir))[2];
if (-d $Spool_dir) { # Make sure the spool dir has appropriate rights
$self->log(LOGWARN,
"Permissions on spool_dir $Spool_dir are not 0700")
if $mode & 07077;
"Permissions on spool_dir $Spool_dir are not $Spool_perms")
unless ((stat $Spool_dir)[2] & 07777) == oct($Spool_perms);
} else { # Or create it if it doesn't already exist
mkdir($Spool_dir,oct($Spool_perms))
or die "Could not create spool_dir $Spool_dir: $!";
}
# And finally, create it if it doesn't already exist
-d $Spool_dir or mkdir($Spool_dir, 0700)
or die "Could not create spool_dir $Spool_dir: $!";
}
return $Spool_dir;