Hi Vim,

sorry for slacking on ddclient for such a long time.

This morning, Eloy brought a ddclient bug to my attention and
we both suspected it might be caused by my multiple IP patch.
Closer investigation revealed that my patch didn't cause the bug
but indeed uncovered it.

The problem is that in read_cache(), the local HASH reference %$config
is defined, but in the final for loop, the global %config is written to
instead.  Consequently, cache data ends up being interpreted as
configuration data, which is clearly wrong.  One consequence is
that once an IP is cached, you can't change it from the command
line any more.  Eloy drew my attention to the fact that this has
been reported at least twice:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=527848
  http://sourceforge.net/projects/ddclient/forums/forum/399428/topic/3158864

Your comment ("Since it's not allowed to query the dyndns nameservers
intense and since the local dns isn't always reliable, ddclient
completely depends on its cache file.") in reply to the latter report
submitted by fafaforza appears to miss the point.  Indeed, it would be
abuse to set and reset the same address over and over again, but here we
are talking about CHANGING the address manually, which is always
allowed.  Even with the patch below, when you set the same IP twice from
the command line, it is of course only set once and then cached, the
first command line call now correctly returning

  good: IP address set to X.Y.Z

and the second command line call still correctly returning

  skipped: IP address was already set to X.Y.Z

Just for the record, the patch proposed by
  Stefan Luethje <stefan+l...@luethje.ch>
is obviously wrong.

While chasing the bug, i ran into a similar problem (confusion of
hashes with references to hashes) in init_config().  The consequence
of that one is that the -options=... command line option does not
work.  Both bugs exist since SVN version 1.


Tested on Astaro Security Gateway 7.8 (based on sles11) with
ddclient-3.8.0 using 

 # ddclient -debug -verbose -daemon=0 -syslog \
   -options='host=***.dyndns.org,use=ip,ip=***'

and the following configuration file:

  daemon=300
  ssl=yes
  timeout=120
  mail=ischwa...@astaro.com
  mail-failure=ischwa...@astaro.com
  cache=/var/cache/ddclient/ddclient.cache
  pid=/opt/tmpfs/ddclient.pid
  syslog=yes
  use=ip,   \
  server=members.dyndns.org,   \
  protocol=dyndns2,   \
  login=***,   \
  password='***'   \
  ***.dyndns.org

Enjoy,
  Ingo


--- ddclient.orig       Tue Jan 27 20:14:02 2009
+++ ddclient    Thu Nov 26 15:49:48 2009
@@ -841,9 +841,9 @@ sub read_cache {
        %opt   = %saved;
 
        foreach my $h (keys %cache) {
-           if (exists $config{$h}) {
+           if (exists $config->{$h}) {
                foreach (qw(atime mtime wtime ip status)) {
-                   $config{$h}{$_} = $cache{$h}{$_} if exists $cache{$h}{$_};
+                   $config->{$h}{$_} = $cache{$h}{$_} if exists $cache{$h}{$_};
                }
            }
        }
@@ -1093,7 +1093,7 @@ sub init_config {
        ## merge options into host definitions or globals
        if (@hosts) {
            foreach my $h (@hosts) {
-               $config{$h} = %{ merge(\%options, $config{$h}) };
+               $config{$h} = merge(\%options, $config{$h});
            }
            $opt{'host'} = join(',', @hosts);
        } else {



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to