Author: robert Date: Wed Dec 31 13:44:59 2008 New Revision: 964 Modified: trunk/Changes trunk/README trunk/lib/Qpsmtpd.pm
Log: Allow configuration of spool_dir permissions Author: Jared Johnson <[email protected]> Modified: trunk/Changes ============================================================================== --- trunk/Changes (original) +++ trunk/Changes Wed Dec 31 13:44:59 2008 @@ -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) Modified: trunk/README ============================================================================== --- trunk/README (original) +++ trunk/README Wed Dec 31 13:44:59 2008 @@ -77,7 +77,8 @@ 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 Modified: trunk/lib/Qpsmtpd.pm ============================================================================== --- trunk/lib/Qpsmtpd.pm (original) +++ trunk/lib/Qpsmtpd.pm Wed Dec 31 13:44:59 2008 @@ -529,18 +529,16 @@ $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]; - $self->log(LOGWARN, - "Permissions on spool_dir $Spool_dir are not 0700") - if $mode & 07077; + if (-d $Spool_dir) { # Make sure the spool dir has appropriate rights + $self->log(LOGWARN, + "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;
