Fix #797

Pavel
>From 509a77949474b429bb4d4ee6fa871bdade446625 Mon Sep 17 00:00:00 2001
From: Pavel Zuna <pz...@redhat.com>
Date: Tue, 18 Jan 2011 13:28:37 -0500
Subject: [PATCH 1/2] Fix crash when building DN of host with name ending with period.

Fix #797
---
 ipalib/plugins/host.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index 8639ce5..d09f0eb 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -240,15 +240,16 @@ class host(LDAPObject):
     )
 
     def get_dn(self, *keys, **options):
-        if keys[-1].endswith('.'):
-            keys[-1] = keys[-1][:-1]
-        dn = super(host, self).get_dn(*keys, **options)
+        hostname = keys[-1]
+        if hostname.endswith('.'):
+            hostname = hostname[:-1]
+        dn = super(host, self).get_dn(hostname, **options)
         try:
             self.backend.get_entry(dn, [''])
         except errors.NotFound:
             try:
                 (dn, entry_attrs) = self.backend.find_entry_by_attr(
-                    'serverhostname', keys[-1], self.object_class, [''],
+                    'serverhostname', hostname, self.object_class, [''],
                     self.container_dn
                 )
             except errors.NotFound:
-- 
1.7.1.1

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

Reply via email to