|
35 |
import univention.debug2 as ud |
35 |
import univention.debug2 as ud |
36 |
import univention.s4connector.s4 |
36 |
import univention.s4connector.s4 |
37 |
import univention.admin.uldap |
37 |
import univention.admin.uldap |
|
|
38 |
from univention.s4connector.s4.dc import _unixTimeInverval2seconds |
39 |
from univention.admin.mapping import unmapUNIX_TimeInterval |
38 |
|
40 |
|
39 |
from samba.dcerpc import dnsp |
41 |
from samba.dcerpc import dnsp |
40 |
from samba.ndr import ndr_print |
42 |
from samba.ndr import ndr_print |
|
742 |
mx=__unpack_mxRecord(object) |
744 |
mx=__unpack_mxRecord(object) |
743 |
|
745 |
|
744 |
# Does a zone already exist? |
746 |
# Does a zone already exist? |
|
|
747 |
modify = False |
745 |
searchResult=s4connector.lo.search(filter='(&(relativeDomainName=%s)(zoneName=%s))' % (relativeDomainName, zoneName), unique=1) |
748 |
searchResult=s4connector.lo.search(filter='(&(relativeDomainName=%s)(zoneName=%s))' % (relativeDomainName, zoneName), unique=1) |
746 |
if len(searchResult) > 0: |
749 |
if len(searchResult) > 0: |
747 |
if dns_type == 'forward_zone': |
750 |
if dns_type == 'forward_zone': |
|
753 |
if soa['mname'] not in ns: |
756 |
if soa['mname'] not in ns: |
754 |
ns.insert(0, soa['mname']) |
757 |
ns.insert(0, soa['mname']) |
755 |
zone['nameserver'] = ns |
758 |
zone['nameserver'] = ns |
756 |
if soa['rname'] != zone['contact']: |
759 |
modify = True |
|
|
760 |
if soa['rname'].replace('.', '@', 1) != zone['contact'].rstrip('.'): |
757 |
zone['contact'] = soa['rname'].replace('.', '@', 1) |
761 |
zone['contact'] = soa['rname'].replace('.', '@', 1) |
758 |
if set(soa['serial']) != set(zone['serial']): |
762 |
modify = True |
|
|
763 |
if long(soa['serial']) != long(zone['serial']): |
759 |
zone['serial'] = soa['serial'] |
764 |
zone['serial'] = soa['serial'] |
760 |
for k in ['serial', 'refresh', 'retry', 'expire', 'ttl']: |
765 |
modify = True |
761 |
if set(soa[k]) != set(zone[k]): |
766 |
for k in ['refresh', 'retry', 'expire', 'ttl']: |
762 |
zone[k] = [soa[k]] |
767 |
if long(soa[k]) != _unixTimeInverval2seconds(zone[k]): |
|
|
768 |
zone[k] = unmapUNIX_TimeInterval(soa[k]) |
769 |
modify = True |
763 |
if dns_type == 'forward_zone': |
770 |
if dns_type == 'forward_zone': |
764 |
# The IP address of the DNS forward zone will be used to determine the |
771 |
# The IP address of the DNS forward zone will be used to determine the |
765 |
# sysvol share. On a selective replicated DC only a short list of DCs |
772 |
# sysvol share. On a selective replicated DC only a short list of DCs |
|
769 |
if not aRecords and not aAAARecords: |
776 |
if not aRecords and not aAAARecords: |
770 |
if set(a) != set(zone['a']): |
777 |
if set(a) != set(zone['a']): |
771 |
zone['a'] = a |
778 |
zone['a'] = a |
|
|
779 |
modify = True |
772 |
if mx: |
780 |
if mx: |
773 |
mapMX=lambda m: '%s %s' % (m[0], m[1]) |
781 |
mapMX=lambda m: '%s %s' % (m[0], m[1]) |
774 |
if set(map(mapMX,mx)) != set(map(mapMX,zone['mx'])): |
782 |
if set(map(mapMX,mx)) != set(map(mapMX,zone['mx'])): |
775 |
zone['mx'] = mx |
783 |
zone['mx'] = mx |
|
|
784 |
modify = True |
785 |
if modify: |
786 |
zone.modify() |
776 |
else: |
787 |
else: |
777 |
position=univention.admin.uldap.position( s4connector.property['dns'].ucs_default_dn ) |
788 |
position=univention.admin.uldap.position( s4connector.property['dns'].ucs_default_dn ) |
778 |
|
789 |
|