Public bug reported:

Binary package hint: ddclient

When ddclient is configured to obtain an IP address from a Cisco router,
it generates an invalid query URL.  Using this configuration:

    use=cisco
    fw=192.168.77.1:8080
    if=d0
    fw-login=ddclient
    fw-password=password

results in the query URL:

     http:///level/1/exec/show/ip/interface/brief/d0/CR

Rather than use the 'fw' value as the hostname, it ignores this field
and uses a blank hostname.  The cause is in get_ip():

    sub get_ip {
        my $use = lc shift;
        my ($ip, $arg, $reply, $url, $skip) = (undef, opt($use), '');
        $arg = '' unless $arg;

$use is "cisco", and opt('cisco') is undefined because "cisco" is not a
valid configuration option.  Later it uses $arg to build the query URL:

        $url   =
"http://${arg}/level/1/exec/show/ip/interface/brief/${queryif}/CR";;

What it should do is use opt('fw') as the hostname, which is what's
implied in README.cisco.

The same bug exists in the latest ddclient, v3.7.0.

This patch fixes the problem, and updates the ddclient config example in
README.cisco to match the Cisco config example:

--- README.cisco.orig        2002-01-04 10:56:34.000000000 +1100
+++ README.cisco      2006-06-20 09:04:10.000000000 +1000
@@ -1,13 +1,13 @@
 Method 1 ------------------------------------------------------

 The following config will allow the Linux machine (10.1.1.2) to read
-the IP address from the DHCP interface on the Cisco router (eth0) as
-user ddclient.  Since ddclient is configured with a priv level of 1 it
-cannot do anything except look at the routers stats, ip addresses,
-etc.  This should be pretty harmless even if ddclients password were
-to be discovered.
+the IP address from the DHCP interface (eth0) on the Cisco router
+(10.1.1.1) as user ddclient.  Since ddclient is configured with a
+priv level of 1 it cannot do anything except look at the routers
+stats, ip addresses, etc.  This should be pretty harmless even if
+ddclient's password were to be discovered.

-This has been tested with Cisco IOS 12.1(5)T5 running on a Cisco 2621
+This has been tested with Cisco IOS 12.3(5c) running on a Cisco 827
 router.

 Cisco Router Config (Assuming eth0 is DHCP interface)
@@ -22,7 +22,7 @@

 DDClient Config
 ---------------------------------------------------
-use=cisco, fw=10.1.1.1, if=eth0, fw-login=ddclient, fw-password=password
+use=cisco, fw=10.1.1.1:1021, if=eth0, fw-login=ddclient, fw-password=password


 Method 2 ------------------------------------------------------
--- ddclient.orig       2006-06-20 08:37:50.000000000 +1000
+++ ddclient    2006-06-20 08:37:13.000000000 +1000
@@ -1508,6 +1508,7 @@
        # Protect special HTML characters (like '?')
        $queryif =~ s/([\?&= ])/sprintf("%%%02x",ord($1))/ge;

+       $arg = opt('fw');
        $url   = 
"http://${arg}/level/1/exec/show/ip/interface/brief/${queryif}/CR";;
        $reply = geturl('', $url, opt('fw-login'), opt('fw-password')) || '';
        $arg   = $url;

** Affects: ddclient (Ubuntu)
     Importance: Untriaged
         Status: Unconfirmed

-- 
ddclient generates invalid query url for Cisco routers
https://launchpad.net/bugs/50401

--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to