Package: resource-agents
Followup-For: Bug #675913

Hi,

I'm hitting the same bug. It's present in the version in testing (1:3.9.2-5) and
in the version in unstable (1:3.9.3+git20121009-1).

I modified the initially attached patch as the offsets did not apply any more
for the current verion in testing and tested it. It seems to work correctly
although I haven't done intesive testing yet.

Zang - where does this patch come from and are you running it in production use?

I'm not in the position to dive into the code that deep to verify, that it
doesn't have any side effects.

As the issue still persists in version 1:3.9.3+git20121009-1 it looks like that
upstream hasn't yet fixed this issue.

It would be nice to have a working HA-stack for wheezy :-) .

warm regards and thanks for the good work,


Tom



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (500, 
'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- resource-agents-3.9.2.orig/ldirectord/ldirectord.in
+++ resource-agents-3.9.2/ldirectord/ldirectord.in
@@ -828,7 +828,8 @@ use Pod::Usage;
 #use English;
 #use Time::HiRes qw( gettimeofday tv_interval );
 use Socket;
-use Socket6;
+use Socket::GetAddrInfo qw( getaddrinfo getnameinfo NI_NUMERICHOST NI_NUMERICSERV NI_NAMEREQD );
+#use Socket6;
 use Sys::Hostname;
 use POSIX qw(setsid :sys_wait_h);
 use Sys::Syslog qw(:DEFAULT setlogsock);
@@ -5039,17 +5040,21 @@ sub ld_gethostbyname
        if ($name =~ /\[(.*)\]/) {
                $name = $1;
        }
-       my @host = getaddrinfo($name, 0, $af);
-       if (!defined($host[3])) {
-               return undef;
-       }
-       my @ret = getnameinfo($host[3], NI_NUMERICHOST | NI_NUMERICSERV);
-       if ($host[0] == AF_INET6) {
-               return "[$ret[0]]";
-       }
-       else {
-               return $ret[0];
-       }
+  my %hints = ( family => $af );
+  my ( $err, @res ) = getaddrinfo($name, 0, \%hints);
+  return undef if ($err);
+  while( my $ai = shift @res ) {
+    my ( $err, $hostname, $servicename ) = getnameinfo( $ai->{addr} );
+    if (!$err) {
+      if ($ai->{family} == AF_INET6) {
+        return "[$hostname]";
+      }
+      else {
+        return $hostname;
+      }
+    }
+  }
+  return undef;
 }
 
 # ld_gethostbyaddr
@@ -5064,13 +5069,12 @@ sub ld_gethostbyaddr
        my ($ip)=(@_);
 
        $ip = &ld_strip_brackets($ip);
-       my @host = getaddrinfo($ip,0);
-       if (!defined($host[3])) {
-               return undef;
+  my ( $err, @res ) = getaddrinfo($ip,0);
+  return undef if ($err);
+  while( my $ai = shift @res ) {
+    my ( $err, $host, $service ) = getnameinfo($ai->{addr}, NI_NAMEREQD);
+    return $host unless($err);
        }
-       my @ret = getnameinfo($host[3], NI_NAMEREQD);
-       return undef unless(scalar(@ret) == 2);
-       return $ret[0];
 }
 
 # ld_getservbyname

Reply via email to