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

--
Martin^3 Babinsky
From 61b206d62f4dcfc36682724ab6569f8f7fa87b64 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Fri, 15 Apr 2016 17:05:11 +0200
Subject: [PATCH] replica-prepare: do not add PTR records if there is no IPA
 managed reverse zone

ipa-replica-prepare could crash during addition of replica's PTR records if
there was no reverse zone managed by IPA and 'bindinstance.find_reverse_zone'
returns an unhandled None. The code will now issue a warning and skip the PTR
record addition in this case.

https://fedorahosted.org/freeipa/ticket/5740
---
 ipaserver/install/ipa_replica_prepare.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ipaserver/install/ipa_replica_prepare.py b/ipaserver/install/ipa_replica_prepare.py
index 17d20322063fbb6f9d65a2528f9db0b07f486ede..fdd32f0c8437a0d8c3947d57089662ea09bb2304 100644
--- a/ipaserver/install/ipa_replica_prepare.py
+++ b/ipaserver/install/ipa_replica_prepare.py
@@ -520,6 +520,11 @@ class ReplicaPrepare(admintool.AdminTool):
 
             if not options.no_reverse:
                 reverse_zone = bindinstance.find_reverse_zone(ip)
+                if reverse_zone is None:
+                    self.log.warning(
+                        "Could not find any IPA managed reverse zone. "
+                        "Not creating PTR records")
+                    return
                 try:
                     add_ptr_rr(reverse_zone, ip_address, self.replica_fqdn)
                 except errors.PublicError as e:
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to