]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/ddns.cgi
Merge remote-tracking branch 'mfischer/slang' into next
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / ddns.cgi
index 3de8886dd11ccf7e09ca25834ec6e889e9c5676c..73a41d903fae41b47024f38ce18237adca36556c 100644 (file)
@@ -44,10 +44,8 @@ my $settingsfile = "${General::swroot}/ddns/settings";
 # Config file to store the configured ddns providers.
 my $datafile = "${General::swroot}/ddns/config";
 
-# Dynamic ddns programm call.
-my @ddnsprog = ("/usr/bin/ddns", "--config",
-               "/var/ipfire/ddns/ddns.conf",
-               "update-all");
+# Call the ddnsctrl helper binary to perform the update.
+my @ddnsprog = ("/usr/local/bin/ddnsctrl", "update-all");
 
 my %settings=();
 my $errormessage = '';
@@ -293,8 +291,17 @@ if ($settings{'ACTION'} eq $Lang::tr{'edit'}) {
                        # Splitt lines (splitting element is a single ",") and save values into temp array.
                        @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]";
+                       }
+
                        $settings{'SERVICE'} = $temp[0];
-                       $settings{'HOSTNAME'} = "$temp[1].$temp[2]";
+                       $settings{'HOSTNAME'} = $hostname;
                        $settings{'PROXY'} = $temp[3];
                        $settings{'WILDCARDS'} = $temp[4];
                        $settings{'LOGIN'} = $temp[5];
@@ -531,11 +538,20 @@ END
                        $col="bgcolor='$color{'color22'}'";
                }
 
+               # 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]";
+               }
+
                # The following HTML Code still is part of the loop.
                print <<END;
 <tr>
        <td align='center' $col><a href='http://$temp[0]'>$temp[0]</a></td>
-       <td align='center' $col>$sync$temp[1].$sync$temp[2]</td>
+       <td align='center' $col>$sync$hostname</td>
 
        <td align='center' $col><form method='post' action='$ENV{'SCRIPT_NAME'}'>
                <input type='hidden' name='ID' value='$id'>
@@ -637,13 +653,20 @@ sub GenerateDDNSConfigFile {
                # Skip disabled entries.
                next unless ($enabled eq "on");
 
-               print FILE "[$hostname.$domain]\n";
+               # Handle hostname details. Only connect the values with a dott if both are available.
+               if (($hostname) && ($domain)) {
+                       print FILE "[$hostname.$domain]\n";
+               } else {
+                       print FILE "[$hostname]\n";
+               }
+
                print FILE "provider = $provider\n";
 
                my $use_token = 0;
 
                # Handle token based auth for various providers.
-               if ($provider ~~ ["dns.lightningwirelabs.com", "entrydns.net", "regfish.com"] && $username eq "token") {
+               if ($provider ~~ ["dns.lightningwirelabs.com", "entrydns.net", "regfish.com",
+                                 "spdns.de", "zzzz.io"] && $username eq "token") {
                        $use_token = 1;
 
                # Handle token auth for freedns.afraid.org and regfish.com.
@@ -675,11 +698,6 @@ sub GenerateDDNSConfigFile {
                        print FILE "password = $password\n";
                }
 
-               # These providers need to be set to only use IPv4.
-               if ($provider ~~ ["freedns.afraid.org", "nsupdate.info", "opendns.com", "variomedia.de", "zoneedit.com"]) {
-                       print FILE "proto = ipv4\n";
-               }
-
                print FILE "\n";
        }