Commit e22945ccc8ac0730db0f5783ed98dcf0a4dd3ad3

Authored by Frederik Lindenaar
1 parent 89b504e6

Sanitized the modes / urls:

list - show contents of a domain (was view)
  view - show a single entry (was status)
Showing 1 changed file with 6 additions and 6 deletions
dyndns.pl
@@ -270,7 +270,7 @@ sub handle_expire($$$$$$) { @@ -270,7 +270,7 @@ sub handle_expire($$$$$$) {
270 } 270 }
271 } 271 }
272 272
273 -sub handle_status($$$$$$) { 273 +sub handle_view($$$$$$) {
274 my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_; 274 my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
275 my $title = "DynDNS Updater - $host"; 275 my $title = "DynDNS Updater - $host";
276 print $cgi->header(-status=>200), 276 print $cgi->header(-status=>200),
@@ -294,7 +294,7 @@ sub handle_status($$$$$$) { @@ -294,7 +294,7 @@ sub handle_status($$$$$$) {
294 print $cgi->end_html(); 294 print $cgi->end_html();
295 } 295 }
296 296
297 -sub handle_view($$$$$$) { 297 +sub handle_list($$$$$$) {
298 my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_; 298 my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
299 my $title = "DynDNS Updater - $dnsdomain"; 299 my $title = "DynDNS Updater - $dnsdomain";
300 300
@@ -346,7 +346,7 @@ foreach my $rrtype (@ReplaceRR) { @@ -346,7 +346,7 @@ foreach my $rrtype (@ReplaceRR) {
346 346
347 ############################## 347 ##############################
348 # Determine what to do and fetch the input parameters 348 # Determine what to do and fetch the input parameters
349 -my $mode = $cgi->path_info || $cgi->param('mode') || '/status'; 349 +my $mode = $cgi->path_info || $cgi->param('mode') || 'view';
350 $mode=~s/^\/([^\/]+)(\/(.*))?/$1/; 350 $mode=~s/^\/([^\/]+)(\/(.*))?/$1/;
351 my $host = $cgi->param('host') || $3; 351 my $host = $cgi->param('host') || $3;
352 my $debug = ($AllowDebugKey eq 'off') ? 0 : ($AllowDebugKey eq ($cgi->param('debug') || '')); 352 my $debug = ($AllowDebugKey eq 'off') ? 0 : ($AllowDebugKey eq ($cgi->param('debug') || ''));
@@ -355,13 +355,13 @@ my $debug = ($AllowDebugKey eq 'off') ? 0 : ($AllowDebugKey eq ($cgi->param('deb @@ -355,13 +355,13 @@ my $debug = ($AllowDebugKey eq 'off') ? 0 : ($AllowDebugKey eq ($cgi->param('deb
355 ############################## 355 ##############################
356 # Dispatch the request to the correct handler 356 # Dispatch the request to the correct handler
357 my %handlers = ( 357 my %handlers = (
358 - status => \&handle_status, 358 + view => \&handle_view,
359 update => \&handle_update, 359 update => \&handle_update,
360 delete => \&handle_update, 360 delete => \&handle_update,
361 - view => \&handle_view, 361 + list => \&handle_list,
362 expire => \&handle_expire, 362 expire => \&handle_expire,
363 ); 363 );
364 -if($host eq '' and $mode cmp 'view' and $mode cmp 'expire') { 364 +if($host eq '' and $mode cmp 'list' and $mode cmp 'expire') {
365 print $cgi->header(-status=>400, -type=>'text/plain'), 365 print $cgi->header(-status=>400, -type=>'text/plain'),
366 "ERROR - No host name to act on specified\n"; 366 "ERROR - No host name to act on specified\n";
367 } elsif(my $handler = $handlers{$mode}) { 367 } elsif(my $handler = $handlers{$mode}) {