diff options
author | deraadt <> | 2015-10-09 04:13:34 +0000 |
---|---|---|
committer | deraadt <> | 2015-10-09 04:13:34 +0000 |
commit | 1a7bd492d52c3b362b7009221cc6951f067f159f (patch) | |
tree | d00aed420e2b6b5c090d56a47deb3dccb10a18fb /src | |
parent | b34c894de28ef45fcf0a5357a35816004e09d80d (diff) | |
download | openbsd-1a7bd492d52c3b362b7009221cc6951f067f159f.tar.gz openbsd-1a7bd492d52c3b362b7009221cc6951f067f159f.tar.bz2 openbsd-1a7bd492d52c3b362b7009221cc6951f067f159f.zip |
fix a gotcha in the connect refactoring, that could result in dropping
through and trying to bind failed v6 connects.
ok guenther
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libtls/tls_client.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_client.c b/src/lib/libtls/tls_client.c index 68b0f32226..6bb24cd512 100644 --- a/src/lib/libtls/tls_client.c +++ b/src/lib/libtls/tls_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_client.c,v 1.31 2015/10/08 20:13:45 guenther Exp $ */ | 1 | /* $OpenBSD: tls_client.c,v 1.32 2015/10/09 04:13:34 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -118,6 +118,7 @@ tls_connect_servername(struct tls *ctx, const char *host, const char *port, | |||
118 | } | 118 | } |
119 | 119 | ||
120 | /* It was resolved somehow; now try connecting to what we got */ | 120 | /* It was resolved somehow; now try connecting to what we got */ |
121 | s = -1; | ||
121 | for (res = res0; res; res = res->ai_next) { | 122 | for (res = res0; res; res = res->ai_next) { |
122 | s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); | 123 | s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); |
123 | if (s == -1) { | 124 | if (s == -1) { |
@@ -135,6 +136,9 @@ tls_connect_servername(struct tls *ctx, const char *host, const char *port, | |||
135 | } | 136 | } |
136 | freeaddrinfo(res0); | 137 | freeaddrinfo(res0); |
137 | 138 | ||
139 | if (s == -1) | ||
140 | goto err; | ||
141 | |||
138 | if (servername == NULL) | 142 | if (servername == NULL) |
139 | servername = h; | 143 | servername = h; |
140 | 144 | ||