diff --git a/data/cgi/Makefile b/data/cgi/Makefile index 46c2abe605..165cf49740 100644 --- a/data/cgi/Makefile +++ b/data/cgi/Makefile @@ -1,10 +1,10 @@ -# $Id: Makefile,v 1.9 1997-10-11 15:58:11 wosch Exp $ +# $Id: Makefile,v 1.10 1998-02-26 23:49:47 jfieber Exp $ DATA= ftp.mirrors CGI= ftp.cgi gallery.cgi mirror.cgi cgi-lib.pl cgi-style.pl CGI+= search.cgi cvsweb.cgi query-pr.cgi query-pr-summary.cgi CGI+= dosendpr.cgi freebsd.def html.pl reg.cgi missing_handler.cgi -CGI+= ports.cgi pds.cgi man.cgi url.cgi +CGI+= ports.cgi pds.cgi man.cgi url.cgi getmsg.cgi .SUFFIXES: .C .cgi diff --git a/data/cgi/getmsg.cgi b/data/cgi/getmsg.cgi new file mode 100755 index 0000000000..d1d377c80e --- /dev/null +++ b/data/cgi/getmsg.cgi @@ -0,0 +1,92 @@ +#!/usr/local/bin/perl -T +# $Id: getmsg.cgi,v 1.1 1998-02-26 23:49:52 jfieber Exp $ + +require "./cgi-lib.pl"; +require "./cgi-style.pl"; + +my $messageroot = "/usr/local/www/db/text/"; +&ReadParse(*formdata); +&Fetch($formdata{'fetch'}); + +exit 0; + +sub Fetch +{ + local ($docid) = @_; + local ($start, $end, $file) = split(/ /, $docid); + print &short_html_header("FreeBSD Mail Archives"); + + # + # Check to ensure that (a) the specified file starts + # with an approved pathname and (b) that it contains no + # relative components (eg ..). This is so that arbitrary + # files cannot be accessed. + # + + $file =~ s/\.\.//g; + $file =~ s|/+|/|; + + if ($file =~ /^$messageroot/ && open(DATA, $file)) { + seek DATA, $start, 0; + read DATA, $message, $end - $start; + close(DATA); + print &MessageToHTML($message); + } else { + print "
The specified message cannot be accessed.
\n"; + } + + print &html_footer; + print "