git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-email: don't call methods on undefined values

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 9, 2013, 16:45 UTC
Message-ID
<xmqqli363pwp.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1378673674-97212-1-git-send-email-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 20 quoted lines
> If SSL verification is enabled in git send-email, we could attempt to call a
> method on an undefined value if the verification failed, since $smtp would end
> up being undef.  Look up the error string in a way that will produce a helpful
> error message and not cause further errors.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
>  git-send-email.perl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 2162478..3782c3b 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1234,7 +1234,7 @@ X-Mailer: git-send-email $gitversion
>  				if ($smtp->code == 220) {
>  					$smtp = Net::SMTP::SSL->start_SSL($smtp,
>  									  ssl_verify_params())
> -						or die "STARTTLS failed! ".$smtp->message;
> +						or die "STARTTLS failed! ".IO::Socket::SSL::errstr();

I agree that $smtp->message may be bogus at this point, but could "require IO::Socket::SSL" have failed on us in ssl_verify_params? In that degraded mode, we do not do SSL peer verification, but otherwise we would still attempt to talk with the peer, and in such a case, IO::Socket::SSL would not be available to us at this point, no?

>  					$smtp_encryption = '';
>  					# Send EHLO again to receive fresh
>  					# supported commands
Previous: brian m. carlsonNext: brian m. carlson
Message 2 of 4 in “send-email: don't call methods on undefined values”
  1. send-email: don't call methods on undefined valuesbrian m. carlson, Sep 8, 2013
  2. Junio C HamanoSep 9, 2013
  3. brian m. carlsonSep 9, 2013
  4. Junio C HamanoSep 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.