Introduced A/AAAA field clearing. Updated the LDAP backend to support it.
git-svn-id: svn+ssh://svn.luon.net/svn/ildus/trunk@18 65a33f86-aa00-0410-91be-cd1bf5efb309
This commit is contained in:
parent
14778157c6
commit
bdd9c303e4
|
@ -196,6 +196,7 @@ module Ildus
|
|||
|
||||
# (*Interface*) Updates the address of the given
|
||||
# _host_ to the give address _addr_.
|
||||
# If _addr_ is *nil*, the entry should be removed.
|
||||
def update_host(host, addr)
|
||||
raise Handler::NotImplementedError
|
||||
end
|
||||
|
|
|
@ -59,7 +59,7 @@ module Ildus::Server::DomainBackend
|
|||
end # def hosts
|
||||
|
||||
# Updates the address of _host_ to _addr_ providing that _addr_ is in a
|
||||
# correct IPv4 or IPv6 address format.
|
||||
# correct IPv4 or IPv6 address format or *nil*.
|
||||
def update_host(host, addr)
|
||||
entry = all_entries.find do |entry|
|
||||
entry['associatedDomain'][0] == "#{host}.#{config['name']}"
|
||||
|
@ -69,11 +69,19 @@ module Ildus::Server::DomainBackend
|
|||
if addr.ipv4?
|
||||
record = entry['aRecord']
|
||||
return false if record and record[0] == addr.to_s
|
||||
@ldap.modify(entry['dn'][0], {"aRecord" => [addr.to_s]})
|
||||
if addr.to_i.zero?
|
||||
@ldap.modify(entry['dn'][0], {"aRecord" => []})
|
||||
else
|
||||
@ldap.modify(entry['dn'][0], {"aRecord" => [addr.to_s]})
|
||||
end
|
||||
elsif addr.ipv6?
|
||||
record = entry['aAAARecord']
|
||||
return false if record and record[0] == addr.to_s
|
||||
@ldap.modify(entry['dn'][0], {"aAAARecord" => [addr.to_s]})
|
||||
if addr.to_i.zero?
|
||||
@ldap.modify(entry['dn'][0], {"aAAARecord" => []})
|
||||
else
|
||||
@ldap.modify(entry['dn'][0], {"aAAARecord" => [addr.to_s]})
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -69,7 +69,7 @@ module Ildus
|
|||
@io = io
|
||||
@commit = false
|
||||
|
||||
# Create the domain backend.
|
||||
# Create the domain name service backend.
|
||||
type = @config["domain"]["type"]
|
||||
klass = Backend.get_domain(type)
|
||||
raise "domain backend type `#{type}' not found" if klass.nil?
|
||||
|
|
Reference in New Issue