diff --git a/Changes b/Changes index db2cdfe..f53914c 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,17 @@ +1.01 2012/01/31 +Net::SSLGlue::LDAP as wrongly named Net::DNSGlue::LDAP + +1.0 2012/01/30 +Net::SSLGlue::SMTP: save hello domain from last hello call, so that the +hello after the starttls uses the same domain argument. +Thanks to zaucker[AT]oetiker[DOT]ch for reporting problem. + +0.9 2012/01/24 +Net::SSLGlue::SMTP: fixed stripping of port from host/ip for name +verification. Added hello after successful starttls. Extented tests +to check, if we can actually talk after starttls. +Thanks to zaucker[AT]oetiker[DOT]ch for reporting problem. + 0.8 2011/07/17 fixed wrong position for include encode_base64 and uri_unescape in *::LWP. Thanks to mtelle[AT]kamp-dsl[DOT]de for reporting diff --git a/META.yml b/META.yml index 4f12db3..5296399 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Net-SSLGlue -version: 0.8 +version: 1.01 abstract: ~ author: [] license: unknown @@ -15,7 +15,7 @@ directory: - t - inc -generated_by: ExtUtils::MakeMaker version 6.55_02 +generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 diff --git a/lib/Net/SSLGlue/LDAP.pm b/lib/Net/SSLGlue/LDAP.pm index f969496..e26f26a 100644 --- a/lib/Net/SSLGlue/LDAP.pm +++ b/lib/Net/SSLGlue/LDAP.pm @@ -1,7 +1,7 @@ use strict; use warnings; -package Net::DNSGlue::LDAP; -our $VERSION = 0.2; +package Net::SSLGlue::LDAP; +our $VERSION = '1.01'; use Net::LDAP; use IO::Socket::SSL 1.19; diff --git a/lib/Net/SSLGlue/SMTP.pm b/lib/Net/SSLGlue/SMTP.pm index 43c23ec..c5fb9dd 100644 --- a/lib/Net/SSLGlue/SMTP.pm +++ b/lib/Net/SSLGlue/SMTP.pm @@ -4,7 +4,7 @@ package Net::SSLGlue::SMTP; use IO::Socket::SSL 1.19; use Net::SMTP; -our $VERSION = 0.7; +our $VERSION = 1.0; ############################################################################## # mix starttls method into Net::SMTP which on SSL handshake success @@ -13,16 +13,19 @@ sub Net::SMTP::starttls { my $self = shift; $self->_STARTTLS or return; - my $host = ${*$self}{net_smtp_host}; + my $host = $self->host; # for name verification strip port from domain:port, ipv4:port, [ipv6]:port - $host =~s{^(?:[^:]+|.+\])\:(\d+)$}{}; + $host =~s{(?start_SSL( $self, SSL_verify_mode => 1, SSL_verifycn_scheme => 'smtp', SSL_verifycn_name => $host, @_ - ); + ) or return; + + # another hello after starttls to read new ESMTP capabilities + return $self->hello(${*$self}{net_smtp_hello_domain}); } sub Net::SMTP::_STARTTLS { shift->command("STARTTLS")->response() == Net::SMTP::CMD_OK @@ -41,6 +44,13 @@ } }; +my $old_hello = \&Net::SMTP::hello; +*Net::SMTP::hello = sub { + my ($self,$domain) = @_; + ${*$self}{net_smtp_hello_domain} = $domain if $domain; + goto &$old_hello; +}; + ############################################################################## # Socket class derived from IO::Socket::SSL # strict certificate verification per default @@ -57,7 +67,7 @@ if ! exists $arg_hash->{SSL_verify_mode}; $arg_hash->{SSL_verifycn_scheme} = 'smtp' if ! exists $arg_hash->{SSL_verifycn_scheme}; - $arg_hash->{SSL_verifycn_name} = ${*$self}{net_smtp_host} + $arg_hash->{SSL_verifycn_name} = $self->host if ! exists $arg_hash->{SSL_verifycn_name}; # force keys from %SSLopts diff --git a/lib/Net/SSLGlue.pm b/lib/Net/SSLGlue.pm index 7ac03ec..ca34c7d 100644 --- a/lib/Net/SSLGlue.pm +++ b/lib/Net/SSLGlue.pm @@ -1,5 +1,5 @@ package Net::SSLGlue; -our $VERSION = 0.8; +our $VERSION = '1.01'; =head1 NAME diff --git a/t/external/02_smtp.t b/t/external/02_smtp.t index 8f3efb2..4edad8d 100644 --- a/t/external/02_smtp.t +++ b/t/external/02_smtp.t @@ -33,7 +33,7 @@ SSL_ca_path => $capath, SSL_verify_mode => 1, SSL_verifycn_scheme => 'smtp' - ) or do { +) or do { print "1..0 # mail.gmx.net:465 not reachable with SSL\n"; exit }; @@ -46,12 +46,12 @@ SSL_ca_path => $capath, SSL_verify_mode => 1, SSL_verifycn_scheme => 'smtp' - ) and do { +) and do { print "1..0 # mail.gmx.de:465 reachable with SSL\n"; exit }; -print "1..5\n"; +print "1..6\n"; # first direct SSL my $smtp = Net::SMTP->new( 'mail.gmx.net', @@ -64,6 +64,8 @@ $smtp = Net::SMTP->new( 'mail.gmx.net' ); my $ok = $smtp->starttls( SSL_ca_path => $capath ); print $ok ? "ok\n" : "not ok # smtp starttls mail.gmx.net\n"; +# check that we can talk on connection +print $smtp->quit ? "ok\n": "not ok # quit failed\n"; # against wrong host should fail $smtp = Net::SMTP->new( 'mail.gmx.de' ); # should succeed