mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
committed by
Petr Vobornik
parent
da5885b72a
commit
740099cf0b
@@ -2263,28 +2263,28 @@ IPA.dns.ptr_redirection_dialog = function(spec) {
|
|||||||
//2nd step: find target zone
|
//2nd step: find target zone
|
||||||
that.find_zone = function(data) {
|
that.find_zone = function(data) {
|
||||||
var zones = data.result.result;
|
var zones = data.result.result;
|
||||||
var target_zone = null;
|
var target_zone = {
|
||||||
|
index: 100,
|
||||||
|
target_zone: ''
|
||||||
|
};
|
||||||
|
|
||||||
for (var i=0; i<zones.length; i++) {
|
for (var i=0; i<zones.length; i++) {
|
||||||
|
|
||||||
var zone_name = rpc.extract_objects(zones[i].idnsname)[0];
|
var zone_name = rpc.extract_objects(zones[i].idnsname)[0];
|
||||||
if (that.reverse_address.indexOf(zone_name) > -1) {
|
var index = that.reverse_address.indexOf(zone_name);
|
||||||
|
|
||||||
|
if (index > -1 && target_zone.index > index) {
|
||||||
|
target_zone.index = index;
|
||||||
|
target_zone.target_zone = zone_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target_zone.target_zone !== '') {
|
||||||
|
|
||||||
|
that.zone = target_zone.target_zone;
|
||||||
var msg = text.get('@i18n:objects.dnsrecord.ptr_redir_zone');
|
var msg = text.get('@i18n:objects.dnsrecord.ptr_redir_zone');
|
||||||
msg = msg.replace('${zone}', zone_name);
|
msg = msg.replace('${zone}', that.zone);
|
||||||
that.append_status(msg);
|
that.append_status(msg);
|
||||||
|
|
||||||
if (!target_zone ||
|
|
||||||
(target_zone && zone_name.length > target_zone.length)) {
|
|
||||||
|
|
||||||
target_zone = zone_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target_zone) {
|
|
||||||
that.zone = target_zone;
|
|
||||||
that.check_record();
|
that.check_record();
|
||||||
} else {
|
} else {
|
||||||
that.append_status(text.get('@i18n:objects.dnsrecord.ptr_redir_zone_err'));
|
that.append_status(text.get('@i18n:objects.dnsrecord.ptr_redir_zone_err'));
|
||||||
|
Reference in New Issue
Block a user