[Rt-commit] rtir branch, 5.0/fix-net-whois-test-functionality, created. 4.0.1rc1-199-g1054ccd8
Aaron Trevena
ast at bestpractical.com
Fri Jun 12 08:51:11 EDT 2020
The branch, 5.0/fix-net-whois-test-functionality has been created
at 1054ccd83e9feb963ee0091342197369da103d8b (commit)
- Log -----------------------------------------------------------------
commit 1054ccd83e9feb963ee0091342197369da103d8b
Author: Aaron Trevena <ast at bestpractical.com>
Date: Fri Jun 12 11:43:45 2020 +0100
Fix whois lookup by ip address with new Net::WHOIS::RIPE
New module implementation doesn't parse responses well, used a fixed version
of the relevent parsing code in the mason logic instead.
diff --git a/html/RTIR/Tools/Elements/GetEmailFromIP b/html/RTIR/Tools/Elements/GetEmailFromIP
index 0d768be7..5444e3ec 100644
--- a/html/RTIR/Tools/Elements/GetEmailFromIP
+++ b/html/RTIR/Tools/Elements/GetEmailFromIP
@@ -62,13 +62,18 @@ unless ( $iterator ) {
$field ||= 'notify';
-my @objects = Net::Whois::Object->new($iterator);
-my @res;
-foreach my $obj (@objects) {
- foreach my $attr ( grep lc $_ eq lc $field, $obj->attributes ) {
- push @res, $obj->$attr();
+my @res = ( );
+while ( ! $iterator->is_exhausted() ) {
+ foreach my $line ( split /\n/, $iterator->value() ) {
+ if ( $line =~ /^\s*(\S+\s?\S*):\s*(.*)/ ) {
+ my ($attribute, $value) = ($1,$2);
+ if (lc $attribute eq lc $field) {
+ push(@res, $value);
+ }
+ }
}
}
+
unless ( @res ) {
$$error = loc("Whois server response did not include field '[_1]'", $field);
return;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list