git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Mike Fisher <mfisher@csh.rit.edu>, git@vger.kernel.org
Subject: Re: [PATCH] Remove dependency on deprecated Net::SMTP::SSL
Date: Mon, 21 Nov 2016 06:37:28 +0100	[thread overview]
Message-ID: <d5f21248-e70a-4adc-52c5-73fd00f62961@web.de> (raw)
In-Reply-To: <451E4A46-BA43-41A5-9E68-DE0D89BE676A@csh.rit.edu>



>On 20/11/16 22:18, Mike Fisher  wrote:

Thanks for contributing to Git.
One comment on the head line:
 >Refactor send_message() to remove dependency on deprecated
Net::SMTP::SSL
The word "refactor" may be used in other way: Re-structure the code,
and use the same API.


"Remove dependency on deprecated Net::SMTP::SSL"

> Refactor send_message() to remove dependency on deprecated
> Net::SMTP::SSL:
Is there a security risk with require Net::SMTP::SSL ?
If yes, the commit message should state this.
If no:
Even if it is deprecated, is it still in use somewhere ?
Does it hurt someone, is there any OS release where the old code doesn't work 
anymore ?
Or is it "only" nice to have ?
Since when does Net::SMTP include Net::SMTP::SSL ?
On which system has the change been tested ?

I think the commit message could and should give more information like this.

My comments may be over-critical.
Lets see if other people from the list know more than me.

>
> <http://search.cpan.org/~rjbs/Net-SMTP-SSL-1.04/lib/Net/SMTP/SSL.pm#DEPRECATED>
>
> Signed-off-by: Mike Fisher <mfisher@csh.rit.edu>
> ---
>  git-send-email.perl | 54 +++++++++++++++++++++++++----------------------------
>  1 file changed, 25 insertions(+), 29 deletions(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index da81be4..fc166c5 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1330,15 +1330,17 @@ Message-Id: $message_id
>          print $sm "$header\n$message";
>          close $sm or die $!;
>      } else {
> -
I can see one refactoring, that is the removal of an empty line.

>
>          if (!defined $smtp_server) {
>              die "The required SMTP server is not properly defined."
>          }
>
> +        require Net::SMTP;
> +        $smtp_domain ||= maildomain();
> +        my $smtp_ssl = 0;
> +
>          if ($smtp_encryption eq 'ssl') {
>              $smtp_server_port ||= 465; # ssmtp
> -            require Net::SMTP::SSL;
> -            $smtp_domain ||= maildomain();
> +            $smtp_ssl = 1;
>              require IO::Socket::SSL;
>
>              # Suppress "variable accessed once" warning.
> @@ -1347,37 +1349,31 @@ Message-Id: $message_id
>                  $IO::Socket::SSL::DEBUG = 1;
>              }
>
> -            # 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);
>          }
>          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) {
> -                    $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 "Server does not support STARTTLS! ".$smtp->message;
> -                }
> +        }
> +
> +        $smtp ||= Net::SMTP->new($smtp_server,
> +                     Hello => $smtp_domain,
> +                     Port => $smtp_server_port,
> +                     Debug => $debug_net_smtp,
> +                     SSL => $smtp_ssl);
> +
> +        if ($smtp_encryption eq 'tls' && $smtp) {
> +            $smtp->command('STARTTLS');
> +            $smtp->response();
> +            if ($smtp->code == 220) {
> +                $smtp->starttls(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 "Server does not support STARTTLS! ".$smtp->message;
>              }
>          }
>


  parent reply	other threads:[~2016-11-21  5:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 21:18 [PATCH] Remove dependency on deprecated Net::SMTP::SSL Mike Fisher
2016-11-20 21:53 ` brian m. carlson
2017-01-13 14:59   ` Renato Botelho
2016-11-21  5:37 ` Torsten Bögershausen [this message]
2017-03-18 22:23 ` [PATCH] send-email: Net::SMTP::SSL is obsolete, use only when necessary Dennis Kaarsemaker
2017-03-18 22:47   ` Ævar Arnfjörð Bjarmason
2017-03-18 23:14     ` Dennis Kaarsemaker
2017-03-24 21:37     ` [PATCH v2] " Dennis Kaarsemaker
2017-05-04  7:01       ` Dennis Kaarsemaker
2017-05-19 20:54         ` Dennis Kaarsemaker
2017-05-20  7:56           ` Ævar Arnfjörð Bjarmason
2017-05-31 22:50           ` Junio C Hamano
2017-06-01 19:42             ` Dennis Kaarsemaker
2017-05-31 21:46       ` Jonathan Nieder
2017-05-31 22:39         ` Junio C Hamano
2017-05-31 22:53           ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5f21248-e70a-4adc-52c5-73fd00f62961@web.de \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=mfisher@csh.rit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).