Re: [Freeipa-devel] [PATCH 0094] Non IDNA zone name should be normalized to lowercase

2014-07-04 Thread Martin Kosek
On 07/03/2014 09:41 PM, Petr Spacek wrote:
> On 3.7.2014 19:04, Martin Basti wrote:
>> On Thu, 2014-07-03 at 19:03 +0200, Martin Basti wrote:
>>> Regresion caused by removing validation in DNSName for regular domain
>>> names
>>> In original code before IDNA, zones were normalized
>>> Patch attached
>>
>> Subject changed to patch 0094
>> sorry, I attach patch again.
> 
> ACK from functional perspective. Command "ipa dnszone TEST" adds DNS zone 
> "test.".
> 
> It can be pushed if there is no problem on Python side of things.

Looks good to me.

Pushed to master: 29951ada9fd7dd8e0887f0832c6b58f266960b72

Martin

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


Re: [Freeipa-devel] [PATCH 0094] Non IDNA zone name should be normalized to lowercase

2014-07-03 Thread Petr Spacek

On 3.7.2014 19:04, Martin Basti wrote:

On Thu, 2014-07-03 at 19:03 +0200, Martin Basti wrote:

Regresion caused by removing validation in DNSName for regular domain
names
In original code before IDNA, zones were normalized
Patch attached


Subject changed to patch 0094
sorry, I attach patch again.


ACK from functional perspective. Command "ipa dnszone TEST" adds DNS zone 
"test.".

It can be pushed if there is no problem on Python side of things.

--
Petr^2 Spacek

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


Re: [Freeipa-devel] [PATCH 0094] Non IDNA zone name should be normalized to lowercase

2014-07-03 Thread Martin Basti
On Thu, 2014-07-03 at 19:03 +0200, Martin Basti wrote:
> Regresion caused by removing validation in DNSName for regular domain
> names
> In original code before IDNA, zones were normalized
> Patch attached
> ___
> Freeipa-devel mailing list
> Freeipa-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-devel

Subject changed to patch 0094
sorry, I attach patch again.
-- 
Martin^2 Basti
>From ff9df6b6f7a28a0e598e20cd3308252ce836f7bb Mon Sep 17 00:00:00 2001
From: Martin Basti 
Date: Thu, 3 Jul 2014 18:14:40 +0200
Subject: [PATCH] Non IDNA zonename should be normalized to lowercase

Before IDNA support zone was normalized.
---
 ipalib/plugins/dns.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index c3a09e9d9d36f3bedc06407bf05d6ad47290a9b8..4c3497f6c74defbde3aa810f9d42b9c19ad870fc 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -1708,6 +1708,15 @@ def _records_idn_postprocess(record, **options):
 rrs.append(dnsvalue)
 record[attr] = rrs
 
+def _normalize_zone(zone):
+if isinstance(zone, unicode):
+# normalize only non-IDNA zones
+try:
+return unicode(zone.encode('ascii')).lower()
+except UnicodeError:
+pass
+return zone
+
 
 class DNSZoneBase(LDAPObject):
 """
@@ -1727,6 +1736,7 @@ class DNSZoneBase(LDAPObject):
 label=_('Zone name'),
 doc=_('Zone name (FQDN)'),
 default_from=lambda name_from_ip: _reverse_zone_name(name_from_ip),
+normalizer=_normalize_zone,
 primary_key=True,
 ),
 Str('name_from_ip?', _validate_ipnet,
-- 
1.8.3.1

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