NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/53846: ftp doesn't verify certificates for https:// requests
The following reply was made to PR bin/53846; it has been noted by GNATS.
From: Kimihiro Nonaka <nonakap%gmail.com@localhost>
To: "gnats-bugs%NetBSD.org@localhost" <gnats-bugs%netbsd.org@localhost>
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/53846: ftp doesn't verify certificates for https:// requests
Date: Sat, 2 Feb 2019 01:52:15 +0900
--000000000000b5acf30580d7f704
Content-Type: text/plain; charset="UTF-8"
On Wed, Jan 9, 2019 at 5:50 PM Michael van Elst <mlelstv%serpens.de@localhost> wrote:
> >>Synopsis: ftp doesn't verify certificates for https:// requests
> >>Fix:
> >add the call to the verify option, but also add some error checking to detail a failure
>
> Also add a possibility to ignore the cert like curl --insecure.
I ported it from FreeBSD.
Please try attached patch.
# the patch is available at
https://gist.githubusercontent.com/nonakap/8e504fec4f70a4cea27308e1e0a4b982/raw/f2b9e39991b3484344c410742c633f778681cb7c/nbsd-ftp-verify-https-server-cert.diff
too.
Regards,
--
Kimihiro Nonaka
--000000000000b5acf30580d7f704
Content-Type: application/octet-stream;
name="nbsd-ftp-verify-https-server-cert.diff"
Content-Disposition: attachment;
filename="nbsd-ftp-verify-https-server-cert.diff"
Content-Transfer-Encoding: base64
Content-ID: <f_jrma8f7k0>
X-Attachment-Id: f_jrma8f7k0
SW5kZXg6IHVzci5iaW4vZnRwL2NtZHMuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3Zzcm9vdC9z
cmMvdXNyLmJpbi9mdHAvY21kcy5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjEzNwpkaWZmIC11
IC1wIC1yMS4xMzcgY21kcy5jCi0tLSB1c3IuYmluL2Z0cC9jbWRzLmMJMjcgRmViIDI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