From: Stefan Schantl Date: Thu, 31 Jul 2014 19:45:38 +0000 (+0200) Subject: ddns.cgi: Check for valid FQDN before doing nslookup. X-Git-Tag: v2.15-core81~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f080b34bac4fbaa88d2b460ece53d460fff6ec5;p=people%2Fstevee%2Fipfire-2.x.git ddns.cgi: Check for valid FQDN before doing nslookup. We now check if the used hostname is a valid FQDN before doing the nslookup to determine if a DDNS host is up do date. --- diff --git a/html/cgi-bin/ddns.cgi b/html/cgi-bin/ddns.cgi index 3072a8b763..65e3bee395 100644 --- a/html/cgi-bin/ddns.cgi +++ b/html/cgi-bin/ddns.cgi @@ -507,17 +507,32 @@ END chomp(@current); my @temp = split(/\,/,$line); + # Handle hostname details. Only connect the values with a dott if both are available. + my $hostname=""; + + if (($temp[1]) && ($temp[2])) { + $hostname="$temp[1].$temp[2]"; + } else { + $hostname="$temp[1]"; + } + # Generate value for enable/disable checkbox. - my $sync = ""; + my $sync = ''; my $gif = ''; my $gdesc = ''; if ($temp[7] eq "on") { $gif = 'on.gif'; $gdesc = $Lang::tr{'click to disable'}; - $sync = (&General::DyndnsServiceSync ($ip,$temp[1], $temp[2]) ? "": "") ; + + # Check if the given hostname is a FQDN before doing a nslookup. + if (&General::validfqdn($hostname)) { + $sync = (&General::DyndnsServiceSync ($ip,$temp[1], $temp[2]) ? "": "") ; + } + $toggle_enabled = 'off'; } else { + $sync = ""; $gif = 'off.gif'; $gdesc = $Lang::tr{'click to enable'}; $toggle_enabled = 'on';