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 ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
|
||||||
my $title = "DynDNS Updater - $host";
|
my $title = "DynDNS Updater - $host";
|
||||||
print $cgi->header(-status=>200),
|
print $cgi->header(-status=>200),
|
||||||
@@ -294,7 +294,7 @@ sub handle_status($$$$$$) {
|
|||||||
print $cgi->end_html();
|
print $cgi->end_html();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub handle_view($$$$$$) {
|
sub handle_list($$$$$$) {
|
||||||
my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
|
my ($cgi, $mode, $host, $dnshost, $dnsdomain, $debug) = @_;
|
||||||
my $title = "DynDNS Updater - $dnsdomain";
|
my $title = "DynDNS Updater - $dnsdomain";
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ foreach my $rrtype (@ReplaceRR) {
|
|||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Determine what to do and fetch the input parameters
|
# 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/;
|
$mode=~s/^\/([^\/]+)(\/(.*))?/$1/;
|
||||||
my $host = $cgi->param('host') || $3;
|
my $host = $cgi->param('host') || $3;
|
||||||
my $debug = ($AllowDebugKey eq 'off') ? 0 : ($AllowDebugKey eq ($cgi->param('debug') || ''));
|
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
|
# Dispatch the request to the correct handler
|
||||||
my %handlers = (
|
my %handlers = (
|
||||||
status => \&handle_status,
|
view => \&handle_view,
|
||||||
update => \&handle_update,
|
update => \&handle_update,
|
||||||
delete => \&handle_update,
|
delete => \&handle_update,
|
||||||
view => \&handle_view,
|
list => \&handle_list,
|
||||||
expire => \&handle_expire,
|
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'),
|
print $cgi->header(-status=>400, -type=>'text/plain'),
|
||||||
"ERROR - No host name to act on specified\n";
|
"ERROR - No host name to act on specified\n";
|
||||||
} elsif(my $handler = $handlers{$mode}) {
|
} elsif(my $handler = $handlers{$mode}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user