Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
On Thu, 2017-06-01 at 07:50 +0900, Junio C Hamano wrote: > Dennis Kaarsemakerwrites: > > > Second ping. This problem is not going away, so if this solution is not > > acceptable, I'd like to know what needs to be improved. > > Perhaps you needed to actually test with older installation that > people have, it seems, between pings. Immediately after this was > merged to 'master', we start getting bug reports X-<. > > Eric Biggers' message > > https://public-inbox.org/git/<20170531222455.gd72...@gmail.com>; > > seems to indicate that we should cut off at 3.01 not 1.28? > > Thanks. Apologies for that. The version numbering of libnet is *weird*. The libnet version this was fixed in *is* 1.28, but the Net::SMTP module in libnet version 1.28 has version 2.33. I did test with some older perl versions, but not far enough back it seems :( D.
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Hi, Jun 01, 2017 at 07:39:16AM +0900, Junio C Hamano wrote: > Jonathan Niederwrites: >> This broke git send-email for me. The error message is >> >> Can't locate object method "starttls" via package "Net::SMTP" at >> /usr/lib/git-core/git-send-email line 1410. >> >> Is 1.28 the right minimum version? >> >> $ perl -e 'require Net::SMTP; print version->parse($Net::SMTP::VERSION); >> print "\n"' [...] >> $ grep starttls /usr/share/perl/5.18.2/Net/SMTP.pm >> $ dpkg-query -W perl >> perl5.18.2-2ubuntu1.1 > > Thanks. > > Let's revert the merge for now until we know (this time for certain) > what the minimum version is. Thanks. I just sent http://public-inbox.org/git/20170531224415.gc81...@aiede.mtv.corp.google.com in response to another thread. That uses 3.01 as minimum version, since it is the minimum version imported to core perl with starttls support. I haven't tried testing with historical Net::SMTP versions, though. Is there a git repository available with all Net::SMTP versions from CPAN, or is https://perl5.git.perl.org/perl.git as good as it gets? Regards, Jonathan
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Dennis Kaarsemakerwrites: > Second ping. This problem is not going away, so if this solution is not > acceptable, I'd like to know what needs to be improved. Perhaps you needed to actually test with older installation that people have, it seems, between pings. Immediately after this was merged to 'master', we start getting bug reports X-<. Eric Biggers' message https://public-inbox.org/git/<20170531222455.gd72...@gmail.com> seems to indicate that we should cut off at 3.01 not 1.28? Thanks. > On Thu, 2017-05-04 at 09:01 +0200, Dennis Kaarsemaker wrote: >> Ping. It's a little over a month since I sent this, but I haven't seen >> any comments. Is this commit good to go? >> >> On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote: >> > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine >> > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 >> > isn't that old yet, keep the old code in place and use it when >> > necessary. >> > ... >> > diff --git a/git-send-email.perl b/git-send-email.perl >> > index eea0a517f7..0d90439d9a 100755 >> > --- a/git-send-email.perl >> > +++ b/git-send-email.perl >> > @@ -1353,10 +1353,12 @@ EOF >> >die __("The required SMTP server is not properly >> > defined.") >> >} >> > >> > + require Net::SMTP; >> > + my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < >> > version->parse("1.28");
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Jonathan Niederwrites: > Dennis Kaarsemaker wrote: > >> Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine >> since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 >> isn't that old yet, keep the old code in place and use it when >> necessary. > > This broke git send-email for me. The error message is > > Can't locate object method "starttls" via package "Net::SMTP" at > /usr/lib/git-core/git-send-email line 1410. > > Is 1.28 the right minimum version? > > $ perl -e 'require Net::SMTP; print version->parse($Net::SMTP::VERSION); > print "\n"' > 2.31 > $ grep VERSION /usr/share/perl/5.18.2/Net/SMTP.pm > use vars qw($VERSION @ISA); > $VERSION = "2.31"; > $ grep starttls /usr/share/perl/5.18.2/Net/SMTP.pm > $ dpkg-query -W perl > perl5.18.2-2ubuntu1.1 > Thanks. Let's revert the merge for now until we know (this time for certain) what the minimum version is.
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Hi, Dennis Kaarsemaker wrote: > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 > isn't that old yet, keep the old code in place and use it when > necessary. This broke git send-email for me. The error message is Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410. Is 1.28 the right minimum version? $ perl -e 'require Net::SMTP; print version->parse($Net::SMTP::VERSION); print "\n"' 2.31 $ grep VERSION /usr/share/perl/5.18.2/Net/SMTP.pm use vars qw($VERSION @ISA); $VERSION = "2.31"; $ grep starttls /usr/share/perl/5.18.2/Net/SMTP.pm $ dpkg-query -W perl perl5.18.2-2ubuntu1.1 Patch left unsnipped for reference. Thanks, Jonathan > While we're in the area, mark some messages for translation that were > not yet marked as such. > > Signed-off-by: Dennis Kaarsemaker> --- > git-send-email.perl | 54 > ++--- > 1 file changed, 35 insertions(+), 19 deletions(-) > > diff --git a/git-send-email.perl b/git-send-email.perl > index eea0a517f7..0d90439d9a 100755 > --- a/git-send-email.perl > +++ b/git-send-email.perl > @@ -1353,10 +1353,12 @@ EOF > die __("The required SMTP server is not properly > defined.") > } > > + require Net::SMTP; > + my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < > version->parse("1.28"); > + $smtp_domain ||= maildomain(); > + > if ($smtp_encryption eq 'ssl') { > $smtp_server_port ||= 465; # ssmtp > - require Net::SMTP::SSL; > - $smtp_domain ||= maildomain(); > require IO::Socket::SSL; > > # Suppress "variable accessed once" warning. > @@ -1368,34 +1370,48 @@ EOF > # Net::SMTP::SSL->new() does not forward any SSL options > IO::Socket::SSL::set_client_defaults( > ssl_verify_params()); > - $smtp ||= Net::SMTP::SSL->new($smtp_server, > - Hello => $smtp_domain, > - Port => $smtp_server_port, > - Debug => $debug_net_smtp); > + > + if ($use_net_smtp_ssl) { > + require Net::SMTP::SSL; > + $smtp ||= Net::SMTP::SSL->new($smtp_server, > + Hello => > $smtp_domain, > + Port => > $smtp_server_port, > + Debug => > $debug_net_smtp); > + } > + else { > + $smtp ||= Net::SMTP->new($smtp_server, > + Hello => $smtp_domain, > + Port => > $smtp_server_port, > + Debug => > $debug_net_smtp, > + SSL => 1); > + } > } > else { > - require Net::SMTP; > - $smtp_domain ||= maildomain(); > $smtp_server_port ||= 25; > $smtp ||= Net::SMTP->new($smtp_server, >Hello => $smtp_domain, >Debug => $debug_net_smtp, >Port => $smtp_server_port); > if ($smtp_encryption eq 'tls' && $smtp) { > - require Net::SMTP::SSL; > - $smtp->command('STARTTLS'); > - $smtp->response(); > - if ($smtp->code == 220) { > + if ($use_net_smtp_ssl) { > + $smtp->command('STARTTLS'); > + $smtp->response(); > + if ($smtp->code != 220) { > + die sprintf(__("Server does not > support STARTTLS! %s"), $smtp->message); > + } > + require Net::SMTP::SSL; > $smtp = Net::SMTP::SSL->start_SSL($smtp, > > ssl_verify_params()) > - or die "STARTTLS failed! > ".IO::Socket::SSL::errstr(); > - $smtp_encryption = '';
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
On Fri, May 19, 2017 at 10:54 PM, Dennis Kaarsemakerwrote: > Second ping. This problem is not going away, so if this solution is not > acceptable, I'd like to know what needs to be improved. FWIW: Reviewed-by: Ævar Arnfjörð Bjarmason > On Thu, 2017-05-04 at 09:01 +0200, Dennis Kaarsemaker wrote: >> Ping. It's a little over a month since I sent this, but I haven't seen >> any comments. Is this commit good to go? >> >> On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote: >> > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine >> > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 >> > isn't that old yet, keep the old code in place and use it when >> > necessary. >> > >> > While we're in the area, mark some messages for translation that were >> > not yet marked as such. >> > >> > Signed-off-by: Dennis Kaarsemaker >> > --- >> > git-send-email.perl | 54 >> > ++--- >> > 1 file changed, 35 insertions(+), 19 deletions(-) >> > >> > diff --git a/git-send-email.perl b/git-send-email.perl >> > index eea0a517f7..0d90439d9a 100755 >> > --- a/git-send-email.perl >> > +++ b/git-send-email.perl >> > @@ -1353,10 +1353,12 @@ EOF >> > die __("The required SMTP server is not properly >> > defined.") >> > } >> > >> > + require Net::SMTP; >> > + my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < >> > version->parse("1.28"); >> > + $smtp_domain ||= maildomain(); >> > + >> > if ($smtp_encryption eq 'ssl') { >> > $smtp_server_port ||= 465; # ssmtp >> > - require Net::SMTP::SSL; >> > - $smtp_domain ||= maildomain(); >> > require IO::Socket::SSL; >> > >> > # Suppress "variable accessed once" warning. >> > @@ -1368,34 +1370,48 @@ EOF >> > # Net::SMTP::SSL->new() does not forward any SSL >> > options >> > IO::Socket::SSL::set_client_defaults( >> > ssl_verify_params()); >> > - $smtp ||= Net::SMTP::SSL->new($smtp_server, >> > - Hello => $smtp_domain, >> > - Port => >> > $smtp_server_port, >> > - Debug => >> > $debug_net_smtp); >> > + >> > + if ($use_net_smtp_ssl) { >> > + require Net::SMTP::SSL; >> > + $smtp ||= Net::SMTP::SSL->new($smtp_server, >> > + Hello => >> > $smtp_domain, >> > + Port => >> > $smtp_server_port, >> > + Debug => >> > $debug_net_smtp); >> > + } >> > + else { >> > + $smtp ||= Net::SMTP->new($smtp_server, >> > +Hello => $smtp_domain, >> > +Port => >> > $smtp_server_port, >> > +Debug => >> > $debug_net_smtp, >> > +SSL => 1); >> > + } >> > } >> > else { >> > - require Net::SMTP; >> > - $smtp_domain ||= maildomain(); >> > $smtp_server_port ||= 25; >> > $smtp ||= Net::SMTP->new($smtp_server, >> > Hello => $smtp_domain, >> > Debug => $debug_net_smtp, >> > Port => $smtp_server_port); >> > if ($smtp_encryption eq 'tls' && $smtp) { >> > - require Net::SMTP::SSL; >> > - $smtp->command('STARTTLS'); >> > - $smtp->response(); >> > - if ($smtp->code == 220) { >> > + if ($use_net_smtp_ssl) { >> > + $smtp->command('STARTTLS'); >> > + $smtp->response(); >> > + if ($smtp->code != 220) { >> > + die sprintf(__("Server does >> > not support STARTTLS! %s"), $smtp->message); >> > + } >> > + require Net::SMTP::SSL; >> > $smtp = >> > Net::SMTP::SSL->start_SSL($smtp, >> > >> > ssl_verify_params()) >> > - or die
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Second ping. This problem is not going away, so if this solution is not acceptable, I'd like to know what needs to be improved. On Thu, 2017-05-04 at 09:01 +0200, Dennis Kaarsemaker wrote: > Ping. It's a little over a month since I sent this, but I haven't seen > any comments. Is this commit good to go? > > On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote: > > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine > > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 > > isn't that old yet, keep the old code in place and use it when > > necessary. > > > > While we're in the area, mark some messages for translation that were > > not yet marked as such. > > > > Signed-off-by: Dennis Kaarsemaker> > --- > > git-send-email.perl | 54 > > ++--- > > 1 file changed, 35 insertions(+), 19 deletions(-) > > > > diff --git a/git-send-email.perl b/git-send-email.perl > > index eea0a517f7..0d90439d9a 100755 > > --- a/git-send-email.perl > > +++ b/git-send-email.perl > > @@ -1353,10 +1353,12 @@ EOF > > die __("The required SMTP server is not properly > > defined.") > > } > > > > + require Net::SMTP; > > + my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < > > version->parse("1.28"); > > + $smtp_domain ||= maildomain(); > > + > > if ($smtp_encryption eq 'ssl') { > > $smtp_server_port ||= 465; # ssmtp > > - require Net::SMTP::SSL; > > - $smtp_domain ||= maildomain(); > > require IO::Socket::SSL; > > > > # Suppress "variable accessed once" warning. > > @@ -1368,34 +1370,48 @@ EOF > > # Net::SMTP::SSL->new() does not forward any SSL options > > IO::Socket::SSL::set_client_defaults( > > ssl_verify_params()); > > - $smtp ||= Net::SMTP::SSL->new($smtp_server, > > - Hello => $smtp_domain, > > - Port => $smtp_server_port, > > - Debug => $debug_net_smtp); > > + > > + if ($use_net_smtp_ssl) { > > + require Net::SMTP::SSL; > > + $smtp ||= Net::SMTP::SSL->new($smtp_server, > > + Hello => > > $smtp_domain, > > + Port => > > $smtp_server_port, > > + Debug => > > $debug_net_smtp); > > + } > > + else { > > + $smtp ||= Net::SMTP->new($smtp_server, > > +Hello => $smtp_domain, > > +Port => > > $smtp_server_port, > > +Debug => > > $debug_net_smtp, > > +SSL => 1); > > + } > > } > > else { > > - require Net::SMTP; > > - $smtp_domain ||= maildomain(); > > $smtp_server_port ||= 25; > > $smtp ||= Net::SMTP->new($smtp_server, > > Hello => $smtp_domain, > > Debug => $debug_net_smtp, > > Port => $smtp_server_port); > > if ($smtp_encryption eq 'tls' && $smtp) { > > - require Net::SMTP::SSL; > > - $smtp->command('STARTTLS'); > > - $smtp->response(); > > - if ($smtp->code == 220) { > > + if ($use_net_smtp_ssl) { > > + $smtp->command('STARTTLS'); > > + $smtp->response(); > > + if ($smtp->code != 220) { > > + die sprintf(__("Server does not > > support STARTTLS! %s"), $smtp->message); > > + } > > + require Net::SMTP::SSL; > > $smtp = Net::SMTP::SSL->start_SSL($smtp, > > > > ssl_verify_params()) > > - or die "STARTTLS failed! > > ".IO::Socket::SSL::errstr(); > > - $smtp_encryption = ''; > > - # Send EHLO again to receive fresh > > - # supported commands > > -
Re: [PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Ping. It's a little over a month since I sent this, but I haven't seen any comments. Is this commit good to go? On Fri, 2017-03-24 at 22:37 +0100, Dennis Kaarsemaker wrote: > Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine > since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 > isn't that old yet, keep the old code in place and use it when > necessary. > > While we're in the area, mark some messages for translation that were > not yet marked as such. > > Signed-off-by: Dennis Kaarsemaker> --- > git-send-email.perl | 54 > ++--- > 1 file changed, 35 insertions(+), 19 deletions(-) > > diff --git a/git-send-email.perl b/git-send-email.perl > index eea0a517f7..0d90439d9a 100755 > --- a/git-send-email.perl > +++ b/git-send-email.perl > @@ -1353,10 +1353,12 @@ EOF > die __("The required SMTP server is not properly > defined.") > } > > + require Net::SMTP; > + my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < > version->parse("1.28"); > + $smtp_domain ||= maildomain(); > + > if ($smtp_encryption eq 'ssl') { > $smtp_server_port ||= 465; # ssmtp > - require Net::SMTP::SSL; > - $smtp_domain ||= maildomain(); > require IO::Socket::SSL; > > # Suppress "variable accessed once" warning. > @@ -1368,34 +1370,48 @@ EOF > # Net::SMTP::SSL->new() does not forward any SSL options > IO::Socket::SSL::set_client_defaults( > ssl_verify_params()); > - $smtp ||= Net::SMTP::SSL->new($smtp_server, > - Hello => $smtp_domain, > - Port => $smtp_server_port, > - Debug => $debug_net_smtp); > + > + if ($use_net_smtp_ssl) { > + require Net::SMTP::SSL; > + $smtp ||= Net::SMTP::SSL->new($smtp_server, > + Hello => > $smtp_domain, > + Port => > $smtp_server_port, > + Debug => > $debug_net_smtp); > + } > + else { > + $smtp ||= Net::SMTP->new($smtp_server, > + Hello => $smtp_domain, > + Port => > $smtp_server_port, > + Debug => > $debug_net_smtp, > + SSL => 1); > + } > } > else { > - require Net::SMTP; > - $smtp_domain ||= maildomain(); > $smtp_server_port ||= 25; > $smtp ||= Net::SMTP->new($smtp_server, >Hello => $smtp_domain, >Debug => $debug_net_smtp, >Port => $smtp_server_port); > if ($smtp_encryption eq 'tls' && $smtp) { > - require Net::SMTP::SSL; > - $smtp->command('STARTTLS'); > - $smtp->response(); > - if ($smtp->code == 220) { > + if ($use_net_smtp_ssl) { > + $smtp->command('STARTTLS'); > + $smtp->response(); > + if ($smtp->code != 220) { > + die sprintf(__("Server does not > support STARTTLS! %s"), $smtp->message); > + } > + require Net::SMTP::SSL; > $smtp = Net::SMTP::SSL->start_SSL($smtp, > > ssl_verify_params()) > - or die "STARTTLS failed! > ".IO::Socket::SSL::errstr(); > - $smtp_encryption = ''; > - # Send EHLO again to receive fresh > - # supported commands > - $smtp->hello($smtp_domain); > - } else { > - die sprintf(__("Server does not support > STARTTLS! %s"), $smtp->message); > + or die
[PATCH v2] send-email: Net::SMTP::SSL is obsolete, use only when necessary
Net::SMTP itself can do the necessary SSL and STARTTLS bits just fine since version 1.28, and Net::SMTP::SSL is now deprecated. Since 1.28 isn't that old yet, keep the old code in place and use it when necessary. While we're in the area, mark some messages for translation that were not yet marked as such. Signed-off-by: Dennis Kaarsemaker--- git-send-email.perl | 54 ++--- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index eea0a517f7..0d90439d9a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1353,10 +1353,12 @@ EOF die __("The required SMTP server is not properly defined.") } + require Net::SMTP; + my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("1.28"); + $smtp_domain ||= maildomain(); + if ($smtp_encryption eq 'ssl') { $smtp_server_port ||= 465; # ssmtp - require Net::SMTP::SSL; - $smtp_domain ||= maildomain(); require IO::Socket::SSL; # Suppress "variable accessed once" warning. @@ -1368,34 +1370,48 @@ EOF # Net::SMTP::SSL->new() does not forward any SSL options IO::Socket::SSL::set_client_defaults( ssl_verify_params()); - $smtp ||= Net::SMTP::SSL->new($smtp_server, - Hello => $smtp_domain, - Port => $smtp_server_port, - Debug => $debug_net_smtp); + + if ($use_net_smtp_ssl) { + require Net::SMTP::SSL; + $smtp ||= Net::SMTP::SSL->new($smtp_server, + Hello => $smtp_domain, + Port => $smtp_server_port, + Debug => $debug_net_smtp); + } + else { + $smtp ||= Net::SMTP->new($smtp_server, +Hello => $smtp_domain, +Port => $smtp_server_port, +Debug => $debug_net_smtp, +SSL => 1); + } } else { - require Net::SMTP; - $smtp_domain ||= maildomain(); $smtp_server_port ||= 25; $smtp ||= Net::SMTP->new($smtp_server, Hello => $smtp_domain, Debug => $debug_net_smtp, Port => $smtp_server_port); if ($smtp_encryption eq 'tls' && $smtp) { - require Net::SMTP::SSL; - $smtp->command('STARTTLS'); - $smtp->response(); - if ($smtp->code == 220) { + if ($use_net_smtp_ssl) { + $smtp->command('STARTTLS'); + $smtp->response(); + if ($smtp->code != 220) { + die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message); + } + require Net::SMTP::SSL; $smtp = Net::SMTP::SSL->start_SSL($smtp, ssl_verify_params()) - or die "STARTTLS failed! ".IO::Socket::SSL::errstr(); - $smtp_encryption = ''; - # Send EHLO again to receive fresh - # supported commands - $smtp->hello($smtp_domain); - } else { - die sprintf(__("Server does not support STARTTLS! %s"), $smtp->message); + or die sprintf(__("STARTTLS failed! %s"), IO::Socket::SSL::errstr()); + } + else { + $smtp->starttls(ssl_verify_params()) +