Sanitized the modes / urls:
list - show contents of a domain (was view) view - show a single entry (was status)
This commit is contained in:
12
dyndns.pl
12
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}) {
|
||||
|
||||
Reference in New Issue
Block a user