Add perms test to Qpsmtpd::DB::File::DBM::dir()

This commit is contained in:
Jared Johnson 2015-02-24 11:51:18 -06:00
parent 19650063e6
commit 6b13e24221
2 changed files with 8 additions and 0 deletions

View File

@ -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;
}

View File

@ -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 {