Fixed several bugs in the LDAP domain backend.
git-svn-id: svn+ssh://svn.luon.net/svn/ildus/trunk@14 65a33f86-aa00-0410-91be-cd1bf5efb309
This commit is contained in:
parent
37536b1fac
commit
021de3e57a
5
TODO
5
TODO
|
@ -2,7 +2,10 @@
|
|||
|
||||
* Put Protocol Errors in a separate module, document it
|
||||
better together with the protocol.
|
||||
* Retrieve the system's hostname.
|
||||
* Increase robustness for and error messages of erroneous commands.
|
||||
* Support for multiple domains.
|
||||
|
||||
= Known Issues
|
||||
|
||||
_Unknown as of yet_.
|
||||
* ADDA/DELA commands still unimplemented.
|
||||
|
|
|
@ -44,13 +44,13 @@ module Ildus::Server::DomainBackend
|
|||
all_entries.each do |entry|
|
||||
assoc_dom, a_rr, aaaa_rr, cname_rr =
|
||||
["associatedDomain", "aRecord",
|
||||
"aAAArecord", "cNAMErecord"].map { |attr| entry[attr] }
|
||||
host = assoc_dom.first.gsub(/\.#{config['domain']}$/, '')
|
||||
"aAAARecord", "cNAMERecord"].map { |attr| entry[attr] }
|
||||
host = assoc_dom.first.gsub(/\.#{config['name']}$/, '')
|
||||
|
||||
entries[host].first.push(*a_rr) if a_rr
|
||||
entries[host].first.push(*aaaa_rr) if aaaa_rr
|
||||
if cname_rr
|
||||
cname = cname_rr.first.gsub(/\.#{config['domain']}$/, '')
|
||||
cname = cname_rr.first.gsub(/\.#{config['name']}$/, '')
|
||||
entries[cname].last << host
|
||||
end
|
||||
end # search
|
||||
|
@ -62,7 +62,7 @@ module Ildus::Server::DomainBackend
|
|||
# correct IPv4 or IPv6 address format.
|
||||
def update_host(host, addr)
|
||||
entry = all_entries.find do |entry|
|
||||
entry['associatedDomain'][0] == host + "." + config['domain']
|
||||
entry['associatedDomain'][0] == "#{host}.#{config['name']}"
|
||||
end
|
||||
raise Handler::HostNotFoundError if entry.nil?
|
||||
|
||||
|
@ -91,7 +91,7 @@ module Ildus::Server::DomainBackend
|
|||
# Returns the LDAP sOARecord for the configured domain.
|
||||
def soa_record
|
||||
@ldap.search2(config['base'], LDAP::LDAP_SCOPE_BASE,
|
||||
"(&(associatedDomain=#{config['domain'].downcase})" \
|
||||
"(&(associatedDomain=#{config['name'].downcase})" \
|
||||
" (sOARecord=*))").first
|
||||
end
|
||||
|
||||
|
|
Reference in New Issue