unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Aaron Jensen <aaronjensen@gmail.com>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: 26835@debbugs.gnu.org
Subject: bug#26835: 26.0.50; url-retrieve no longer raises certificate errors
Date: Tue, 09 May 2017 20:51:48 +0300	[thread overview]
Message-ID: <83lgq5c40b.fsf@gnu.org> (raw)
In-Reply-To: <CAHyO48z5yEe4hXHrrTzZvzT+ZaS=HZZati3YYwPXYxWG2bE=Gg@mail.gmail.com> (message from Aaron Jensen on Mon, 8 May 2017 12:44:52 -0700)

[Resending, as I messed up the previous message.  Apologies.]

> From: Aaron Jensen <aaronjensen@gmail.com>
> Date: Mon, 8 May 2017 12:44:52 -0700
> Cc: 26835@debbugs.gnu.org
> 
> It repros in `emacs -Q', just set:
> 
> (setq gnutls-verify-error t)
> (url-retrieve-synchronously "https://wrong.host.badssl.com/")
> 
> In Emacs 25.2, this causes an error to be thrown when you use
> url-retrieve, in 26, it silently proceeds.

That's because we now perform GnuTLS negotiation asynchronously,
without blocking.  When the certificate matching fails, gnutls.c
faithfully stores the error message in the process's status by calling
boot_error:

	      boot_error (p, "The x509 certificate does not match \"%s\"",
			  c_hostname);

and boot_error does:

  static void ATTRIBUTE_FORMAT_PRINTF (2, 3)
  boot_error (struct Lisp_Process *p, const char *m, ...)
  {
    va_list ap;
    va_start (ap, m);
    if (p->is_non_blocking_client)
      pset_status (p, list2 (Qfailed, vformat_string (m, ap)));

So the process status becomes the list (failed "error message").  But
when url-retrieve-synchronously accesses the status, by calling
process-status, we do this:

  status = p->status;
  if (CONSP (status))
    status = XCAR (status);

which loses the error message, leaving just 'failed'.  So
url-retrieve-synchronously silently exits, and doesn't even have the
info that could cause it to signal an error.

IOW, the problem is not that the connection proceeds -- it does not.
The problem is that it fails silently without telling the caller what
caused the failure.

I'll CC Lars, who introduced the non-blocking connections.





  reply	other threads:[~2017-05-09 17:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 18:42 bug#26835: 26.0.50; url-retrieve no longer raises certificate errors Aaron Jensen
2017-05-08 19:04 ` Eli Zaretskii
2017-05-08 19:44   ` Aaron Jensen
2017-05-09 17:51     ` Eli Zaretskii [this message]
2017-05-10 14:24       ` Lars Ingebrigtsen
2017-05-10 16:48         ` Eli Zaretskii
2017-09-02 13:42           ` Eli Zaretskii
2017-09-13 18:11             ` Lars Ingebrigtsen
2017-09-13 18:44               ` Eli Zaretskii
2017-09-13 17:51           ` Lars Ingebrigtsen

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: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83lgq5c40b.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=26835@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    --cc=larsi@gnus.org \
    /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://git.savannah.gnu.org/cgit/emacs.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).