Changeset 508
- Timestamp:
- May 8, 2008, 5:22:04 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-dns/code/dnsserver.py
r505 r508 44 44 domain = name.lower() 45 45 else: 46 found = False47 46 for domain in self.domains: 48 47 if name.lower().endswith('.'+domain): 49 found = True50 48 break 51 if not found: 52 #Not us 49 else: #Not us 53 50 return defer.fail(failure.Failure(dns.DomainError(name))) 54 51 results = [] 55 52 if cls == dns.IN and type in (dns.A, dns.ALL_RECORDS): 56 53 host = name[:-len(domain)-1] 57 value = sipb_xen_database.Machine.get_by(name=host) 58 if value is None or not value.nics: 59 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 60 ip = value.nics[0].ip 61 if ip is None: #Deactivated? 62 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 63 ttl = 900 64 record = dns.Record_A(ip, ttl) 65 results.append(dns.RRHeader(name, dns.A, dns.IN, 66 ttl, record, auth=True)) 54 if not host: 55 ttl = 900 56 record = dns.Record_CNAME('sipb-xen-dev.mit.edu', ttl) 57 results.append(dns.RRHeader(name, dns.CNAME, dns.IN, 58 ttl, record, auth=True)) 59 else: 60 value = sipb_xen_database.Machine.get_by(name=host) 61 if value is None or not value.nics: 62 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 63 ip = value.nics[0].ip 64 if ip is None: #Deactivated? 65 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 66 ttl = 900 67 record = dns.Record_A(ip, ttl) 68 results.append(dns.RRHeader(name, dns.A, dns.IN, 69 ttl, record, auth=True)) 67 70 authority = [] 68 71 authority.append(dns.RRHeader(domain, dns.SOA, dns.IN, 3600,
Note: See TracChangeset
for help on using the changeset viewer.