mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Merge pull request #2175 from internetee/2174-fix-for-dnssec-updating
Fix for DNSSEC keys updating
This commit is contained in:
commit
d94689bc79
3 changed files with 62 additions and 15 deletions
|
@ -169,26 +169,26 @@ module Epp
|
|||
|
||||
def parsed_response_for_dnskey(value)
|
||||
doc = Nokogiri::Slop params[:parsed_frame].css(value).to_html
|
||||
|
||||
return true if doc.document.children.empty?
|
||||
|
||||
|
||||
store = []
|
||||
|
||||
if value == 'add'
|
||||
doc.document.add.children.each_with_index do |x, i|
|
||||
store << doc.document.add.children[i].name
|
||||
case value
|
||||
when 'add'
|
||||
doc.document.add.children.each_with_index do |_x, i|
|
||||
store << doc.document.add.children[i].name
|
||||
end
|
||||
elsif value == 'chg'
|
||||
doc.document.chg.children.each_with_index do |x, i|
|
||||
store << doc.document.chg.children[i].name
|
||||
when 'chg'
|
||||
doc.document.chg.children.each_with_index do |_x, i|
|
||||
store << doc.document.chg.children[i].name
|
||||
end
|
||||
else
|
||||
doc.document.rem.children.each_with_index do |x, i|
|
||||
store << doc.document.rem.children[i].name
|
||||
doc.document.rem.children.each_with_index do |_x, i|
|
||||
store << doc.document.rem.children[i].name
|
||||
end
|
||||
end
|
||||
|
||||
return true if store.size == 1 and store[0] == "keyData"
|
||||
return true if store.size.positive? && store.include?('keyData')
|
||||
|
||||
store.empty?
|
||||
end
|
||||
|
@ -209,10 +209,9 @@ module Epp
|
|||
return if parsed_response_for_dnskey('rem')
|
||||
end
|
||||
|
||||
return epp_errors.add(:epp_errors,
|
||||
code: '2304',
|
||||
msg: "#{I18n.t(:object_status_prohibits_operation)}
|
||||
:serverObjUpdateEnabled")
|
||||
epp_errors.add(:epp_errors,
|
||||
code: '2304',
|
||||
msg: "#{I18n.t(:object_status_prohibits_operation)} :serverObjUpdateProhibited")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
47
test/integration/epp/domain/update/replace_dns_test.rb
Normal file
47
test/integration/epp/domain/update/replace_dns_test.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainUpdateReplaceDnsTest < EppTestCase
|
||||
def test_parsed_response_for_dnskey_with_spaces_in_request
|
||||
doc = Nokogiri::XML::Document.parse(schema_update)
|
||||
params = { parsed_frame: doc }
|
||||
domain_controller = Epp::DomainsController.new
|
||||
domain_controller.params = ActionController::Parameters.new(params)
|
||||
|
||||
assert_equal(domain_controller.send(:parsed_response_for_dnskey, 'rem'), true)
|
||||
assert_equal(domain_controller.send(:parsed_response_for_dnskey, 'add'), true)
|
||||
end
|
||||
|
||||
def schema_update
|
||||
<<~XML
|
||||
<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
||||
<epp schemaLocation=\"https://epp.tld.ee/schema/epp-ee-1.0.xsd epp-ee-1.0.xsd https://epp.tld.ee/schema/domain-ee-1.2.xsd domain-ee-1.2.xsd urn:ietf:params:xml:ns:secDNS-1.1 secDNS-1.1.xsd https://epp.tld.ee/schema/eis-1.0.xsd eis-1.0.xsd\">
|
||||
<command>
|
||||
<update>
|
||||
<update>
|
||||
<name>shop.test</name>
|
||||
</update>
|
||||
</update>
|
||||
<extension>
|
||||
<update>
|
||||
<rem> \n
|
||||
<keyData>
|
||||
<flags>257</flags>
|
||||
<protocol>3</protocol>
|
||||
<alg>8</alg>
|
||||
<pubKey>AwEAAbXae59P87nfCP1MpLJouUhtDlVFbgek392nxqJcIHwYAs5sd4O4BPAvd41VmqhWllTiArNYDBV8UAtPZ8eZtYDC4D7ITC1HsxzQzzMUOorrNwMQMFq/PHP9tKelfRh68dh7UX0nTKlIouTcZ3xbqxAeoAbgvFjj/ZDS8G4QE2NgdonaK2w9q/da189zrZUhyAgecZCiTXbqqXd/LNXGRwDjJgFBWBmXbEjkcSfHke7idAcGqmYK2E5FstsmEwDcupxZ8jxuN1m/wDrBeZE5UdT24LtLGDda+ATXvCuARhQtZzSAn0JOdfGN5xJ02g+OtsbVC/mSGR3rykjzJ+hUlPU=</pubKey>\n </keyData>
|
||||
</rem>
|
||||
<add> \n
|
||||
<keyData>
|
||||
<flags>257</flags>
|
||||
<protocol>3</protocol>
|
||||
<alg>8</alg>
|
||||
<pubKey>AwEAAdas/oY6xQV2MYd+o5pcUHK0f/mtETRNyBhh/TSABqRM9JikXlSrwLFT9sAfOsTiRNbPnvEiCKdEdoN0f0Oel0WNXadLlVINmxtCue93bSX7zxrVvjhbkHffOVdpBL0CIDQoX1HPZmoBXXPdZtWLpDQ7nVfUtdC/McTFSRawUYaoCWOEAgC8YY+kh6C8TUZzHMl+JiVE6YFkTIFf+z4MxA920UxUnGpdcfRbcB0CYjCxe+PuiA+aZHFheEe5S5tlW7tO96hxK/k2l93N//T2mEM53TKomk62HoWvNVdPrs7jdZbGzeY2eBPDWMAIIpgOv9ApORi+kHSQm2POCwf/KYs=</pubKey>\n </keyData>
|
||||
</add>
|
||||
</update>
|
||||
</extension>
|
||||
<clTRID>0.04946500 1632965705</clTRID>
|
||||
</command>
|
||||
</epp>\n
|
||||
XML
|
||||
end
|
||||
end
|
|
@ -3,6 +3,7 @@ require 'application_system_test_case'
|
|||
class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:api_goodnames)
|
||||
Capybara.default_max_wait_time = 5
|
||||
end
|
||||
|
||||
def test_replaces_current_registrar_nameservers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue