Changeset 173 for trunk


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
Location:
trunk
Files:
1 added
2 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
  • trunk/templates/dns.css

    r166 r173  
    185185        padding: 5px;
    186186        width: 70%;
     187        margin: 1% auto;
    187188}
    188189.right {
     
    238239#soadetail {
    239240        text-align: left;
     241}
     242#badpage {
     243        margin: 5% auto;
     244        border: solid 2px #FFFF00;
     245        color: #333300;
     246        background-color: #e0e0e0;
     247        text-align: center;
     248        padding: 5px;
     249        width: 70%;
    240250}
    241251/* somewhat generic/reusable */
Note: See TracChangeset for help on using the changeset viewer.