The xCAT_plugin::ddns function add_or_delete_records() doesn't
correctly check for errors after sending updates to the DNS server.

This causes updates to silently fail. I found the following on SL6
with perl-Net-DNS-0.65-4.el6.x86_64, but I suspect it is true for all
Net::DNS releases.

In add_or_delete_records() the DDNS updates are sent and the response
checked as follows:
  my $reply = $resolver->send($update);
  if ($reply && ($reply->header->rcode ne 'NOERROR')) {
    xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone,
error was ".$reply->header->rcode], $callback);
  }

$resolver holds an instance of the Net::DNS::Resolver class. The
documentation for the send() method of Net::DNS::Resolver states that
on an error, the return value is undef, but this is not tested for in
the above code.

I suggest changing the code to something like:
  my $reply = $resolver->send($update);
  if (! defined $reply) {
    xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone,
error was ".$resolver->errorstring], $callback);
  }
  elsif ($reply->header->rcode ne 'NOERROR') {
    xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone,
error was ".$reply->header->rcode], $callback);
  }

There are two instances of this pattern in this function. Both should be fixed.

Regards
-- 
Jonathan Barber <[email protected]>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
xCAT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xcat-user

Reply via email to