diff options
author | Pavel Vomacka <pvomacka@redhat.com> | 2016-06-06 18:56:03 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2016-06-09 14:04:33 +0200 |
commit | 740099cf0bc2762b6ea329385f6abd542d863c98 (patch) | |
tree | 26662263fc42051ec8a54d0a174a4ec6662ec30b /install/ui | |
parent | da5885b72a284811bda7ddd36b8716d71ac66bd9 (diff) | |
download | freeipa-740099cf0bc2762b6ea329385f6abd542d863c98.tar.gz freeipa-740099cf0bc2762b6ea329385f6abd542d863c98.tar.xz freeipa-740099cf0bc2762b6ea329385f6abd542d863c98.zip |
Fix bad searching of reverse DNS zone
There was a problem with finding correct DNS zone. It found a first substring match.
Therefore when there was location 0.10.10.in-addr.arpa. and 110.10.10.in-addr.arpa
the location for IP address 10.10.110.1 was the first one, which is incorrect. Now
it finds the second one, because it finds the longest match.
https://fedorahosted.org/freeipa/ticket/5796
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/src/freeipa/dns.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js index 8bfc23a1a..8573e6537 100644 --- a/install/ui/src/freeipa/dns.js +++ b/install/ui/src/freeipa/dns.js @@ -2263,28 +2263,28 @@ IPA.dns.ptr_redirection_dialog = function(spec) { //2nd step: find target zone that.find_zone = function(data) { var zones = data.result.result; - var target_zone = null; + var target_zone = { + index: 100, + target_zone: '' + }; for (var i=0; i<zones.length; i++) { var zone_name = rpc.extract_objects(zones[i].idnsname)[0]; - if (that.reverse_address.indexOf(zone_name) > -1) { - var msg = text.get('@i18n:objects.dnsrecord.ptr_redir_zone'); - msg = msg.replace('${zone}', zone_name); - that.append_status(msg); - - if (!target_zone || - (target_zone && zone_name.length > target_zone.length)) { + var index = that.reverse_address.indexOf(zone_name); - target_zone = zone_name; - } - - break; + if (index > -1 && target_zone.index > index) { + target_zone.index = index; + target_zone.target_zone = zone_name; } } - if (target_zone) { - that.zone = target_zone; + if (target_zone.target_zone !== '') { + + that.zone = target_zone.target_zone; + var msg = text.get('@i18n:objects.dnsrecord.ptr_redir_zone'); + msg = msg.replace('${zone}', that.zone); + that.append_status(msg); that.check_record(); } else { that.append_status(text.get('@i18n:objects.dnsrecord.ptr_redir_zone_err')); |