mirror of
https://github.com/samba-team/samba.git
synced 2025-01-17 02:05:21 +03:00
dns_hub: Fix flake8 warnings
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
4ecdcc4b46
commit
5d5a790bd3
@ -20,11 +20,9 @@
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import select
|
import select
|
||||||
import socket
|
import socket
|
||||||
from samba.dcerpc import dns
|
from samba.dcerpc import dns
|
||||||
from samba.tests.dns_base import DNSTest
|
|
||||||
import samba.ndr as ndr
|
import samba.ndr as ndr
|
||||||
|
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
@ -34,6 +32,7 @@ else:
|
|||||||
import socketserver
|
import socketserver
|
||||||
sserver = socketserver
|
sserver = socketserver
|
||||||
|
|
||||||
|
|
||||||
class DnsHandler(sserver.BaseRequestHandler):
|
class DnsHandler(sserver.BaseRequestHandler):
|
||||||
def dns_transaction_udp(self, packet, host):
|
def dns_transaction_udp(self, packet, host):
|
||||||
"send a DNS query and read the reply"
|
"send a DNS query and read the reply"
|
||||||
@ -90,7 +89,7 @@ class DnsHandler(sserver.BaseRequestHandler):
|
|||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
data, sock = self.request
|
data, sock = self.request
|
||||||
query = ndr.ndr_unpack(dns.name_packet, data);
|
query = ndr.ndr_unpack(dns.name_packet, data)
|
||||||
name = query.questions[0].name
|
name = query.questions[0].name
|
||||||
forwarder = self.forwarder(name)
|
forwarder = self.forwarder(name)
|
||||||
response = None
|
response = None
|
||||||
@ -134,9 +133,10 @@ class server_thread(threading.Thread):
|
|||||||
self.server.serve_forever()
|
self.server.serve_forever()
|
||||||
print("dns_hub: after serve_forever()")
|
print("dns_hub: after serve_forever()")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
timeout = int(sys.argv[1])*1000
|
timeout = int(sys.argv[1]) * 1000
|
||||||
timeout = min(timeout, 2**31-1) # poll with 32-bit int can't take more
|
timeout = min(timeout, 2**31 - 1) # poll with 32-bit int can't take more
|
||||||
host = sys.argv[2]
|
host = sys.argv[2]
|
||||||
server = sserver.UDPServer((host, int(53)), DnsHandler)
|
server = sserver.UDPServer((host, int(53)), DnsHandler)
|
||||||
t = server_thread(server)
|
t = server_thread(server)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user