Skip to content

Commit

Permalink
Item13464: Don't double count checker errors
Browse files Browse the repository at this point in the history
And also add some markup to the messages, so that they don't run together, and are readable.
  • Loading branch information
gac410 committed Jun 20, 2015
1 parent 0e64729 commit 37eb973
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 7 additions & 5 deletions core/lib/Foswiki/Configure/Checkers/PATH.pm
Expand Up @@ -100,10 +100,10 @@ sub validate_permissions {
my $report =
Foswiki::Configure::FileUtil::checkTreePerms( $path, $perms,
filter => $filter );
$fileCount += $report->{fileCount};
$fileErrors += $report->{fileErrors};
$excessPerms += $report->{excessPerms};
$missingFile += $report->{missingFile};
$fileCount = $report->{fileCount};
$fileErrors = $report->{fileErrors};
$excessPerms = $report->{excessPerms};
$missingFile = $report->{missingFile};
push( @messages, @{ $report->{messages} } );

my $dperm = sprintf( '%04o', $Foswiki::cfg{Store}{dirPermission} );
Expand Down Expand Up @@ -138,7 +138,9 @@ PREFS
$excessPerms or more directories appear to have more access permission than requested in the Store configuration. Excess permissions might allow other users on the web server to have undesired access to the files. Verify that the Store expert settings of {Store}{filePermission} ($fperm} and {Store}{dirPermission}) ($dperm}) are set correctly for your environment and correct the file permissions listed below. (Files were not checked for excessive permissions.)
PERMS
}
$reporter->NOTE("Finished checking $fileCount files");
$reporter->NOTE(
"Finished checking $fileCount files, Permission: $perms Filter: $filter\n"
);
}
}
return;
Expand Down
12 changes: 6 additions & 6 deletions core/lib/Foswiki/Configure/FileUtil.pm
Expand Up @@ -343,7 +343,7 @@ sub checkTreePerms {
if ( $report{excessPerms}++ < $options{maxExcessPerms} ) {
push(
@{ $report{messages} },
"$path - directory permission $omode differs from requested $operm - check directory for possible excess permissions\n"
" * $path - directory permission $omode differs from requested $operm - check directory for possible excess permissions"
);
}
}
Expand All @@ -353,7 +353,7 @@ sub checkTreePerms {
if ( $report{fileErrors}++ < $options{maxFileErrors} ) {
push(
@{ $report{messages} },
"$path - directory permission $omode differs from requested $operm - check directory for possible insufficient permissions\n"
" * $path - directory permission $omode differs from requested $operm - check directory for possible insufficient permissions"
);
}
}
Expand All @@ -375,7 +375,7 @@ sub checkTreePerms {
if ( $report{excessPerms}++ < $options{maxExcessPerms} ) {
push(
@{ $report{messages} },
"$path - file permission $omode differs from requested $operm - check file for possible excess permissions\n"
" * $path - file permission $omode differs from requested $operm - check file for possible excess permissions."
);
}
}
Expand All @@ -385,7 +385,7 @@ sub checkTreePerms {
if ( $report{fileErrors}++ < $options{maxFileErrors} ) {
push(
@{ $report{messages} },
"$path - file permission $omode differs from requested $operm - check file for possible insufficient permissions"
" * $path - file permission $omode differs from requested $operm - check file for possible insufficient permissions."
);
}
}
Expand All @@ -400,7 +400,7 @@ sub checkTreePerms {
unless ( $report{missingFile}++ > $options{maxMissingFile} ) {
push(
@{ $report{messages} },
"$path missing $Foswiki::cfg{WebPrefsTopicName} topic"
" * $path missing $Foswiki::cfg{WebPrefsTopicName} topic."
);
}
}
Expand All @@ -415,7 +415,7 @@ sub checkTreePerms {
return \%report unless -d $path;

if ( -d $path && !-x $path ) {
unshift( @{ $report{messages} }, "$path missing -x permission" );
unshift( @{ $report{messages} }, " * $path missing -x permission" );
return \%report;
}

Expand Down

0 comments on commit 37eb973

Please sign in to comment.