Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use canonical string representation for IPv6 addresses #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/Mail/Milter/Authentication/Handler.pm
Original file line number Diff line number Diff line change
@@ -607,7 +607,7 @@ sub remap_connect_callback {
}
else {
$ip = $ip_remap->{ip};
$self->dbgout( 'RemappedConnect', $self->{'raw_ip_object'}->ip() . ' > ' . $ip->ip(), LOG_DEBUG );
$self->dbgout( 'RemappedConnect', $self->{'raw_ip_object'}->short() . ' > ' . $ip->short(), LOG_DEBUG );
}
}
$self->{'ip_object'} = $ip;
@@ -656,7 +656,7 @@ sub top_connect_callback {
$self->set_alarm( $timeout );
}

$self->dbgout( 'ConnectFrom', $ip->ip(), LOG_DEBUG );
$self->dbgout( 'ConnectFrom', $ip->short(), LOG_DEBUG );

my $callbacks = $self->get_callbacks( 'connect' );
foreach my $handler ( @$callbacks ) {
@@ -706,7 +706,7 @@ sub remap_helo_callback {
if ( $self->{'ip_object'}->ip() ne $ip_remap->{ip}->ip() ) {
# The mapped IP has been changed based on the HELO host received
$self->{'ip_object'} = $ip;
$self->dbgout( 'RemappedConnectHELO', $self->{'ip_object'}->ip() . ' > ' . $ip->ip(), LOG_DEBUG );
$self->dbgout( 'RemappedConnectHELO', $self->{'ip_object'}->short() . ' > ' . $ip->short(), LOG_DEBUG );
}
$helo_host = $ip_remap->{helo};
$self->dbgout( 'RemappedHELO', $self->{'raw_helo_name'} . ' > ' . $helo_host, LOG_DEBUG );
@@ -2081,7 +2081,7 @@ Return the ip address of the current connection.
sub ip_address {
my ($self) = @_;
my $top_handler = $self->get_top_handler();
return $top_handler->{'ip_object'}->ip();
return $top_handler->{'ip_object'}->short();
}


2 changes: 1 addition & 1 deletion lib/Mail/Milter/Authentication/Handler/LocalIP.pm
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ sub grafana_rows {

sub is_local_ip_address {
my ( $self, $ip ) = @_;
my $ip_address = $ip->ip();
my $ip_address = $ip->short();
my $ip_type = $ip->iptype();
my $type_map = {
'PRIVATE' => 1,
2 changes: 1 addition & 1 deletion lib/Mail/Milter/Authentication/Handler/Logger.pm
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ sub connect_callback {
my $config = $self->handler_config();
return if ! $config->{connect};
$self->dbgout( 'Logger', 'Connection host: ' . $hostname, LOG_INFO );
$self->dbgout( 'Logger', 'Connection IP: ' . $ip->ip(), LOG_INFO );
$self->dbgout( 'Logger', 'Connection IP: ' . $ip->short(), LOG_INFO );
return;
}

2 changes: 1 addition & 1 deletion lib/Mail/Milter/Authentication/Protocol/SMTP.pm
Original file line number Diff line number Diff line change
@@ -449,7 +449,7 @@ sub smtp_command_mailfrom {
$handler->remap_connect_callback( $host, Net::IP->new( $ip ) );
$handler->remap_helo_callback( $helo );

$self->logdebug( "Inbound IP Address " . $handler->{'ip_object'}->ip() );
$self->logdebug( "Inbound IP Address " . $handler->{'ip_object'}->short() );
$returncode = $handler->top_connect_callback( $host, $handler->{'ip_object'} );
if ( $returncode == SMFIS_CONTINUE ) {
$returncode = $handler->top_helo_callback( $handler->{'helo_name'} );