Fix certificate validation for IPv6 literals in sconnect demo
authorDavid Woodhouse <dwmw2@infradead.org>
Thu, 20 Jun 2019 20:39:38 +0000 (21:39 +0100)
committerTomas Mraz <tmraz@fedoraproject.org>
Mon, 3 Aug 2020 15:15:35 +0000 (17:15 +0200)
commit396e72096589593cb00412c85170c7ec87d13b89
treecd02dd52abc26182aec10c4e4b6351cea975d032
parentc832840e899091948bb7f5e9af63f929e6a18f95
Fix certificate validation for IPv6 literals in sconnect demo

Instead of naïvely trying to truncate at the first colon, use
BIO_get_conn_hostname(). That handles IPv6 literals correctly, even
stripping the [] from around them.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/9201)
demos/bio/sconnect.c