Changeset 173 for trunk/dns.cgi


Ignore:
Timestamp:
11/30/11 15:43:31 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Security audit (see #30)

  • remove a stale global
  • catch and handle bad page parameter
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r169 r173  
    102102my $logingroup = ($session->param('logingroup') ? $session->param('logingroup') : 1);
    103103my $curgroup = ($session->param('curgroup') ? $session->param('curgroup') : $logingroup);
    104 my $group = ($webvar{group} ? $webvar{group} : 1);
    105104
    106105# per-page startwith, filter, searchsubs
     
    182181push @viewablegroups, $logingroup;
    183182
    184 my $page = HTML::Template->new(filename => "$templatedir/$webvar{page}.tmpl");
     183my $page;
     184eval {
     185  $page = HTML::Template->new(filename => "$templatedir/$webvar{page}.tmpl");
     186};
     187if ($@) {
     188  warn "Bad page $webvar{page} requested";
     189  $page = HTML::Template->new(filename => "$templatedir/badpage.tmpl");
     190  $page->param(badpage => $q->escapeHTML($webvar{page}));
     191  $webvar{page} = 'badpage';
     192}
    185193
    186194# handle login redirect
     
    14071415
    14081416##common bits
    1409 if ($webvar{page} ne 'login') {
     1417if ($webvar{page} ne 'login' && $webvar{page} ne 'badpage') {
    14101418  $page->param(username => $session->param("username"));
    14111419
Note: See TracChangeset for help on using the changeset viewer.