Project

General

Profile

« Previous | Next » 

Revision e54db92b

Added by Marc Dequènes almost 14 years ago

  • ID e54db92bc5d7b68b8afe5b6635121401011adb30

[fix] DNS: don't fail if zone cannot be parsed (not a nice solution yet)

View differences:

lib/cyborghood/services/dns.rb
def signed?
# check if really signed in DNS
logger.debug "Querying DNSKEY for domain '#{@name}'"
not @resolver.query(@name, 'DNSKEY').answer.empty?
end
......
def serial_in_zone_file
reader = Dnsruby::ZoneReader.new(@name)
zone = reader.process_file(@filename)
soa = zone.select{|rr| rr.name.to_s == @name and rr.type == 'SOA' }.first
soa ? soa.serial : nil
begin
zone = reader.process_file(@filename)
soa = zone.select{|rr| rr.name.to_s == @name and rr.type == 'SOA' }.first
soa ? soa.serial : nil
rescue Dnsruby::ZoneReader::ParseException
logger.warn "Problem parsing DNS zone '#{@name}'"
end
end
def serial_in_signed_zone_file
return unless has_signed_zone_file?
reader = Dnsruby::ZoneReader.new(@name)
zone = reader.process_file(@filename_signed)
soa = zone.select{|rr| rr.name.to_s == @name and rr.type == 'SOA' }.first
soa ? soa.serial : nil
begin
zone = reader.process_file(@filename_signed)
soa = zone.select{|rr| rr.name.to_s == @name and rr.type == 'SOA' }.first
soa ? soa.serial : nil
rescue Dnsruby::ZoneReader::ParseException
logger.warn "Problem parsing DNS zone '#{@name}'"
end
end
def content

Also available in: Unified diff