« DRI/Protocol/EPP/Extensions/SE/Extensions.pm
↑ Summary
DRI/Protocol/EPP/Extensions/FCCN/Contact.pm »
| 1 | ## Domain Registry Interface, Afilias Association extension (for .XXX) | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2010,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||
| 5 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||
| 7 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 8 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 9 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 10 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||
| 12 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 13 | #################################################################################################### | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | package Net::DRI::Protocol::EPP::Extensions::Afilias::Association; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #################################################################################################### | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub register_commands | ||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 29 | create => [ \&create, undef ], | ||||||||||||||||||||||||||||
| 30 | update => [ \&update, undef ], | ||||||||||||||||||||||||||||
| 31 | info => [ undef, \&info_parse ] | ||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | return { 'domain' => \%tmp }; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub setup | ||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | $po->ns({association => 'urn:afilias:params:xml:ns:association-1.0'}); | |||||||||||||||||||||||||||
| 41 | 0 | return; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub capabilities_add { return ('domain_update','association',['add','del','set']); } | ||||||||||||||||||||||||||
|
Subroutine
capabilities_add: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | #################################################################################################### | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub build_association | ||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $as = shift; | ||||||||||||||||||||||||||
|
Subroutine
build_association: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my @pw = defined $as->{'pw'} ? ['association:authInfo',[ 'association:pw',$as->{'pw'}] ] : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | return ( | ||||||||||||||||||||||||||||
| 53 | ['association:contact',{'type' =>'membership'}, | ||||||||||||||||||||||||||||
| 54 | 0 | ['association:id',$as->{'id'}], | |||||||||||||||||||||||||||
| 55 | @pw | ||||||||||||||||||||||||||||
| 56 | ] | ||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub create | ||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||
| 62 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||||||||||||||||
|
Subroutine
create: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | return unless Net::DRI::Util::has_key($rd,'association'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 0 | my $as=$rd->{association}; | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Invalid Association Membership Contact ID and PW') unless Net::DRI::Util::xml_is_token($as->{'id'},1,63) && Net::DRI::Util::xml_is_token($as->{'pw'},6,16); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::xml_is_token($as->{"id"}, 1, 63) and Net::DRI::Util::xml_is_token($as->{"pw"}, 6, 16)
MC/DC0%0/2
Net::DRI::Util::xml_is_token($as->{"id"}, 1, 63) and Net::DRI::Util::xml_is_token($as->{"pw"}, 6, 16)
Net::DRI::Util::xml_is_token($as->{"id"}, 1, 63)
Net::DRI::Util::xml_is_token($as->{"pw"}, 6, 16)
Truth table0%0/3
A and B
A= Net::DRI::Util::xml_is_token($as->{"id"}, 1, 63)B= Net::DRI::Util::xml_is_token($as->{"pw"}, 6, 16)
| |||||||||||||||||||||||||||||
| 66 | 0 | my @t = build_association($as); | |||||||||||||||||||||||||||
| 67 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 68 | 0 | my $eid=$mes->command_extension_register('association','create'); | |||||||||||||||||||||||||||
| 69 | 0 | $mes->command_extension($eid,\@t); | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | return; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | sub update | ||||||||||||||||||||||||||||
| 75 | { | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my ($epp,$domain,$todo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 78 | 0 | my $toadd=$todo->add('association'); | |||||||||||||||||||||||||||
| 79 | 0 | my $todel=$todo->del('association'); | |||||||||||||||||||||||||||
| 80 | 0 | my $tochg=$todo->set('association'); | |||||||||||||||||||||||||||
| 81 | 0 | my @def=grep { defined } ($toadd,$todel); | |||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless @def; ## no updates asked | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | my $eid=$mes->command_extension_register('association','update'); | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | my @n; | |||||||||||||||||||||||||||
| 87 | 0 | ▶ | if (defined $toadd) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||
| 89 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Invalid Association Membership Contact ID and PW') unless Net::DRI::Util::xml_is_token($toadd->{'id'},1,63) && Net::DRI::Util::xml_is_token($toadd->{'pw'},6,16); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::xml_is_token($toadd->{"id"}, 1, 63) and Net::DRI::Util::xml_is_token($toadd->{"pw"}, 6, 16)
MC/DC0%0/2
Net::DRI::Util::xml_is_token($toadd->{"id"}, 1, 63) and Net::DRI::Util::xml_is_token($toadd->{"pw"}, 6, 16)
Net::DRI::Util::xml_is_token($toadd->{"id"}, 1, 63)
Net::DRI::Util::xml_is_token($toadd->{"pw"}, 6, 16)
Truth table0%0/3
A and B
A= Net::DRI::Util::xml_is_token($toadd->{"id"}, 1, 63)B= Net::DRI::Util::xml_is_token($toadd->{"pw"}, 6, 16)
| |||||||||||||||||||||||||||||
| 90 | 0 | push @n,['association:add',build_association($toadd)] | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if (defined $todel) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||
| 94 | 0 | undef $todel->{'pw'}; | |||||||||||||||||||||||||||
| 95 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Invalid Association Membership Contact ID') unless Net::DRI::Util::xml_is_token($toadd->{'id'},1,63); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | push @n,['association:rem',build_association($todel)] if (defined $todel); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if (defined $tochg) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | { | ||||||||||||||||||||||||||||
| 100 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Invalid Association Membership Contact ID and PW') unless Net::DRI::Util::xml_is_token($tochg->{'id'},1,63) && Net::DRI::Util::xml_is_token($tochg->{'pw'},6,16); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
Net::DRI::Util::xml_is_token($tochg->{"id"}, 1, 63) and Net::DRI::Util::xml_is_token($tochg->{"pw"}, 6, 16)
MC/DC0%0/2
Net::DRI::Util::xml_is_token($tochg->{"id"}, 1, 63) and Net::DRI::Util::xml_is_token($tochg->{"pw"}, 6, 16)
Net::DRI::Util::xml_is_token($tochg->{"id"}, 1, 63)
Net::DRI::Util::xml_is_token($tochg->{"pw"}, 6, 16)
Truth table0%0/3
A and B
A= Net::DRI::Util::xml_is_token($tochg->{"id"}, 1, 63)B= Net::DRI::Util::xml_is_token($tochg->{"pw"}, 6, 16)
| |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | push @n,['association:rem',build_association($tochg)] if (defined $tochg); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | $mes->command_extension($eid,\@n); | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | return; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | sub info_parse | ||||||||||||||||||||||||||||
| 111 | { | ||||||||||||||||||||||||||||
| 112 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 113 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 114 | 0 | my $infdata=$mes->get_extension('association','infData'); | |||||||||||||||||||||||||||
| 115 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | my %t; | |||||||||||||||||||||||||||
| 118 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | |||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||
| 120 | 0 | my ($n,$c)=@$el; | |||||||||||||||||||||||||||
| 121 | 0 | ▶ | next unless $n eq 'contact'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | $t{'type'} = $c->getAttribute('type'); | |||||||||||||||||||||||||||
| 123 | 0 | foreach my $el2 (Net::DRI::Util::xml_list_children($c)) | |||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||
| 125 | 0 | my ($n2,$c2)=@$el2; | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | $t{$n2}=$c->textContent() if ($n2=~m/^(?:id)$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | $rinfo->{$otype}->{$oname}->{association}=\%t; | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | return; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | #################################################################################################### | ||||||||||||||||||||||||||||
| 136 | 1 | 1; | |||||||||||||||||||||||||||