[Rt-commit] rtir branch, 5.0/fix-net-whois-test-functionality, created. 4.0.1rc1-199-gec68feb8

Aaron Trevena ast at bestpractical.com
Fri Jun 12 06:45:21 EDT 2020


The branch, 5.0/fix-net-whois-test-functionality has been created
        at  ec68feb83147c030721e9cc5ecec5b394ea47916 (commit)

- Log -----------------------------------------------------------------
commit ec68feb83147c030721e9cc5ecec5b394ea47916
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..a63b5f1f 100644
--- a/html/RTIR/Tools/Elements/GetEmailFromIP
+++ b/html/RTIR/Tools/Elements/GetEmailFromIP
@@ -62,13 +62,20 @@ 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);
+            warn "got attr : '$attribute' / value : '$value'";
+            if (lc $attribute eq lc $field) {
+                warn "matched attribute $attribute";
+                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