On 3.5.2013 15:38, Martin Kosek wrote:
On 05/03/2013 03:34 PM, Jan Cholasta wrote:
I don't see a point in doing this now. There are many occurences of
uncoditional fqdn+'.' in the code and the proper fix would be to get rid of
them all. I think this could be done in the scope of
<https://fedorahosted.org/freeipa/ticket/1917>.

Honza


I would not want to wait until then - this ticket won't be done in near future.

Maybe it should be done in near future then.

Can you please just replace fqdn+"." and fqdn+'.' in bindinstance.py with
normalize_zone(fqdn) for now? I saw about 8 occurrences there.

OK.

Updated patch attached.

Honza

--
Jan Cholasta
>From 5e7e1408e8b66ceaab6c807d7759b01e06aca394 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Fri, 3 May 2013 15:00:24 +0200
Subject: [PATCH] Fix normalization of FQDNs in DNS installer code.

https://fedorahosted.org/freeipa/ticket/3600
---
 ipaserver/install/bindinstance.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 7a37f7b..6694f01 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -342,11 +342,10 @@ def add_fwd_rr(zone, host, ip_address):
 
 def add_ptr_rr(zone, ip_address, fqdn, dns_backup=None):
     name = get_reverse_record_name(zone, ip_address)
-    add_rr(zone, name, "PTR", fqdn+".", dns_backup)
+    add_rr(zone, name, "PTR", normalize_zone(fqdn), dns_backup)
 
 def add_ns_rr(zone, hostname, dns_backup=None, force=True):
-    if not hostname.endswith('.'):
-        hostname += '.'
+    hostname = normalize_zone(hostname)
     add_rr(zone, "@", "NS", hostname, dns_backup=dns_backup,
             force=force)
 
@@ -683,7 +682,7 @@ class BindInstance(service.Service):
 
             reverse_zone = find_reverse_zone(addr)
             if reverse_zone:
-                add_ptr_rr(reverse_zone, addr, normalize_zone(fqdn))
+                add_ptr_rr(reverse_zone, addr, fqdn)
 
     def __add_self(self):
         self.__add_master_records(self.fqdn, [self.ip_address])
@@ -911,7 +910,7 @@ class BindInstance(service.Service):
             ("_kpasswd._tcp", "SRV", "0 100 464 %s" % self.host_in_rr),
             ("_kpasswd._udp", "SRV", "0 100 464 %s" % self.host_in_rr),
             ("_ntp._udp", "SRV", "0 100 123 %s" % self.host_in_rr),
-            ("@", "NS", fqdn+"."),
+            ("@", "NS", normalize_zone(fqdn)),
         )
 
         for (record, type, rdata) in resource_records:
@@ -924,9 +923,9 @@ class BindInstance(service.Service):
             rzone = find_reverse_zone(rdata)
             if rzone is not None:
                 record = get_reverse_record_name(rzone, rdata)
-                del_rr(rzone, record, "PTR", fqdn+".")
+                del_rr(rzone, record, "PTR", normalize_zone(fqdn))
                 # remove also master NS record from the reverse zone
-                del_rr(rzone, "@", "NS", fqdn+".")
+                del_rr(rzone, "@", "NS", normalize_zone(fqdn))
 
     def remove_ipa_ca_dns_records(self, fqdn, domain_name):
         host, zone = fqdn.split(".", 1)
-- 
1.8.1.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to