Skip to content

Commit

Permalink
Item9074: Modify checkers to bypass RCS permission checks on Windows.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@7802 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Jun 15, 2010
1 parent b5fb01b commit 48feffd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
27 changes: 21 additions & 6 deletions core/lib/Foswiki/Configure/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ sub checkTreePerms {
# Okay to increment count once filtered files are ignored.
$this->{filecount}++;

my $errs = '';
my $errs = '';
my $permErrs = '';

return $path . ' cannot be found' . CGI::br()
unless ( -e $path || -l $path );
Expand All @@ -77,10 +78,23 @@ sub checkTreePerms {
unless ( $mode == $Foswiki::cfg{RCS}{dirPermission} ) {
my $omode = sprintf( '%04o', $mode );
my $operm = sprintf( '%04o', $Foswiki::cfg{RCS}{dirPermission} );
$errs .= " directory permission mismatch $omode should be $operm";
$permErrs .=
"$path - directory permission mismatch $omode should be $operm"
. CGI::br();
}
}

# Enable this once we work out consistent permissions between RCS settings, Manifest, and BuildContrib
# - And probably need a fix permissions button.
# elsif ( $perms =~ /f/ && -f $path ) {
# my $mode = ( stat($path) )[2] & 07777;
# unless ( $mode == $Foswiki::cfg{RCS}{filePermission} ) {
# my $omode = sprintf( '%04o', $mode );
# my $operm = sprintf( '%04o', $Foswiki::cfg{RCS}{filePermission} );
# $errs .= " file permission mismatch $omode should be $operm";
# }
# }

if ( $perms =~ /r/ && !-r $path ) {
$errs .= ' not readable';
}
Expand All @@ -93,12 +107,13 @@ sub checkTreePerms {
$errs .= ' not executable';
}

return $path . $errs . CGI::br() if $errs;
return $permErrs . $path . $errs . CGI::br() if $errs;

return '' unless -d $path;
return $permErrs unless -d $path;

return
$path
$permErrs
. $path
. ' directory is missing \'x\' permission - not readable'
. CGI::br()
if ( -d $path && !-x $path );
Expand All @@ -114,7 +129,7 @@ sub checkTreePerms {
}
closedir($Dfh);

return $errs;
return $permErrs . $errs;
}

sub checkCanCreateFile {
Expand Down
9 changes: 8 additions & 1 deletion core/lib/Foswiki/Configure/Checkers/DataDir.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ sub check {
$this->{filecount} = 0;
my $e = $this->guessMajorDir( 'DataDir', 'data' );

# Don't check directories against {RCS} permissions on Windows
my $dirchk =
( $Foswiki::cfg{OS} eq 'WINDOWS' )
? ''
: 'd';

# Check readable, writable and directories match {RCS}{dirPermissions}
my $e2 = $this->checkTreePerms( $Foswiki::cfg{DataDir}, 'rwd', qr/,v$/ );
my $e2 =
$this->checkTreePerms( $Foswiki::cfg{DataDir}, 'rw' . $dirchk, qr/,v$/ );
$e .= $this->warnAboutWindowsBackSlashes( $Foswiki::cfg{DataDir} );
$e .=
( $this->{filecount} >= $Foswiki::cfg{PathCheckLimit} )
Expand Down
9 changes: 8 additions & 1 deletion core/lib/Foswiki/Configure/Checkers/PubDir.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ sub check {
my $e = $this->guessMajorDir( 'PubDir', 'pub' );
$e .= $this->warnAboutWindowsBackSlashes( $Foswiki::cfg{PubDir} );

# Don't check directories against {RCS} permissions on Windows
my $dirchk =
( $Foswiki::cfg{OS} eq 'WINDOWS' )
? ''
: 'd';

# rwd - Readable, Writable, and directory must match {RCS}{dirPermission}
my $e2 = $this->checkTreePerms( $Foswiki::cfg{PubDir}, 'rwd', qr/,v$/ );
my $e2 =
$this->checkTreePerms( $Foswiki::cfg{PubDir}, 'rw' . $dirchk, qr/,v$/ );
$e .= $this->WARN($e2) if $e2;

$e .=
Expand Down

0 comments on commit 48feffd

Please sign in to comment.