diff options
| author | jsing <> | 2017-07-05 15:38:35 +0000 |
|---|---|---|
| committer | jsing <> | 2017-07-05 15:38:35 +0000 |
| commit | 23f8730872473ece83a0897191d237776311af34 (patch) | |
| tree | 5f54f1faf70b7c6a24b039ec374662e43b876e23 /src/lib/libtls/tls_server.c | |
| parent | 38c8cef451a204b2690aaa0d3385c8fbf25c4575 (diff) | |
| download | openbsd-23f8730872473ece83a0897191d237776311af34.tar.gz openbsd-23f8730872473ece83a0897191d237776311af34.tar.bz2 openbsd-23f8730872473ece83a0897191d237776311af34.zip | |
RFC 6066 states that IP literals are not permitted in "HostName" for a
TLS Server Name extension, however seemingly several clients (including
Python, Ruby and Safari) violate the RFC. Given that this is a fairly
widespread issue, if we receive a TLS Server Name extension that contains
an IP literal, pretend that we did not receive the extension rather than
causing a handshake failure.
Issue raised by jsg@
ok jsg@
Diffstat (limited to 'src/lib/libtls/tls_server.c')
| -rw-r--r-- | src/lib/libtls/tls_server.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/libtls/tls_server.c b/src/lib/libtls/tls_server.c index fd5a617582..394cea1e8d 100644 --- a/src/lib/libtls/tls_server.c +++ b/src/lib/libtls/tls_server.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_server.c,v 1.39 2017/06/22 18:03:57 jsing Exp $ */ | 1 | /* $OpenBSD: tls_server.c,v 1.40 2017/07/05 15:38:35 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -91,10 +91,16 @@ tls_servername_cb(SSL *ssl, int *al, void *arg) | |||
| 91 | return (SSL_TLSEXT_ERR_NOACK); | 91 | return (SSL_TLSEXT_ERR_NOACK); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | /* Per RFC 6066 section 3: ensure that name is not an IP literal. */ | 94 | /* |
| 95 | * Per RFC 6066 section 3: ensure that name is not an IP literal. | ||
| 96 | * | ||
| 97 | * While we should treat this as an error, a number of clients | ||
| 98 | * (Python, Ruby and Safari) are not RFC compliant. To avoid handshake | ||
| 99 | * failures, pretend that we did not receive the extension. | ||
| 100 | */ | ||
| 95 | if (inet_pton(AF_INET, name, &addrbuf) == 1 || | 101 | if (inet_pton(AF_INET, name, &addrbuf) == 1 || |
| 96 | inet_pton(AF_INET6, name, &addrbuf) == 1) | 102 | inet_pton(AF_INET6, name, &addrbuf) == 1) |
| 97 | goto err; | 103 | return (SSL_TLSEXT_ERR_NOACK); |
| 98 | 104 | ||
| 99 | free((char *)conn_ctx->servername); | 105 | free((char *)conn_ctx->servername); |
| 100 | if ((conn_ctx->servername = strdup(name)) == NULL) | 106 | if ((conn_ctx->servername = strdup(name)) == NULL) |
