示例#1
0
文件: resolver.py 项目: dolda2000/ldd
 def squery(self, name, rtype):
     packet = proto.packet()
     try:
         if self.nsrecurse: packet.setflags(["recurse"])
     except AttributeError: pass
     packet.addq(rec.rrhead(name, rtype))
     return self.resolve(packet)
示例#2
0
文件: dbzone.py 项目: dolda2000/ldd
 def decoderecord(self, name, record):
     set = pickle.loads(record)
     rrset = []
     for cur in set:
         head = rec.rrhead(name, cur[0])
         data = cur[2]
         newrr = rec.rr(head, cur[1], data)
         newrr.setflags(cur[3])
         rrset += [newrr]
     return rrset
示例#3
0
文件: server.py 项目: dolda2000/ldd
 def handle(self, query, pkt):
     resp = zone.handle(self, query, pkt)
     if not "internal" in pkt.flags:
         if resp is None:
             resp = proto.responsefor(pkt)
             soa = zone.handle(self, rec.rrhead(self.origin, "SOA"), pkt)
             resp.aulist += soa.anlist
             resp.rescode = proto.NXDOMAIN
         else:
             resolver.resolvecnames(resp, self.aurecres)
             nsrecs = zone.handle(self, rec.rrhead(self.origin, "NS"), pkt)
             if nsrecs is not None:
                 resp.aulist += nsrecs.anlist
                 for rr in nsrecs.anlist:
                     resolver.resolveadditional(resp, rr, self.aurecres)
     else:
         if resp is None:
             return None
     resp.setflags(["auth"])
     return resp
示例#4
0
文件: resolver.py 项目: dolda2000/ldd
 def squery(self, name, rtype):
     if type(name) == str:
         name = dn.fromstring(name)
     if not name.rooted:
         namelist = [name + prefix for prefix in self.prelist] + [name + dn.fromstring(".")]
     else:
         namelist = [name]
     for name in namelist:
         packet = proto.packet()
         packet.setflags(["recurse"])
         packet.addq(rec.rrhead(name, rtype))
         res = self.resolve(packet)
         if res.rescode == 0:
             break
     return res