diff options
| author | Brent Cook <bcook@openbsd.org> | 2015-03-08 18:27:07 -0500 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2015-03-08 22:02:54 -0500 |
| commit | f7e4e4a2666aa5ea39536d425206e680d76769d9 (patch) | |
| tree | 13aa6671d47049af239073b96d907d63713f90c4 /patches | |
| parent | 031f0aaa8f9b2e907195dbda8b7c451a08d58bbb (diff) | |
| download | portable-f7e4e4a2666aa5ea39536d425206e680d76769d9.tar.gz portable-f7e4e4a2666aa5ea39536d425206e680d76769d9.tar.bz2 portable-f7e4e4a2666aa5ea39536d425206e680d76769d9.zip | |
initialize winsock earlier in openssl(1)
This allows commands like ocsp to work properly since we no longer
initialize Winsock as a side-effect of doing a BIO_gethostbyname.
Diffstat (limited to 'patches')
| -rw-r--r-- | patches/win_bio_sock_init.diff | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/patches/win_bio_sock_init.diff b/patches/win_bio_sock_init.diff new file mode 100644 index 0000000..e0221b9 --- /dev/null +++ b/patches/win_bio_sock_init.diff | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c | ||
| 2 | index e7dd11c..cfd4593 100644 | ||
| 3 | --- a/src/usr.bin/openssl/openssl.c | ||
| 4 | +++ b/src/usr.bin/openssl/openssl.c | ||
| 5 | @@ -253,6 +253,11 @@ main(int argc, char **argv) | ||
| 6 | arg.data = NULL; | ||
| 7 | arg.count = 0; | ||
| 8 | |||
| 9 | + if (BIO_sock_init() != 1) { | ||
| 10 | + fprintf(stderr, "BIO_sock_init failed\n"); | ||
| 11 | + exit(1); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); | ||
| 15 | if (bio_err == NULL) { | ||
| 16 | fprintf(stderr, "openssl: failed to initialise bio_err\n"); | ||
| 17 | diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c | ||
| 18 | index 3b96b1a..2ce31eb 100644 | ||
| 19 | --- a/src/usr.bin/openssl/s_socket.c | ||
| 20 | +++ b/src/usr.bin/openssl/s_socket.c | ||
| 21 | @@ -85,11 +85,6 @@ init_client(int *sock, char *host, char *port, int type, int af) | ||
| 22 | struct addrinfo hints, *ai_top, *ai; | ||
| 23 | int i, s; | ||
| 24 | |||
| 25 | - if (BIO_sock_init() != 1) { | ||
| 26 | - BIO_printf(bio_err, "BIO_sock_init failed\n"); | ||
| 27 | - return (0); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | memset(&hints, '\0', sizeof(hints)); | ||
| 31 | hints.ai_family = af; | ||
| 32 | hints.ai_socktype = type; | ||
| 33 | @@ -181,11 +176,6 @@ init_server_long(int *sock, int port, char *ip, int type) | ||
| 34 | struct sockaddr_in server; | ||
| 35 | int s = -1; | ||
| 36 | |||
| 37 | - if (BIO_sock_init() != 1) { | ||
| 38 | - BIO_printf(bio_err, "BIO_sock_init failed\n"); | ||
| 39 | - return (0); | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | memset((char *) &server, 0, sizeof(server)); | ||
| 43 | server.sin_family = AF_INET; | ||
| 44 | server.sin_port = htons((unsigned short) port); | ||
