commit perl-Net-SSLGlue for openSUSE:Factory
Hello community, here is the log from the commit of package perl-Net-SSLGlue for openSUSE:Factory checked in at 2015-05-02 17:44:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Net-SSLGlue (Old) and /work/SRC/openSUSE:Factory/.perl-Net-SSLGlue.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Net-SSLGlue" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Net-SSLGlue/perl-Net-SSLGlue.changes 2015-04-15 16:26:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Net-SSLGlue.new/perl-Net-SSLGlue.changes 2015-05-02 17:44:55.000000000 +0200 @@ -1,0 +2,10 @@ +Wed Apr 29 10:18:10 UTC 2015 - coolo@suse.com + +- updated to 1.054 + see /usr/share/doc/packages/perl-Net-SSLGlue/Changes + + 1.054 2015/04/28 + - if a version of libnet is detected which already supports TLS (i.e. + libnet 3.0+) warn and use this instead. + +------------------------------------------------------------------- Old: ---- Net-SSLGlue-1.053.tar.gz New: ---- Net-SSLGlue-1.054.tar.gz cpanspec.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Net-SSLGlue.spec ++++++ --- /var/tmp/diff_new_pack.vLLAkl/_old 2015-05-02 17:44:59.000000000 +0200 +++ /var/tmp/diff_new_pack.vLLAkl/_new 2015-05-02 17:44:59.000000000 +0200 @@ -17,14 +17,15 @@ Name: perl-Net-SSLGlue -Version: 1.053 +Version: 1.054 Release: 0 %define cpan_name Net-SSLGlue -Summary: add/extend SSL support for common perl modules +Summary: Add/Extend Ssl Support for Common Perl Modules License: GPL-1.0+ or Artistic-1.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Net-SSLGlue/ -Source: http://www.cpan.org/authors/id/S/SU/SULLR/%{cpan_name}-%{version}.tar.gz +Source0: http://www.cpan.org/authors/id/S/SU/SULLR/%{cpan_name}-%{version}.tar.gz +Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl ++++++ Net-SSLGlue-1.053.tar.gz -> Net-SSLGlue-1.054.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/Changes new/Net-SSLGlue-1.054/Changes --- old/Net-SSLGlue-1.053/Changes 2014-05-29 16:58:33.000000000 +0200 +++ new/Net-SSLGlue-1.054/Changes 2015-04-28 08:53:18.000000000 +0200 @@ -1,3 +1,7 @@ +1.054 2015/04/28 +- if a version of libnet is detected which already supports TLS (i.e. + libnet 3.0+) warn and use this instead. + 1.053 2014/05/28 - if current LWP is detected is use this mostly unpatched - fix Net::SSLGlue::FTP to use the same hostname when verifying the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/MANIFEST new/Net-SSLGlue-1.054/MANIFEST --- old/Net-SSLGlue-1.053/MANIFEST 2014-05-29 16:58:54.000000000 +0200 +++ new/Net-SSLGlue-1.054/MANIFEST 2015-04-28 09:24:49.000000000 +0200 @@ -22,4 +22,5 @@ t/external/03_lwp.t t/external/04_pop3.t t/external/05_ftp.t -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/META.json new/Net-SSLGlue-1.054/META.json --- old/Net-SSLGlue-1.053/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Net-SSLGlue-1.054/META.json 2015-04-28 09:24:49.000000000 +0200 @@ -0,0 +1,46 @@ +{ + "abstract" : "unknown", + "author" : [ + "unknown" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921", + "license" : [ + "unknown" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Net-SSLGlue", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "IO::Socket::SSL" : "1.19" + } + } + }, + "release_status" : "stable", + "resources" : { + "repository" : { + "url" : "https://github.com/noxxi/p5-net-sslglue" + } + }, + "version" : "1.054" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/META.yml new/Net-SSLGlue-1.054/META.yml --- old/Net-SSLGlue-1.053/META.yml 2014-05-29 16:58:54.000000000 +0200 +++ new/Net-SSLGlue-1.054/META.yml 2015-04-28 09:24:49.000000000 +0200 @@ -1,23 +1,24 @@ ---- #YAML:1.0 -name: Net-SSLGlue -version: 1.053 -abstract: ~ -author: [] -license: unknown -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 +--- +abstract: unknown +author: + - unknown build_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921' +license: unknown +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Net-SSLGlue +no_index: + directory: + - t + - inc requires: - IO::Socket::SSL: 1.19 + IO::Socket::SSL: 1.19 resources: - repository: https://github.com/noxxi/p5-net-sslglue -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.57_05 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + repository: https://github.com/noxxi/p5-net-sslglue +version: 1.054 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/lib/Net/SSLGlue/FTP.pm new/Net-SSLGlue-1.054/lib/Net/SSLGlue/FTP.pm --- old/Net-SSLGlue-1.053/lib/Net/SSLGlue/FTP.pm 2014-05-29 16:58:33.000000000 +0200 +++ new/Net-SSLGlue-1.054/lib/Net/SSLGlue/FTP.pm 2015-04-28 08:55:39.000000000 +0200 @@ -8,11 +8,20 @@ use Net::SSLGlue::Socket; use Socket 'AF_INET'; -our $VERSION = 1.001; +our $VERSION = 1.002; BEGIN { + require Net::FTP; + if (defined &Net::FTP::starttls) { + warn "using SSL support of Net::FTP $Net::FTP::VERSION instead of SSLGlue"; + goto DONE; + } + + $Net::FTP::VERSION eq '2.77' + or warn "Not tested with Net::FTP version $Net::FTP::VERSION"; + + require Net::FTP::dataconn; for my $class (qw(Net::FTP Net::FTP::dataconn)) { - eval "require $class" or die "failed to load $class"; no strict 'refs'; my $fixed; for( @{ "${class}::ISA" } ) { @@ -24,13 +33,9 @@ die "cannot replace IO::Socket::INET with Net::SSLGlue::Socket in ${class}::ISA" if ! $fixed; } - $Net::FTP::VERSION eq '2.77' - or warn "Not tested with Net::FTP version $Net::FTP::VERSION"; -} -# redefine Net::FTP::new so that it understands SSL => 1 and connects directly -# with SSL to the server -{ + # redefine Net::FTP::new so that it understands SSL => 1 and connects directly + # with SSL to the server no warnings 'redefine'; my $onew = Net::FTP->can('new'); *Net::FTP::new = sub { @@ -53,68 +58,65 @@ ${*$self}{net_ftp_tlsargs} = \%sslargs; return $self; }; -} -# add starttls method to upgrade connection to SSL: AUTH TLS -sub Net::FTP::starttls { - my $self = shift; - $self->is_ssl and croak("called starttls within SSL session"); - $self->_AUTH('TLS') == Net::FTP::CMD_OK or return; - - my $host = $self->host; - # for name verification strip port from domain:port, ipv4:port, [ipv6]:port - $host =~s{(?<!:):\d+$}{}; - - my %args = ( - SSL_verify_mode => 1, - SSL_verifycn_scheme => 'ftp', - SSL_verifycn_name => $host, - # reuse SSL session of control connection in data connections - SSL_session_cache => Net::SSLGlue::FTP::SingleSessionCache->new, - %{ ${*$self}{net_ftp_tlsargs}}, - @_ - ); + # add starttls method to upgrade connection to SSL: AUTH TLS + *Net::FTP::starttls = sub { + my $self = shift; + $self->is_ssl and croak("called starttls within SSL session"); + $self->_AUTH('TLS') == &Net::FTP::CMD_OK or return; - $self->start_SSL(%args) or return; - ${*$self}{net_ftp_tlsargs} = \%args; - $self->prot('P'); - return 1; -} + my $host = $self->host; + # for name verification strip port from domain:port, ipv4:port, [ipv6]:port + $host =~s{(?<!:):\d+$}{}; + + my %args = ( + SSL_verify_mode => 1, + SSL_verifycn_scheme => 'ftp', + SSL_verifycn_name => $host, + # reuse SSL session of control connection in data connections + SSL_session_cache => Net::SSLGlue::FTP::SingleSessionCache->new, + %{ ${*$self}{net_ftp_tlsargs}}, + @_ + ); -# add prot method to set protection level (PROT C|P) -sub Net::FTP::prot { - my ($self,$type) = @_; - $type eq 'C' or $type eq 'P' or croak("type must by C or P"); - $self->_PBSZ(0) or return; - $self->_PROT($type) or return; - ${*$self}{net_ftp_tlstype} = $type; - return 1; -} + $self->start_SSL(%args) or return; + ${*$self}{net_ftp_tlsargs} = \%args; + $self->prot('P'); + return 1; + }; -# add stoptls method to downgrade connection from SSL: CCC -sub Net::FTP::stoptls { - my $self = shift; - $self->is_ssl or croak("called stoptls outside SSL session"); - $self->_CCC() or return; - $self->stop_SSL(); - return 1; -} + # add prot method to set protection level (PROT C|P) + *Net::FTP::prot = sub { + my ($self,$type) = @_; + $type eq 'C' or $type eq 'P' or croak("type must by C or P"); + $self->_PBSZ(0) or return; + $self->_PROT($type) or return; + ${*$self}{net_ftp_tlstype} = $type; + return 1; + }; -# add EPSV for new style passive mode (incl. IPv6) -sub Net::FTP::epsv { - my $self = shift; - @_ and croak 'usage: $ftp->epsv()'; - delete ${*$self}{net_ftp_intern_port}; - - $self->_EPSV && $self->message =~ m{\(([\x33-\x7e])\1\1(\d+)\1\)} - ? ${*$self}{'net_ftp_pasv'} = [ $self->peerhost, $2 ] - : undef; -} + # add stoptls method to downgrade connection from SSL: CCC + *Net::FTP::stoptls = sub { + my $self = shift; + $self->is_ssl or croak("called stoptls outside SSL session"); + $self->_CCC() or return; + $self->stop_SSL(); + return 1; + }; -# redefine PASV so that it uses EPSV on IPv6 -# also net_ftp_pasv contains now the parsed [ip,port] -{ - no warnings 'redefine'; + # add EPSV for new style passive mode (incl. IPv6) + *Net::FTP::epsv = sub { + my $self = shift; + @_ and croak 'usage: $ftp->epsv()'; + delete ${*$self}{net_ftp_intern_port}; + + $self->_EPSV && $self->message =~ m{\(([\x33-\x7e])\1\1(\d+)\1\)} + ? ${*$self}{'net_ftp_pasv'} = [ $self->peerhost, $2 ] + : undef; + }; + + # redefine PASV so that it uses EPSV on IPv6 + # also net_ftp_pasv contains now the parsed [ip,port] *Net::FTP::pasv = sub { my $self = shift; @_ and croak 'usage: $ftp->port()'; @@ -129,62 +131,56 @@ } return; }; -} -# add EPRT for new style passive mode (incl. IPv6) -sub Net::FTP::eprt { - @_ == 1 || @_ == 2 or croak 'usage: $self->eprt([PORT])'; - return _eprt('EPRT',@_); -} + # add EPRT for new style passive mode (incl. IPv6) + *Net::FTP::eprt = sub { + @_ == 1 || @_ == 2 or croak 'usage: $self->eprt([PORT])'; + return _eprt('EPRT',@_); + }; -# redefine PORT to use EPRT for IPv6 -{ - no warnings 'redefine'; + # redefine PORT to use EPRT for IPv6 *Net::FTP::port = sub { @_ == 1 || @_ == 2 or croak 'usage: $self->port([PORT])'; return _eprt('PORT',@_); }; -} -sub _eprt { - my ($cmd,$self,$port) = @_; - delete ${*$self}{net_ftp_intern_port}; - unless ($port) { - my $listen = ${*$self}{net_ftp_listen} ||= Net::SSLGlue::Socket->new( - Listen => 1, - Timeout => $self->timeout, - LocalAddr => $self->sockhost, - ); - ${*$self}{net_ftp_intern_port} = 1; - my $fam = ($listen->sockdomain == AF_INET) ? 1:2; - if ( $cmd eq 'EPRT' || $fam == 2 ) { - $port = "|$fam|".$listen->sockhost."|".$listen->sockport."|"; - $cmd = 'EPRT'; - } else { - my $p = $listen->sockport; - $port = join(',',split(m{\.},$listen->sockhost),$p >> 8,$p & 0xff); + sub _eprt { + my ($cmd,$self,$port) = @_; + delete ${*$self}{net_ftp_intern_port}; + unless ($port) { + my $listen = ${*$self}{net_ftp_listen} ||= Net::SSLGlue::Socket->new( + Listen => 1, + Timeout => $self->timeout, + LocalAddr => $self->sockhost, + ); + ${*$self}{net_ftp_intern_port} = 1; + my $fam = ($listen->sockdomain == AF_INET) ? 1:2; + if ( $cmd eq 'EPRT' || $fam == 2 ) { + $port = "|$fam|".$listen->sockhost."|".$listen->sockport."|"; + $cmd = 'EPRT'; + } else { + my $p = $listen->sockport; + $port = join(',',split(m{\.},$listen->sockhost),$p >> 8,$p & 0xff); + } } + my $ok = $cmd eq 'EPRT' ? $self->_EPRT($port) : $self->_PORT($port); + ${*$self}{net_ftp_port} = $port if $ok; + return $ok; } - my $ok = $cmd eq 'EPRT' ? $self->_EPRT($port) : $self->_PORT($port); - ${*$self}{net_ftp_port} = $port if $ok; - return $ok; -} -for my $cmd (qw(PBSZ PROT CCC EPRT EPSV)) { - no strict 'refs'; - *{"Net::FTP::_$cmd"} = sub { - shift->command("$cmd @_")->response() == Net::FTP::CMD_OK + for my $cmd (qw(PBSZ PROT CCC EPRT EPSV)) { + no strict 'refs'; + *{"Net::FTP::_$cmd"} = sub { + shift->command("$cmd @_")->response() == &Net::FTP::CMD_OK + } } -} -# redefine _dataconn to -# - support IPv6 -# - upgrade data connection to SSL if PROT P -{ - no warnings 'redefine'; + # redefine _dataconn to + # - support IPv6 + # - upgrade data connection to SSL if PROT P *Net::FTP::_dataconn = sub { my $self = shift; my $pkg = "Net::FTP::" . $self->type; @@ -223,6 +219,9 @@ ${*$conn}{net_ftp_blksize} = ${*$self}{net_ftp_blksize}; return $conn; }; + + DONE: + 1; } { @@ -291,8 +290,7 @@ =item starttls If the connection is not yet SSLified it will issue the "AUTH TLS" command and -change the object, so that SSL will now be used. The usual C<SSL_*> parameter of -L<IO::Socket::SSL> will be given. +change the object, so that SSL will now be used. =item peer_certificate ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/lib/Net/SSLGlue/LDAP.pm new/Net-SSLGlue-1.054/lib/Net/SSLGlue/LDAP.pm --- old/Net-SSLGlue-1.053/lib/Net/SSLGlue/LDAP.pm 2012-01-31 07:50:58.000000000 +0100 +++ new/Net-SSLGlue-1.054/lib/Net/SSLGlue/LDAP.pm 2015-04-28 08:22:42.000000000 +0200 @@ -12,16 +12,16 @@ # Net::LDAP::_SSL_context_init_args my $old = defined &Net::LDAP::_SSL_context_init_args - && \&Net::LDAP::_SSL_context_init_args - || die "cannot find Net::LDAP::_SSL_context_init_args"; + && \&Net::LDAP::_SSL_context_init_args + || die "cannot find Net::LDAP::_SSL_context_init_args"; no warnings 'redefine'; *Net::LDAP::_SSL_context_init_args = sub { - my %arg = $old->(@_); - $arg{SSL_verifycn_scheme} ||= 'ldap' if $arg{SSL_verify_mode}; - while ( my ($k,$v) = each %SSLopts ) { - $arg{$k} = $v; - } - return %arg; + my %arg = $old->(@_); + $arg{SSL_verifycn_scheme} ||= 'ldap' if $arg{SSL_verify_mode}; + while ( my ($k,$v) = each %SSLopts ) { + $arg{$k} = $v; + } + return %arg; }; 1; @@ -32,10 +32,10 @@ =head1 SYNOPSIS - use Net::SSLGlue::LDAP; - local %Net::SSLGlue::LDAP = ( SSL_verifycn_name => $hostname_in_cert ); - my $ldap = Net::LDAP->new( $hostname, capath => ... ); - $ldap->start_tls; + use Net::SSLGlue::LDAP; + local %Net::SSLGlue::LDAP = ( SSL_verifycn_name => $hostname_in_cert ); + my $ldap = Net::LDAP->new( $hostname, capath => ... ); + $ldap->start_tls; =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/lib/Net/SSLGlue/LWP.pm new/Net-SSLGlue-1.054/lib/Net/SSLGlue/LWP.pm --- old/Net-SSLGlue-1.053/lib/Net/SSLGlue/LWP.pm 2014-05-20 23:36:08.000000000 +0200 +++ new/Net-SSLGlue-1.054/lib/Net/SSLGlue/LWP.pm 2015-04-28 08:23:10.000000000 +0200 @@ -27,11 +27,11 @@ require Net::HTTPS; if ( ( my $oc = $Net::HTTPS::SSL_SOCKET_CLASS ) ne $need ) { - # was probably loaded before, change ISA - grep { s{^\Q$oc\E$}{$need} } @Net::HTTPS::ISA + # was probably loaded before, change ISA + grep { s{^\Q$oc\E$}{$need} } @Net::HTTPS::ISA } die "cannot force $need into Net::HTTPS" - if $Net::HTTPS::SSL_SOCKET_CLASS ne $need; + if $Net::HTTPS::SSL_SOCKET_CLASS ne $need; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/lib/Net/SSLGlue/POP3.pm new/Net-SSLGlue-1.054/lib/Net/SSLGlue/POP3.pm --- old/Net-SSLGlue-1.053/lib/Net/SSLGlue/POP3.pm 2013-08-01 22:56:47.000000000 +0200 +++ new/Net-SSLGlue-1.054/lib/Net/SSLGlue/POP3.pm 2015-04-28 08:51:05.000000000 +0200 @@ -4,42 +4,55 @@ package Net::SSLGlue::POP3; use IO::Socket::SSL 1.19; use Net::POP3; -our $VERSION = 0.91; +our $VERSION = 0.911; -############################################################################## -# mix starttls method into Net::POP3 which on SSL handshake success -# upgrades the class to Net::POP3::_SSLified -############################################################################## -sub Net::POP3::starttls { +my $DONT; +BEGIN { + if (defined &Net::POP3::starttls) { + warn "using SSL support of Net::POP3 $Net::POP3::VERSION instead of SSLGlue"; + $DONT = 1; + goto DONE; + } + + ############################################################################## + # mix starttls method into Net::POP3 which on SSL handshake success + # upgrades the class to Net::SSLGlue::POP3::_SSLified + ############################################################################## + *Net::POP3::starttls = sub { my $self = shift; $self->_STLS or return; my $host = $self->host; # for name verification strip port from domain:port, ipv4:port, [ipv6]:port $host =~s{(?<!:):\d+$}{}; - Net::POP3::_SSLified->start_SSL( $self, - SSL_verify_mode => 1, - SSL_verifycn_scheme => 'pop3', - SSL_verifycn_name => $host, - @_ + Net::SSLGlue::POP3::_SSLified->start_SSL( $self, + SSL_verify_mode => 1, + SSL_verifycn_scheme => 'pop3', + SSL_verifycn_name => $host, + @_ ) or return; -} -sub Net::POP3::_STLS { + }; + + *Net::POP3::_STLS = sub { shift->command("STLS")->response() == Net::POP3::CMD_OK -} + }; -no warnings 'redefine'; -my $old_new = \&Net::POP3::new; -*Net::POP3::new = sub { + no warnings 'redefine'; + my $old_new = \&Net::POP3::new; + *Net::POP3::new = sub { my $class = shift; my %arg = @_ % 2 == 0 ? @_ : ( Host => shift,@_ ); if ( delete $arg{SSL} ) { - $arg{Port} ||= 995; - return Net::POP3::_SSLified->new(%arg); + $arg{Port} ||= 995; + return Net::SSLGlue::POP3::_SSLified->new(%arg); } else { - return $old_new->($class,%arg); + return $old_new->($class,%arg); } -}; + }; + + DONE: + 1; +} ############################################################################## # Socket class derived from IO::Socket::SSL @@ -47,25 +60,29 @@ ############################################################################## our %SSLopts; { - package Net::POP3::_SSL_Socket; - our @ISA = 'IO::Socket::SSL'; - sub configure_SSL { - my ($self,$arg_hash) = @_; - - # set per default strict certificate verification - $arg_hash->{SSL_verify_mode} = 1 - if ! exists $arg_hash->{SSL_verify_mode}; - $arg_hash->{SSL_verifycn_scheme} = 'pop3' - if ! exists $arg_hash->{SSL_verifycn_scheme}; - $arg_hash->{SSL_verifycn_name} = $self->host - if ! exists $arg_hash->{SSL_verifycn_name}; - - # force keys from %SSLopts - while ( my ($k,$v) = each %SSLopts ) { - $arg_hash->{$k} = $v; - } - return $self->SUPER::configure_SSL($arg_hash) + package Net::SSLGlue::POP3::_SSL_Socket; + goto DONE if $DONT; + our @ISA = 'IO::Socket::SSL'; + *configure_SSL = sub { + my ($self,$arg_hash) = @_; + + # set per default strict certificate verification + $arg_hash->{SSL_verify_mode} = 1 + if ! exists $arg_hash->{SSL_verify_mode}; + $arg_hash->{SSL_verifycn_scheme} = 'pop3' + if ! exists $arg_hash->{SSL_verifycn_scheme}; + $arg_hash->{SSL_verifycn_name} = $self->host + if ! exists $arg_hash->{SSL_verifycn_name}; + + # force keys from %SSLopts + while ( my ($k,$v) = each %SSLopts ) { + $arg_hash->{$k} = $v; } + return $self->SUPER::configure_SSL($arg_hash) + }; + + DONE: + 1; } @@ -74,45 +91,48 @@ # this talks SSL to the peer ############################################################################## { - package Net::POP3::_SSLified; - use Carp 'croak'; + package Net::SSLGlue::POP3::_SSLified; + use Carp 'croak'; + goto DONE if $DONT; + + # deriving does not work because we need to replace a superclass + # from Net::POP3, so just copy the class into the new one and then + # change it + + # copy subs + for ( keys %{Net::POP3::} ) { + no strict 'refs'; + *{$_} = \&{ "Net::POP3::$_" } if defined &{ "Net::POP3::$_" }; + } + + # copy + fix @ISA + our @ISA = @Net::POP3::ISA; + grep { s{^IO::Socket::INET$}{Net::SSLGlue::POP3::_SSL_Socket} } @ISA + or die "cannot find and replace IO::Socket::INET superclass"; + + # we are already sslified + no warnings 'redefine'; + *starttls = sub { croak "have already TLS\n" }; - # deriving does not work because we need to replace a superclass - # from Net::POP3, so just copy the class into the new one and then - # change it - - # copy subs - for ( keys %{Net::POP3::} ) { - no strict 'refs'; - eval { *{$Net::POP3::{$_}} && *{$Net::POP3::{$_}}{CODE} } or next; - *{$_} = \&{ "Net::POP3::$_" }; - } + my $old_new = \&new; + *new = sub { + my $class = shift; + my %arg = @_ % 2 == 0 ? @_ : ( Host => shift,@_ ); + local %SSLopts; + $SSLopts{$_} = delete $arg{$_} for ( grep { /^SSL_/ } keys %arg ); + return $old_new->($class,%arg); + }; + + # Net::Cmd getline uses select, but this is not sufficient with SSL + # note that this does no EBCDIC etc conversions + *getline = sub { + my $self = shift; + # skip Net::POP3 getline and go directly to IO::Socket::SSL + return $self->IO::Socket::SSL::getline(@_); + }; - # copy + fix @ISA - our @ISA = @Net::POP3::ISA; - grep { s{^IO::Socket::INET$}{Net::POP3::_SSL_Socket} } @ISA - or die "cannot find and replace IO::Socket::INET superclass"; - - # we are already sslified - no warnings 'redefine'; - sub starttls { croak "have already TLS\n" } - - my $old_new = \&new; - *Net::POP3::_SSLified::new = sub { - my $class = shift; - my %arg = @_ % 2 == 0 ? @_ : ( Host => shift,@_ ); - local %SSLopts; - $SSLopts{$_} = delete $arg{$_} for ( grep { /^SSL_/ } keys %arg ); - return $old_new->($class,%arg); - }; - - # Net::Cmd getline uses select, but this is not sufficient with SSL - # note that this does no EBCDIC etc conversions - *Net::POP3::_SSLified::getline = sub { - my $self = shift; - # skip Net::POP3 getline and go directly to IO::Socket::SSL - return $self->IO::Socket::SSL::getline(@_); - }; + DONE: + 1; } 1; @@ -123,14 +143,14 @@ =head1 SYNOPSIS - use Net::SSLGlue::POP3; - my $pop3s = Net::POP3->new( $host, - SSL => 1, - SSL_ca_path => ... - ); + use Net::SSLGlue::POP3; + my $pop3s = Net::POP3->new( $host, + SSL => 1, + SSL_ca_path => ... + ); - my $pop3 = Net::POP3->new( $host ); - $pop3->starttls( SSL_ca_path => ... ); + my $pop3 = Net::POP3->new( $host ); + $pop3->starttls( SSL_ca_path => ... ); =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/lib/Net/SSLGlue/SMTP.pm new/Net-SSLGlue-1.054/lib/Net/SSLGlue/SMTP.pm --- old/Net-SSLGlue-1.053/lib/Net/SSLGlue/SMTP.pm 2012-01-30 12:17:27.000000000 +0100 +++ new/Net-SSLGlue-1.054/lib/Net/SSLGlue/SMTP.pm 2015-04-28 08:51:05.000000000 +0200 @@ -4,52 +4,65 @@ package Net::SSLGlue::SMTP; use IO::Socket::SSL 1.19; use Net::SMTP; -our $VERSION = 1.0; +our $VERSION = 1.001; -############################################################################## -# mix starttls method into Net::SMTP which on SSL handshake success -# upgrades the class to Net::SMTP::_SSLified -############################################################################## -sub Net::SMTP::starttls { +my $DONT; +BEGIN { + if (defined &Net::SMTP::starttls) { + warn "using SSL support of Net::SMTP $Net::SMTP::VERSION instead of SSLGlue"; + $DONT = 1; + goto DONE; + } + + ############################################################################## + # mix starttls method into Net::SMTP which on SSL handshake success + # upgrades the class to Net::SSLGlue::SMTP::_SSLified + ############################################################################## + *Net::SMTP::starttls = sub { my $self = shift; $self->_STARTTLS or return; my $host = $self->host; # for name verification strip port from domain:port, ipv4:port, [ipv6]:port $host =~s{(?<!:):\d+$}{}; - Net::SMTP::_SSLified->start_SSL( $self, - SSL_verify_mode => 1, - SSL_verifycn_scheme => 'smtp', - SSL_verifycn_name => $host, - @_ + Net::SSLGlue::SMTP::_SSLified->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 { + }; + + *Net::SMTP::_STARTTLS = sub { shift->command("STARTTLS")->response() == Net::SMTP::CMD_OK -} + }; -no warnings 'redefine'; -my $old_new = \&Net::SMTP::new; -*Net::SMTP::new = sub { + no warnings 'redefine'; + my $old_new = \&Net::SMTP::new; + *Net::SMTP::new = sub { my $class = shift; my %arg = @_ % 2 == 0 ? @_ : ( Host => shift,@_ ); if ( delete $arg{SSL} ) { - $arg{Port} ||= 465; - return Net::SMTP::_SSLified->new(%arg); + $arg{Port} ||= 465; + return Net::SSLGlue::SMTP::_SSLified->new(%arg); } else { - return $old_new->($class,%arg); + return $old_new->($class,%arg); } -}; + }; -my $old_hello = \&Net::SMTP::hello; -*Net::SMTP::hello = sub { + my $old_hello = \&Net::SMTP::hello; + *Net::SMTP::hello = sub { my ($self,$domain) = @_; ${*$self}{net_smtp_hello_domain} = $domain if $domain; goto &$old_hello; -}; + }; + + DONE: + 1; +} ############################################################################## # Socket class derived from IO::Socket::SSL @@ -57,63 +70,71 @@ ############################################################################## our %SSLopts; { - package Net::SMTP::_SSL_Socket; - our @ISA = 'IO::Socket::SSL'; - sub configure_SSL { - my ($self,$arg_hash) = @_; - - # set per default strict certificate verification - $arg_hash->{SSL_verify_mode} = 1 - 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->host - if ! exists $arg_hash->{SSL_verifycn_name}; - - # force keys from %SSLopts - while ( my ($k,$v) = each %SSLopts ) { - $arg_hash->{$k} = $v; - } - return $self->SUPER::configure_SSL($arg_hash) + package Net::SSLGlue::SMTP::_SSL_Socket; + goto DONE if $DONT; + our @ISA = 'IO::Socket::SSL'; + *configure_SSL = sub { + my ($self,$arg_hash) = @_; + + # set per default strict certificate verification + $arg_hash->{SSL_verify_mode} = 1 + 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->host + if ! exists $arg_hash->{SSL_verifycn_name}; + + # force keys from %SSLopts + while ( my ($k,$v) = each %SSLopts ) { + $arg_hash->{$k} = $v; } + return $self->SUPER::configure_SSL($arg_hash) + }; + + DONE: + 1; } ############################################################################## -# Net::SMTP derived from Net::SMTP::_SSL_Socket instead of IO::Socket::INET +# Net::SMTP derived from Net::SSLGlue::SMTP::_SSL_Socket instead of IO::Socket::INET # this talks SSL to the peer ############################################################################## { - package Net::SMTP::_SSLified; - use Carp 'croak'; + package Net::SSLGlue::SMTP::_SSLified; + use Carp 'croak'; + goto DONE if $DONT; + + # deriving does not work because we need to replace a superclass + # from Net::SMTP, so just copy the class into the new one and then + # change it + + # copy subs + for ( keys %{Net::SMTP::} ) { + no strict 'refs'; + *{$_} = \&{ "Net::SMTP::$_" } if defined &{ "Net::SMTP::$_" }; + } + + # copy + fix @ISA + our @ISA = @Net::SMTP::ISA; + grep { s{^IO::Socket::INET$}{Net::SSLGlue::SMTP::_SSL_Socket} } @ISA + or die "cannot find and replace IO::Socket::INET superclass"; + + # we are already sslified + no warnings 'redefine'; + *starttls = sub { croak "have already TLS\n" }; - # deriving does not work because we need to replace a superclass - # from Net::SMTP, so just copy the class into the new one and then - # change it - - # copy subs - for ( keys %{Net::SMTP::} ) { - no strict 'refs'; - *{$_} = \&{ "Net::SMTP::$_" } if *{$Net::SMTP::{$_}}{CODE}; - } + my $old_new = \&new; + *new = sub { + my $class = shift; + my %arg = @_ % 2 == 0 ? @_ : ( Host => shift,@_ ); + local %SSLopts; + $SSLopts{$_} = delete $arg{$_} for ( grep { /^SSL_/ } keys %arg ); + return $old_new->($class,%arg); + }; - # copy + fix @ISA - our @ISA = @Net::SMTP::ISA; - grep { s{^IO::Socket::INET$}{Net::SMTP::_SSL_Socket} } @ISA - or die "cannot find and replace IO::Socket::INET superclass"; - - # we are already sslified - no warnings 'redefine'; - sub starttls { croak "have already TLS\n" } - - my $old_new = \&new; - *Net::SMTP::_SSLified::new = sub { - my $class = shift; - my %arg = @_ % 2 == 0 ? @_ : ( Host => shift,@_ ); - local %SSLopts; - $SSLopts{$_} = delete $arg{$_} for ( grep { /^SSL_/ } keys %arg ); - return $old_new->($class,%arg); - }; + DONE: + 1; } 1; @@ -124,14 +145,14 @@ =head1 SYNOPSIS - use Net::SSLGlue::SMTP; - my $smtp_ssl = Net::SMTP->new( $host, - SSL => 1, - SSL_ca_path => ... - ); + use Net::SSLGlue::SMTP; + my $smtp_ssl = Net::SMTP->new( $host, + SSL => 1, + SSL_ca_path => ... + ); - my $smtp_plain = Net::SMTP->new( $host ); - $smtp_plain->starttls( SSL_ca_path => ... ); + my $smtp_plain = Net::SMTP->new( $host ); + $smtp_plain->starttls( SSL_ca_path => ... ); =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/lib/Net/SSLGlue.pm new/Net-SSLGlue-1.054/lib/Net/SSLGlue.pm --- old/Net-SSLGlue-1.053/lib/Net/SSLGlue.pm 2014-05-20 19:03:05.000000000 +0200 +++ new/Net-SSLGlue-1.054/lib/Net/SSLGlue.pm 2015-04-28 08:02:38.000000000 +0200 @@ -1,5 +1,5 @@ package Net::SSLGlue; -our $VERSION = '1.053'; +our $VERSION = '1.054'; =head1 NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/t/external/03_lwp.t new/Net-SSLGlue-1.054/t/external/03_lwp.t --- old/Net-SSLGlue-1.053/t/external/03_lwp.t 2014-05-28 22:45:12.000000000 +0200 +++ new/Net-SSLGlue-1.054/t/external/03_lwp.t 2015-04-28 08:57:38.000000000 +0200 @@ -15,7 +15,7 @@ use LWP::Simple; my $goodhost = 'google.de'; -my $badhost = 'www.digitalmarketer.com'; +my $badhost = 'badcert.maulwuff.de'; my $capath = '/etc/ssl/certs/'; # unix? -d $capath or do { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-SSLGlue-1.053/t/external/05_ftp.t new/Net-SSLGlue-1.054/t/external/05_ftp.t --- old/Net-SSLGlue-1.053/t/external/05_ftp.t 2014-05-29 16:58:33.000000000 +0200 +++ new/Net-SSLGlue-1.054/t/external/05_ftp.t 2015-04-28 08:49:57.000000000 +0200 @@ -67,9 +67,9 @@ ok(~~$ftp->ls,"directory listing clear"); # then TLS upgrade inside plain connection -$ftp = Net::FTP->new($server, Passive => 1, Debug => $debug); +$ftp = Net::FTP->new($server, Passive => 1, Debug => $debug, %sslargs); ok($ftp,"ftp plain connect $server"); -my $ok = $ftp->starttls(%sslargs); +my $ok = $ftp->starttls(); ok($ok,"ssl upgrade"); $ftp->login("anonymous",'net-sslglue-ftp@test.perl') or die "login to $server failed"; ++++++ cpanspec.yml ++++++ --- #description_paragraphs: 3 #no_testing: broken upstream #sources: # - source1 # - source2 #patches: # foo.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ #post_prep: |- # hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'` # sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL #post_install: |- # sed on %{name}.files #license: SUSE-NonFree #skip_noarch: 1 #custom_build: |- #./Build build flags=%{?_smp_mflags} --myflag #custom_test: |- #startserver && make test #ignore_requires: Bizarre::Module
participants (1)
-
root@hilbert.suse.de