all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marius Bakke <mbakke@fastmail.com>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: 28948@debbugs.gnu.org
Subject: bug#28948: feh does encounter certificate errors with valid certificates
Date: Wed, 01 Nov 2017 21:55:01 +0100	[thread overview]
Message-ID: <87d1514t3u.fsf@fastmail.com> (raw)
In-Reply-To: <87fua1kqqu.fsf@elephly.net>

[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

Ricardo Wurmus <rekado@elephly.net> writes:

> Marius Bakke <mbakke@fastmail.com> writes:
>
>> ng0 <ng0@infotropique.org> writes:
>>
>>> feh https://i.imgur.com/263enxT.jpg
>>> feh opens image
>>>
>>> Problem:
>>> user@abyayala ~/src/guix/guix$ feh https://i.imgur.com/263enxT.jpg
>>> feh WARNING: open url: server certificate verification failed. CAfile: none CRLfile: none
>>> feh WARNING: https://i.imgur.com/263enxT.jpg - File does not exist
>>> feh: No loadable images specified.
>>> See 'man feh' for detailed usage information
>>>
>>> nss etc are in my profile, no problem with other curl based applications.
>>
>> The attached patch should fix the problem.  Can you try it?
>
> We’ve done something similar in r-curl IIRC.  I wonder if we should just
> patch libcurl, so that all users of libcurl would benefit from this change.

IIRC the reason it's not supported in libcurl is because getenv() is not
thread-safe, whereas libcurl is designed to be.

>
>> +diff --git a/src/imlib.c b/src/imlib.c
>> +index dfb79aa..82a9865 100644
>> +--- a/src/imlib.c
>> ++++ b/src/imlib.c
>> +@@ -429,6 +429,10 @@ static char *feh_http_load_image(char *url)
>> + 			if (opt.insecure_ssl) {
>> + 				curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
>> + 				curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
>> ++			} else {
>> ++				// Allow the user to specify custom CA certificates.
>> ++				curl_easy_setopt(curl, CURLOPT_CAINFO,
>> ++						getenv("CURL_CA_BUNDLE"));
>> + 			}
>
> Is it safe to pass the empty string to curl_easy_setopt, in case
> CURL_CA_BUNDLE is unset?  Do we need to check the value first or can we
> pass it without checking?

getenv() returns NULL if the variable is unset.  I'm not sure if it
would reset the default on other distros, but it makes no difference for
Guix since libcurl does not have a default CA bundle and handles NULL
here gracefully.

I submitted it upstream in hope of getting feedback/testing there, but
it was simply merged as-is: <https://github.com/derf/feh/pull/340>

I do agree that it's rather crude, will try to improve it a bit.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  parent reply	other threads:[~2017-11-01 20:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 20:33 bug#28948: feh does encounter certificate errors with valid certificates ng0
2017-10-29 12:27 ` Marius Bakke
2017-10-29 21:35   ` Ricardo Wurmus
2017-10-29 22:00     ` Marius Bakke
2017-10-29 23:47 ` Marius Bakke
2017-10-30  8:02   ` Ricardo Wurmus
2017-10-30 14:06     ` ng0
2017-11-01 20:55     ` Marius Bakke [this message]
2017-11-05 15:21       ` Marius Bakke
2017-11-05 16:14         ` Ludovic Courtès

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

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

  git send-email \
    --in-reply-to=87d1514t3u.fsf@fastmail.com \
    --to=mbakke@fastmail.com \
    --cc=28948@debbugs.gnu.org \
    --cc=rekado@elephly.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.