Log relevant request info.
This commit is contained in:
parent
ae1aeedc2f
commit
6404946d15
@ -5,6 +5,10 @@ class IPC::JSON
|
|||||||
def handle(service : IPC, event : IPC::Event)
|
def handle(service : IPC, event : IPC::Event)
|
||||||
raise "unimplemented"
|
raise "unimplemented"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
io << self.class.name.sub /[^:]+::[^:]+::/, ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module DNSManager
|
module DNSManager
|
||||||
|
@ -28,6 +28,11 @@ class DNSManager::Request
|
|||||||
def initialize(@subject)
|
def initialize(@subject)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (subject: #{@subject}, int: #{@int}, string: #{@string})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -72,6 +77,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
|
@ -10,6 +10,11 @@ class DNSManager::Request
|
|||||||
def initialize(@login, @domain)
|
def initialize(@login, @domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (login: #{@login}, domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
|
@ -5,6 +5,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -20,6 +25,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -35,6 +45,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -50,6 +65,11 @@ class DNSManager::Request
|
|||||||
def initialize(@uuid)
|
def initialize(@uuid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (uuid: #{@uuid})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
|
@ -9,6 +9,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain, @rrid)
|
def initialize(@domain, @rrid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rrid: #{@rrid})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -24,6 +29,11 @@ class DNSManager::Request
|
|||||||
def initialize(@token, @address)
|
def initialize(@token, @address)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (token: #{@token[0..15]}..., address: #{@address})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
dnsmanagerd.storage.use_token @token, @address
|
dnsmanagerd.storage.use_token @token, @address
|
||||||
end
|
end
|
||||||
|
@ -44,6 +44,11 @@ class DNSManager::Request
|
|||||||
def initialize(@user_id = nil)
|
def initialize(@user_id = nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (user_id: #{@user_id})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event)
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
|
@ -9,6 +9,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -24,6 +29,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -38,6 +48,11 @@ class DNSManager::Request
|
|||||||
def initialize(@zone)
|
def initialize(@zone)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (zone: #{@zone})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -52,6 +67,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -77,6 +97,11 @@ class DNSManager::Request
|
|||||||
property domain : String
|
property domain : String
|
||||||
property rr : DNSManager::Storage::Zone::ResourceRecord
|
property rr : DNSManager::Storage::Zone::ResourceRecord
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rr: #{@rr.to_simple_s})"
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(@domain, @rr)
|
def initialize(@domain, @rr)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -95,6 +120,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain, @rr)
|
def initialize(@domain, @rr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rr: #{@rr.to_simple_s})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -110,6 +140,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain, @rrid)
|
def initialize(@domain, @rrid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rrid: #{@rrid})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
@ -124,6 +159,11 @@ class DNSManager::Request
|
|||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
|
|
||||||
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
def handle(dnsmanagerd : DNSManager::Service, event : IPC::Event) : IPC::JSON
|
||||||
user = dnsmanagerd.get_logged_user event
|
user = dnsmanagerd.get_logged_user event
|
||||||
return Response::ErrorUserNotLogged.new unless user
|
return Response::ErrorUserNotLogged.new unless user
|
||||||
|
@ -4,6 +4,11 @@ class DNSManager::Response
|
|||||||
property reason : String | Array(String)
|
property reason : String | Array(String)
|
||||||
def initialize(@reason)
|
def initialize(@reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (reason: #{@reason})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << Error
|
DNSManager.responses << Error
|
||||||
|
|
||||||
|
@ -3,6 +3,11 @@ class DNSManager::Response
|
|||||||
property domain : String
|
property domain : String
|
||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << DomainDeleted
|
DNSManager.responses << DomainDeleted
|
||||||
|
|
||||||
@ -11,6 +16,11 @@ class DNSManager::Response
|
|||||||
property errors : Array(Storage::Zone::Error)
|
property errors : Array(Storage::Zone::Error)
|
||||||
def initialize(@errors)
|
def initialize(@errors)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (errors: #{@errors.join ","})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << InvalidZone
|
DNSManager.responses << InvalidZone
|
||||||
|
|
||||||
@ -18,6 +28,11 @@ class DNSManager::Response
|
|||||||
property domain : DNSManager::Storage::Domain
|
property domain : DNSManager::Storage::Domain
|
||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain.name})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << DomainChanged
|
DNSManager.responses << DomainChanged
|
||||||
|
|
||||||
@ -25,6 +40,11 @@ class DNSManager::Response
|
|||||||
property zone : Storage::Zone
|
property zone : Storage::Zone
|
||||||
def initialize(@zone)
|
def initialize(@zone)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (zone: #{@zone})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << Zone
|
DNSManager.responses << Zone
|
||||||
|
|
||||||
@ -38,6 +58,11 @@ class DNSManager::Response
|
|||||||
property domains : Array(String)
|
property domains : Array(String)
|
||||||
def initialize(@domains)
|
def initialize(@domains)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domains: #{@domains.join ","})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << DomainList
|
DNSManager.responses << DomainList
|
||||||
|
|
||||||
@ -45,6 +70,11 @@ class DNSManager::Response
|
|||||||
property domains : Array(String)
|
property domains : Array(String)
|
||||||
def initialize(@domains)
|
def initialize(@domains)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domains: #{@domains.join ","})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << AcceptedDomains
|
DNSManager.responses << AcceptedDomains
|
||||||
|
|
||||||
@ -54,6 +84,11 @@ class DNSManager::Response
|
|||||||
property my_domains : Array(DNSManager::Storage::Domain)
|
property my_domains : Array(DNSManager::Storage::Domain)
|
||||||
def initialize(@admin, @accepted_domains, @my_domains)
|
def initialize(@admin, @accepted_domains, @my_domains)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (admin: #{@admin})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << Logged
|
DNSManager.responses << Logged
|
||||||
|
|
||||||
@ -61,6 +96,11 @@ class DNSManager::Response
|
|||||||
property domain : String
|
property domain : String
|
||||||
def initialize(@domain)
|
def initialize(@domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << DomainAdded
|
DNSManager.responses << DomainAdded
|
||||||
|
|
||||||
@ -68,6 +108,11 @@ class DNSManager::Response
|
|||||||
property rrid : UInt32
|
property rrid : UInt32
|
||||||
def initialize(@rrid)
|
def initialize(@rrid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (rrid: #{@rrid})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << RRDeleted
|
DNSManager.responses << RRDeleted
|
||||||
|
|
||||||
@ -76,6 +121,11 @@ class DNSManager::Response
|
|||||||
property rr : Storage::Zone::ResourceRecord
|
property rr : Storage::Zone::ResourceRecord
|
||||||
def initialize(@domain, @rr)
|
def initialize(@domain, @rr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rr: #{@rr.to_simple_s})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << RRAdded
|
DNSManager.responses << RRAdded
|
||||||
|
|
||||||
@ -84,6 +134,11 @@ class DNSManager::Response
|
|||||||
property errors : Array(Storage::Zone::Error)
|
property errors : Array(Storage::Zone::Error)
|
||||||
def initialize(@errors)
|
def initialize(@errors)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (errors: #{@errors.join ","})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << InvalidRR
|
DNSManager.responses << InvalidRR
|
||||||
|
|
||||||
@ -92,6 +147,11 @@ class DNSManager::Response
|
|||||||
property rr : Storage::Zone::ResourceRecord
|
property rr : Storage::Zone::ResourceRecord
|
||||||
def initialize(@domain, @rr)
|
def initialize(@domain, @rr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rr: #{@rr.to_simple_s})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << RRUpdated
|
DNSManager.responses << RRUpdated
|
||||||
|
|
||||||
@ -100,6 +160,11 @@ class DNSManager::Response
|
|||||||
property rr : Storage::Zone::ResourceRecord
|
property rr : Storage::Zone::ResourceRecord
|
||||||
def initialize(@domain, @rr)
|
def initialize(@domain, @rr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain}, rr: #{@rr.to_simple_s})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << RRReadOnly
|
DNSManager.responses << RRReadOnly
|
||||||
|
|
||||||
@ -108,6 +173,11 @@ class DNSManager::Response
|
|||||||
property zonefile : String
|
property zonefile : String
|
||||||
def initialize(@domain, @zonefile)
|
def initialize(@domain, @zonefile)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domain: #{@domain})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << GeneratedZone
|
DNSManager.responses << GeneratedZone
|
||||||
|
|
||||||
@ -115,6 +185,11 @@ class DNSManager::Response
|
|||||||
property domains : Array(String)
|
property domains : Array(String)
|
||||||
def initialize(@domains)
|
def initialize(@domains)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s(io : IO)
|
||||||
|
super io
|
||||||
|
io << " (domains: #{@domains.join ","})"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
DNSManager.responses << OrphanDomainList
|
DNSManager.responses << OrphanDomainList
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,6 @@ module DNSManager
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
alias IPCMESSAGE = Baguette::Configuration::IPC::MESSAGE
|
|
||||||
alias DNSMESSAGE = DNSManager::MESSAGE
|
alias DNSMESSAGE = DNSManager::MESSAGE
|
||||||
|
|
||||||
class DNSManager::Service < IPC
|
class DNSManager::Service < IPC
|
||||||
@ -51,7 +50,7 @@ class DNSManager::Service < IPC
|
|||||||
when AuthD::Response::Login
|
when AuthD::Response::Login
|
||||||
uid = response.uid
|
uid = response.uid
|
||||||
token = response.token
|
token = response.token
|
||||||
Baguette::Log.info "Authenticated as #{@configuration.login} #{uid}, token: #{token}"
|
Baguette::Log.info "Authenticated as #{@configuration.login} #{uid}, token: #{token[0..15]}..."
|
||||||
else
|
else
|
||||||
@authd.close
|
@authd.close
|
||||||
raise "Cannot authenticate to authd with login #{@configuration.login}: #{response}."
|
raise "Cannot authenticate to authd with login #{@configuration.login}: #{response}."
|
||||||
@ -110,34 +109,34 @@ class DNSManager::Service < IPC
|
|||||||
response = begin
|
response = begin
|
||||||
request.handle self, event
|
request.handle self, event
|
||||||
rescue e : AuthorizationException
|
rescue e : AuthorizationException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} authorization error"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} authorization error"
|
||||||
Response::Error.new "authorization error"
|
Response::Error.new "authorization error"
|
||||||
rescue e : DomainNotFoundException
|
rescue e : DomainNotFoundException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} domain not found"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} domain not found"
|
||||||
Response::DomainNotFound.new
|
Response::DomainNotFound.new
|
||||||
rescue e : CannotCheckPermissionsException
|
rescue e : CannotCheckPermissionsException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} cannot check permissions of user '#{e.uid}' on resource '#{e.resource}'"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} cannot check permissions of user '#{e.uid}' on resource '#{e.resource}'"
|
||||||
Response::InsufficientRights.new
|
Response::InsufficientRights.new
|
||||||
rescue e : UnknownUserException
|
rescue e : UnknownUserException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} unknown user"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} unknown user"
|
||||||
Response::UnknownUser.new
|
Response::UnknownUser.new
|
||||||
rescue e : NoOwnershipException
|
rescue e : NoOwnershipException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} no ownership error"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} no ownership error"
|
||||||
Response::NoOwnership.new
|
Response::NoOwnership.new
|
||||||
rescue e : NotLoggedException
|
rescue e : NotLoggedException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} user not logged"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} user not logged"
|
||||||
Response::Error.new "user not logged"
|
Response::Error.new "user not logged"
|
||||||
rescue e : RRNotFoundException
|
rescue e : RRNotFoundException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} RR not found"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} RR not found"
|
||||||
Response::RRNotFound.new
|
Response::RRNotFound.new
|
||||||
rescue e : TokenNotFoundException
|
rescue e : TokenNotFoundException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} Token not found"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} Token not found"
|
||||||
Response::Error.new "token not found"
|
Response::Error.new "token not found"
|
||||||
rescue e : RRReadOnlyException
|
rescue e : RRReadOnlyException
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} RR is read only"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} RR is read only"
|
||||||
Response::RRReadOnly.new e.domain, e.rr
|
Response::RRReadOnly.new e.domain, e.rr
|
||||||
rescue e # Generic case
|
rescue e # Generic case
|
||||||
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{reqname} generic error #{e}"
|
Baguette::Log.error "(fd #{"%4d" % event.fd}) #{request} generic error #{e}"
|
||||||
Response::Error.new "generic error"
|
Response::Error.new "generic error"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -149,13 +148,11 @@ class DNSManager::Service < IPC
|
|||||||
|
|
||||||
duration = Time.utc - request_start
|
duration = Time.utc - request_start
|
||||||
|
|
||||||
response_name = response.class.name.sub /^DNSManager::Response::/, ""
|
|
||||||
|
|
||||||
if response.is_a? DNSManager::Response::Error
|
if response.is_a? DNSManager::Response::Error
|
||||||
Baguette::Log.warning "fd #{"%4d" % event.fd} (#{duration}) #{reqname} >> #{response_name} (#{response.reason})"
|
Baguette::Log.warning "fd #{"%4d" % event.fd} (#{duration}) #{request} >> #{response}"
|
||||||
else
|
else
|
||||||
if reqname != "KeepAlive" || should_display? DNSMESSAGE::KEEPALIVE
|
if reqname != "KeepAlive" || should_display? DNSMESSAGE::KEEPALIVE
|
||||||
Baguette::Log.debug "fd #{"%4d" % event.fd} (#{duration}) #{reqname} >> #{response_name}"
|
Baguette::Log.debug "fd #{"%4d" % event.fd} (#{duration}) #{request} >> #{response}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -88,6 +88,10 @@ class DNSManager::Storage::Zone
|
|||||||
[] of Error
|
[] of Error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_simple_s
|
||||||
|
"(rrid #{@rrid}, '#{@name}' #{@rrtype})"
|
||||||
|
end
|
||||||
|
|
||||||
def to_s(io : IO)
|
def to_s(io : IO)
|
||||||
io << "(#{ "%4d" % @rrid }) "
|
io << "(#{ "%4d" % @rrid }) "
|
||||||
io << "#{ "%.30s" % @name} #{ "%6d" % @ttl} #{ "%.10s" % @rrtype } #{ "%.30s" % @target}\n"
|
io << "#{ "%.30s" % @name} #{ "%6d" % @ttl} #{ "%.10s" % @rrtype } #{ "%.30s" % @target}\n"
|
||||||
@ -913,6 +917,10 @@ class DNSManager::Storage::Zone
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s(io : IO)
|
def to_s(io : IO)
|
||||||
|
io << "ZONE #{@domain} (#{@resources.size} rr)"
|
||||||
|
end
|
||||||
|
|
||||||
|
def pretty_print(io : IO)
|
||||||
io << "DOMAIN #{@domain}.\n"
|
io << "DOMAIN #{@domain}.\n"
|
||||||
@resources.each do |rr|
|
@resources.each do |rr|
|
||||||
io << rr
|
io << rr
|
||||||
|
Loading…
Reference in New Issue
Block a user