--- loncom/lonnet/perl/londns.pm 2013/09/02 14:40:18 1.3 +++ loncom/lonnet/perl/londns.pm 2017/11/30 14:33:35 1.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # A debugging harness. # -# $Id: londns.pm,v 1.3 2013/09/02 14:40:18 raeburn Exp $ +# $Id: londns.pm,v 1.4 2017/11/30 14:33:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,13 +36,16 @@ use Apache::lonnet; sub serve_file { my ($r,$file,$type)=@_; - open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/$file"); - my $file = join('',<$config>); - $r->content_type($type); - $r->send_http_header; - return OK if $r->header_only; - $r->print($file); - return OK; + if (open(my $config,"<","$Apache::lonnet::perlvar{'lonTabDir'}/$file")) { + my $contents = join('',<$config>); + $r->content_type($type); + $r->send_http_header; + return OK if $r->header_only; + $r->print($contents); + return OK; + } else { + return FORBIDDEN; + } } sub handler {