From e22945ccc8ac0730db0f5783ed98dcf0a4dd3ad3 Mon Sep 17 00:00:00 2001
From: Frederik Lindenaar <frederik@lindenaar.nl>
Date: Thu, 14 May 2015 11:31:55 +0200
Subject: [PATCH] Sanitized the modes / urls:   list - show contents of a domain (was view)   view - show a single entry (was status)

---
 dyndns.pl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dyndns.pl b/dyndns.pl
index 504608c..caad5aa 100755
--- a/dyndns.pl
+++ b/dyndns.pl
@@ -270,7 +270,7 @@ sub handle_expire($$$$$$) {
   }
 }
 
-sub handle_status($$$$$$) {
+sub handle_view($$$$$$) {
   my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
   my $title = "DynDNS Updater - $host";
   print $cgi->header(-status=>200),
@@ -294,7 +294,7 @@ sub handle_status($$$$$$) {
   print $cgi->end_html();
 }
 
-sub handle_view($$$$$$) {
+sub handle_list($$$$$$) {
   my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
   my $title = "DynDNS Updater - $dnsdomain";
 
@@ -346,7 +346,7 @@ foreach my $rrtype (@ReplaceRR) {
 
 ##############################
 # Determine what to do and fetch the input parameters
-my $mode = $cgi->path_info || $cgi->param('mode') || '/status';
+my $mode = $cgi->path_info || $cgi->param('mode') || 'view';
 $mode=~s/^\/([^\/]+)(\/(.*))?/$1/;
 my $host = $cgi->param('host') || $3;
 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
 ##############################
 # Dispatch the request to the correct handler
 my %handlers = (
-  status	=> \&handle_status,
+  view		=> \&handle_view,
   update	=> \&handle_update,
   delete	=> \&handle_update,
-  view		=> \&handle_view,
+  list		=> \&handle_list,
   expire	=> \&handle_expire,
 );
-if($host eq '' and $mode cmp 'view' and $mode cmp 'expire') {
+if($host eq '' and $mode cmp 'list' and $mode cmp 'expire') {
   print $cgi->header(-status=>400, -type=>'text/plain'),
 	  "ERROR - No host name to act on specified\n";
 } elsif(my $handler = $handlers{$mode}) {
--
libgit2 0.22.2