diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bss_conn.c')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index 7f50936677..555273882c 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_conn.c,v 1.32 2014/11/26 05:37:26 bcook Exp $ */ | 1 | /* $OpenBSD: bss_conn.c,v 1.33 2017/01/29 17:49:22 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -134,7 +134,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 134 | case BIO_CONN_S_BEFORE: | 134 | case BIO_CONN_S_BEFORE: |
| 135 | p = c->param_hostname; | 135 | p = c->param_hostname; |
| 136 | if (p == NULL) { | 136 | if (p == NULL) { |
| 137 | BIOerr(BIO_F_CONN_STATE, BIO_R_NO_HOSTNAME_SPECIFIED); | 137 | BIOerror(BIO_R_NO_HOSTNAME_SPECIFIED); |
| 138 | goto exit_loop; | 138 | goto exit_loop; |
| 139 | } | 139 | } |
| 140 | for (; *p != '\0'; p++) { | 140 | for (; *p != '\0'; p++) { |
| @@ -157,7 +157,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | if (c->param_port == NULL) { | 159 | if (c->param_port == NULL) { |
| 160 | BIOerr(BIO_F_CONN_STATE, BIO_R_NO_PORT_SPECIFIED); | 160 | BIOerror(BIO_R_NO_PORT_SPECIFIED); |
| 161 | ERR_asprintf_error_data("host=%s", | 161 | ERR_asprintf_error_data("host=%s", |
| 162 | c->param_hostname); | 162 | c->param_hostname); |
| 163 | goto exit_loop; | 163 | goto exit_loop; |
| @@ -195,11 +195,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 195 | 195 | ||
| 196 | ret = socket(AF_INET, SOCK_STREAM, SOCKET_PROTOCOL); | 196 | ret = socket(AF_INET, SOCK_STREAM, SOCKET_PROTOCOL); |
| 197 | if (ret == -1) { | 197 | if (ret == -1) { |
| 198 | SYSerr(SYS_F_SOCKET, errno); | 198 | SYSerror(errno); |
| 199 | ERR_asprintf_error_data("host=%s:%s", | 199 | ERR_asprintf_error_data("host=%s:%s", |
| 200 | c->param_hostname, c->param_port); | 200 | c->param_hostname, c->param_port); |
| 201 | BIOerr(BIO_F_CONN_STATE, | 201 | BIOerror(BIO_R_UNABLE_TO_CREATE_SOCKET); |
| 202 | BIO_R_UNABLE_TO_CREATE_SOCKET); | ||
| 203 | goto exit_loop; | 202 | goto exit_loop; |
| 204 | } | 203 | } |
| 205 | b->num = ret; | 204 | b->num = ret; |
| @@ -209,8 +208,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 209 | case BIO_CONN_S_NBIO: | 208 | case BIO_CONN_S_NBIO: |
| 210 | if (c->nbio) { | 209 | if (c->nbio) { |
| 211 | if (!BIO_socket_nbio(b->num, 1)) { | 210 | if (!BIO_socket_nbio(b->num, 1)) { |
| 212 | BIOerr(BIO_F_CONN_STATE, | 211 | BIOerror(BIO_R_ERROR_SETTING_NBIO); |
| 213 | BIO_R_ERROR_SETTING_NBIO); | ||
| 214 | ERR_asprintf_error_data("host=%s:%s", | 212 | ERR_asprintf_error_data("host=%s:%s", |
| 215 | c->param_hostname, c->param_port); | 213 | c->param_hostname, c->param_port); |
| 216 | goto exit_loop; | 214 | goto exit_loop; |
| @@ -222,10 +220,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 222 | i = 1; | 220 | i = 1; |
| 223 | i = setsockopt(b->num, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof(i)); | 221 | i = setsockopt(b->num, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof(i)); |
| 224 | if (i < 0) { | 222 | if (i < 0) { |
| 225 | SYSerr(SYS_F_SOCKET, errno); | 223 | SYSerror(errno); |
| 226 | ERR_asprintf_error_data("host=%s:%s", | 224 | ERR_asprintf_error_data("host=%s:%s", |
| 227 | c->param_hostname, c->param_port); | 225 | c->param_hostname, c->param_port); |
| 228 | BIOerr(BIO_F_CONN_STATE, BIO_R_KEEPALIVE); | 226 | BIOerror(BIO_R_KEEPALIVE); |
| 229 | goto exit_loop; | 227 | goto exit_loop; |
| 230 | } | 228 | } |
| 231 | #endif | 229 | #endif |
| @@ -243,11 +241,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 243 | c->state = BIO_CONN_S_BLOCKED_CONNECT; | 241 | c->state = BIO_CONN_S_BLOCKED_CONNECT; |
| 244 | b->retry_reason = BIO_RR_CONNECT; | 242 | b->retry_reason = BIO_RR_CONNECT; |
| 245 | } else { | 243 | } else { |
| 246 | SYSerr(SYS_F_CONNECT, errno); | 244 | SYSerror(errno); |
| 247 | ERR_asprintf_error_data("host=%s:%s", | 245 | ERR_asprintf_error_data("host=%s:%s", |
| 248 | c->param_hostname, c->param_port); | 246 | c->param_hostname, c->param_port); |
| 249 | BIOerr(BIO_F_CONN_STATE, | 247 | BIOerror(BIO_R_CONNECT_ERROR); |
| 250 | BIO_R_CONNECT_ERROR); | ||
| 251 | } | 248 | } |
| 252 | goto exit_loop; | 249 | goto exit_loop; |
| 253 | } else | 250 | } else |
| @@ -258,11 +255,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
| 258 | i = BIO_sock_error(b->num); | 255 | i = BIO_sock_error(b->num); |
| 259 | if (i) { | 256 | if (i) { |
| 260 | BIO_clear_retry_flags(b); | 257 | BIO_clear_retry_flags(b); |
| 261 | SYSerr(SYS_F_CONNECT, i); | 258 | SYSerror(i); |
| 262 | ERR_asprintf_error_data("host=%s:%s", | 259 | ERR_asprintf_error_data("host=%s:%s", |
| 263 | c->param_hostname, c->param_port); | 260 | c->param_hostname, c->param_port); |
| 264 | BIOerr(BIO_F_CONN_STATE, | 261 | BIOerror(BIO_R_NBIO_CONNECT_ERROR); |
| 265 | BIO_R_NBIO_CONNECT_ERROR); | ||
| 266 | ret = 0; | 262 | ret = 0; |
| 267 | goto exit_loop; | 263 | goto exit_loop; |
| 268 | } else | 264 | } else |
| @@ -533,7 +529,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 533 | case BIO_CTRL_SET_CALLBACK: | 529 | case BIO_CTRL_SET_CALLBACK: |
| 534 | { | 530 | { |
| 535 | #if 0 /* FIXME: Should this be used? -- Richard Levitte */ | 531 | #if 0 /* FIXME: Should this be used? -- Richard Levitte */ |
| 536 | BIOerr(BIO_F_CONN_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 532 | BIOerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 537 | ret = -1; | 533 | ret = -1; |
| 538 | #else | 534 | #else |
| 539 | ret = 0; | 535 | ret = 0; |
