https://fedorahosted.org/freeipa/ticket/4722

Patch attached.

--
Martin Basti

From 5878f7878e11a51189a131edf6c772934999efb1 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Thu, 15 Jan 2015 13:13:55 +0100
Subject: [PATCH] Always return absolute idnsname in dnszone commands

Ticket: https://fedorahosted.org/freeipa/ticket/4722
---
 ipalib/plugins/dns.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 7a80036c94432a01ea8781101712ea1135134948..d08e5f3bc9d8e976404d7eaf357b046a7c40089f 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -2632,6 +2632,16 @@ class dnszone(DNSZoneBase):
             _add_warning_fw_zone_is_not_effective(result, fwzone,
                                                   options['version'])
 
+    def _make_zone_absolute(self, entry_attrs):
+        """
+        Zone names can be relative in IPA < 4.0, make sure we always return
+        absolute zone name from ldap
+        Only old master zones in LDAP area affected.
+        """
+        if "idnsname" in entry_attrs:
+            entry_attrs['idnsname'] = [
+                entry_attrs['idnsname'][0].make_absolute()]
+
 
 @register()
 class dnszone_add(DNSZoneBase_add):
@@ -2798,6 +2808,7 @@ class dnszone_mod(DNSZoneBase_mod):
     def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
         assert isinstance(dn, DN)
         self.obj._rr_zone_postprocess(entry_attrs, **options)
+        self.obj._make_zone_absolute(entry_attrs)
         return dn
 
 
@@ -2835,6 +2846,7 @@ class dnszone_find(DNSZoneBase_find):
     def post_callback(self, ldap, entries, truncated, *args, **options):
         for entry_attrs in entries:
             self.obj._rr_zone_postprocess(entry_attrs, **options)
+            self.obj._make_zone_absolute(entry_attrs)
         return truncated
 
 
@@ -2851,6 +2863,7 @@ class dnszone_show(DNSZoneBase_show):
     def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
         assert isinstance(dn, DN)
         self.obj._rr_zone_postprocess(entry_attrs, **options)
+        self.obj._make_zone_absolute(entry_attrs)
         return dn
 
 
-- 
2.1.0

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

Reply via email to