Skip to content

Commit

Permalink
Item11194: Checker to list unprotected scripts
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@13165 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Nov 21, 2011
1 parent bcecefb commit 0e1c660
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions core/lib/Foswiki/Configure/Checkers/AuthScripts.pm
Expand Up @@ -45,9 +45,38 @@ EOF
);
}
}
my $e2 = _listOpenScripts( $this, $this->getCfg("{ScriptDir}") );
$msg .= $this->NOTE(
'<b>Note:</b>The Following scripts are open to unauthenticated users:<br /> <code>'
. $e2
. '</code>' )
if $e2;
return $msg;
}

sub _listOpenScripts {
my ( $this, $dir ) = @_;
my $unauth = '';
unless ( opendir( D, $dir ) ) {
return $this->ERROR(<<HERE);
Cannot open '$dir' for read ($!) - check it exists, and that permissions are correct.
HERE
}
foreach
my $script ( sort grep { -f "$dir/$_" && /^\w+(\.\w+)?$/ } readdir D )
{

# Verify that scripts are executable
if ( $script !~ /\.cfg$/
&& $script !~ /^configure/
&& $Foswiki::cfg{AuthScripts} !~ m/\b$script\b/ )
{
$unauth .= $script . ' ';
}
}
closedir(D);
return $unauth;
}
1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand Down

0 comments on commit 0e1c660

Please sign in to comment.