| 1 | ## Domain Registry Interface, RRI Registry messages commands (DENIC-11) | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2008,2012 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## (c) 2013 Michael Holloway <michael@thedarkwinter.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 5 | ## (c) 2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||
| 7 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 8 | ## | ||||||||||||||||||||||||||||
| 9 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 10 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 11 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 12 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 13 | ## | ||||||||||||||||||||||||||||
| 14 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 15 | ######################################################################################### | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | package Net::DRI::Protocol::RRI::RegistryMessage; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use DateTime::Format::ISO8601 (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =pod | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head1 NAME | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | Net::DRI::Protocol::RRI::RegistryMessage - RRI Registry messages commands (DENIC-11) for Net::DRI | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | E<lt>tonnerre.lombard@sygroup.chE<gt> | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | E<lt>http://oss.bsdprojects.net/project/netdri/E<gt> | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | Tonnerre Lombard, E<lt>tonnerre.lombard@sygroup.chE<gt> | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | Copyright (c) 2008,2013 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>. | ||||||||||||||||||||||||||||
| 55 | (c) 2013 Michael Holloway <michael@thedarkwinter.com>. | ||||||||||||||||||||||||||||
| 56 | (c) 2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 57 | All rights reserved. | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 60 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 61 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 62 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | #################################################################################################### | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | sub register_commands | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | my ($class,$version)=@_; | |||||||||||||||||||||||||||
| 73 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 74 | retrieve => [ \&pollreq, \&parse_poll ], | ||||||||||||||||||||||||||||
| 75 | delete => [ \&pollack ], | ||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | return { 'message' => \%tmp }; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | sub pollack | ||||||||||||||||||||||||||||
| 82 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
pollack: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | my ($rri, $msgid) = @_; | |||||||||||||||||||||||||||
| 84 | 0 | my $mes = $rri->message(); | |||||||||||||||||||||||||||
| 85 | 0 | $mes->command(['msg', 'delete', $mes->ns('msg'), {msgid => $msgid}]); | |||||||||||||||||||||||||||
| 86 | 0 | return; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | sub pollreq | ||||||||||||||||||||||||||||
| 90 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
pollreq: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 91 | 0 | my ($rri,$msgid)=@_; | |||||||||||||||||||||||||||
| 92 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('In RRI, you can not specify the message id you want to retrieve') if defined($msgid); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 0 | my $mes = $rri->message(); | |||||||||||||||||||||||||||
| 94 | 0 | $mes->command(['msg', 'queue-read', $mes->ns('msg')]); | |||||||||||||||||||||||||||
| 95 | 0 | $mes->cltrid(undef); | |||||||||||||||||||||||||||
| 96 | 0 | return; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | ## We take into account all parse functions, to be able to parse any result | ||||||||||||||||||||||||||||
| 100 | sub parse_poll | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
parse_poll: not called CC=23 SCAR=63.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 102 | 0 | my ($po, $otype, $oaction, $oname, $rinfo) = @_; | |||||||||||||||||||||||||||
| 103 | 0 | my $mes = $po->message(); | |||||||||||||||||||||||||||
| 104 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 0 | my $msgdata = $mes->get_content('message', $mes->ns('msg')); | |||||||||||||||||||||||||||
| 106 | 0 | ▶ | return unless ($msgdata); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | my $msgid = $msgdata->getAttribute('msgid'); | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | return unless (defined($msgid) && $msgid); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $msgid and $msgid
MC/DC0%0/2
defined $msgid and $msgid
defined $msgid
$msgid
Truth table0%0/3
A and B
A= defined $msgidB= $msgid
| |||||||||||||||||||||||||||||
| 110 | 0 | $rinfo->{message}->{session}->{last_id}=$msgid; ## needed here and not lower below, in case of pure text registry message | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | my $rd = {}; | |||||||||||||||||||||||||||
| 113 | 0 | $rd->{id} = $msgid; | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | $rd->{lang} = 'en'; | |||||||||||||||||||||||||||
| 116 | 0 | $rd->{qdate} = DateTime::Format::ISO8601->new()->parse_datetime($msgdata->getAttribute('msgtime')); | |||||||||||||||||||||||||||
| 117 | 0 | $rd->{objtype} = 'domain'; | |||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | my $el = $msgdata;#->getFirstChild(); | |||||||||||||||||||||||||||
| 120 | 0 | my $action = undef; | |||||||||||||||||||||||||||
| 121 | 0 | my @actions = ( 'authInfo2Notify', 'authInfo2Delete', 'authInfoExpire', 'chprovAuthInfo', 'expire', 'expireWarning', 'domainDelete' ); | |||||||||||||||||||||||||||
| 122 | 0 | foreach (@actions) { | |||||||||||||||||||||||||||
| 123 | 0 | ▶ | next unless ($el->getElementsByTagNameNS($mes->ns('msg'), $_)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | $action = $rd->{action} = $_; | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # domain and clID | ||||||||||||||||||||||||||||
| 128 | 0 | my @doms = $el->getElementsByTagNameNS($mes->ns('msg'), 'domain'); | |||||||||||||||||||||||||||
| 129 | 0 | my @news = $el->getElementsByTagNameNS($mes->ns('msg'), 'new'); | |||||||||||||||||||||||||||
| 130 | 0 | my @olds = $el->getElementsByTagNameNS($mes->ns('msg'), 'old'); | |||||||||||||||||||||||||||
| 131 | 0 | my $dom = $doms[0]; | |||||||||||||||||||||||||||
| 132 | 0 | my $new; | |||||||||||||||||||||||||||
| 133 | 0 | ▶ | $new = $news[0]->getFirstChild()->getData() if (@news); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $rd->{clID} = $new if (length($new)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | 0 | my $old; | |||||||||||||||||||||||||||
| 136 | 0 | ▶ | $old = $olds[0]->getFirstChild()->getData() if (@olds); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | $rd->{oldID} = $old if (length($old)); # should this be acID ? its already left the account | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | 0 | my $dn; | |||||||||||||||||||||||||||
| 139 | 0 | ▶ | if ($dom) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||
| 141 | 0 | my @hndls = $dom->getElementsByTagNameNS($mes->ns('msg'), 'handle'); | |||||||||||||||||||||||||||
| 142 | 0 | my @exps = $dom->getElementsByTagNameNS($mes->ns('msg'), 'expire'); | |||||||||||||||||||||||||||
| 143 | 0 | my $hndl = $hndls[0]; | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | $dn = $rd->{object_id} = $hndl->getFirstChild()->getData() if (@hndls); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | $rd->{exDate} = DateTime::Format::ISO8601->new()->parse_datetime($exps[0]->getFirstChild()->getData()) if (@exps); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | my @authexps = $el->getElementsByTagNameNS($mes->ns('msg'), 'authinfoexpire'); | |||||||||||||||||||||||||||
| 149 | 0 | ▶ | $rd->{authInfoExpire} = DateTime::Format::ISO8601->new()->parse_datetime($authexps[0]->getFirstChild()->getData()) if (@authexps); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $rd->{content} = $dn . ' change of provider to ' . $new if ($action eq 'chprovAuthInfo'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | 0 | ▶ | $rd->{content} = $dn . ' will expire on ' . $rd->{exDate}->ymd . ' at ' . $rd->{exDate}->hms if ($action eq 'expireWarning'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | $rd->{content} = $dn . ' expired on ' . $rd->{exDate}->ymd . ' at ' . $rd->{exDate}->hms if ($action eq 'expire'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 0 | ▶ | $rd->{content} = $dn . ' deleted by DENIC legal department on ' . $rd->{exDate}->ymd . ' at ' . $rd->{exDate}->hms if ($action eq 'domainDelete'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | $rd->{content} = $dn . ' authinfo expired on '. $rd->{authInfoExpire}->ymd if ($action eq 'authInfoExpire'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $rd->{content} = $dn . ' authinfo2 created' if ($action eq 'authInfo2Notify'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $rd->{content} = $dn . ' authinfo2 deleted' if ($action eq 'authInfo2Delete'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | ▶ | $rd->{content} = $dn . ' ' . $action unless (defined $rd->{content}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | $rinfo->{message}->{$msgid} = $rd; | |||||||||||||||||||||||||||
| 162 | 0 | return; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | #################################################################################################### | ||||||||||||||||||||||||||||
| 166 | 1 | 1; | |||||||||||||||||||||||||||