Skip to content

Commit

Permalink
Merge 014a605 into 573f7c5
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredj committed Feb 24, 2015
2 parents 573f7c5 + 014a605 commit 416b82c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Qpsmtpd/DB/File/DBM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ sub validate_dir {
my ( $self, $d ) = @_;
return 0 if ! $d;
return 0 if ! -d $d;
return 0 if ! -w $d;
return 1;
}

Expand Down
7 changes: 7 additions & 0 deletions t/qpsmtpd-db-file-dbm.t
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ sub __validate_dir {
'validate_dir(): false for non-existent directory' );
is( $db->validate_dir('t/tmp'), 1,
'validate_dir(): true for real directory' );
mkdir 't/tmp/wtest', 0555;
is( $db->validate_dir('t/tmp/wtest'), 0,
'validate_dir(): false for non-writeable directory' );
chmod 0777, 't/tmp/wtest';
is( $db->validate_dir('t/tmp/wtest'), 1,
'validate_dir(): true for writeable directory' );
rmdir 't/tmp/wtest';
}

sub __dir {
Expand Down

0 comments on commit 416b82c

Please sign in to comment.