diff options
author | bcook <> | 2014-12-03 22:16:02 +0000 |
---|---|---|
committer | bcook <> | 2014-12-03 22:16:02 +0000 |
commit | 8ef61d3ec1c1e78bae48209c6ae8e7c7d103bdea (patch) | |
tree | e603f3b2b9b847e1ad959cceefe86bfb3d1513d9 /src/usr.bin/openssl/s_socket.c | |
parent | 3339178a7b37aca236756b5c97ee1a4fe72c768f (diff) | |
download | openbsd-8ef61d3ec1c1e78bae48209c6ae8e7c7d103bdea.tar.gz openbsd-8ef61d3ec1c1e78bae48209c6ae8e7c7d103bdea.tar.bz2 openbsd-8ef61d3ec1c1e78bae48209c6ae8e7c7d103bdea.zip |
Move Windows OS-specific functions to make porting easier.
Several functions that need to be redefined for a Windows port are right
in the middle of other code that is relatively portable. This patch
isolates the functions that need Windows-specific implementations so
they can be built conditionally in the portable tree.
Add calls to BIO_sock_init() as-needed to openssl(1) so that socket IO works on
Windows. Sorry, these are no-op on other platforms.
ok jsing@ deraadt@
Diffstat (limited to 'src/usr.bin/openssl/s_socket.c')
-rw-r--r-- | src/usr.bin/openssl/s_socket.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c index 2ce31eb5ef..7c416d69be 100644 --- a/src/usr.bin/openssl/s_socket.c +++ b/src/usr.bin/openssl/s_socket.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_socket.c,v 1.2 2014/11/06 13:46:09 jsing Exp $ */ | 1 | /* $OpenBSD: s_socket.c,v 1.3 2014/12/03 22:16:02 bcook 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 | * |
@@ -85,6 +85,11 @@ init_client(int *sock, char *host, char *port, int type, int af) | |||
85 | struct addrinfo hints, *ai_top, *ai; | 85 | struct addrinfo hints, *ai_top, *ai; |
86 | int i, s; | 86 | int i, s; |
87 | 87 | ||
88 | if (BIO_sock_init() != 1) { | ||
89 | BIO_printf(bio_err, "BIO_sock_init failed\n"); | ||
90 | return (0); | ||
91 | } | ||
92 | |||
88 | memset(&hints, '\0', sizeof(hints)); | 93 | memset(&hints, '\0', sizeof(hints)); |
89 | hints.ai_family = af; | 94 | hints.ai_family = af; |
90 | hints.ai_socktype = type; | 95 | hints.ai_socktype = type; |
@@ -176,6 +181,11 @@ init_server_long(int *sock, int port, char *ip, int type) | |||
176 | struct sockaddr_in server; | 181 | struct sockaddr_in server; |
177 | int s = -1; | 182 | int s = -1; |
178 | 183 | ||
184 | if (BIO_sock_init() != 1) { | ||
185 | BIO_printf(bio_err, "BIO_sock_init failed\n"); | ||
186 | return (0); | ||
187 | } | ||
188 | |||
179 | memset((char *) &server, 0, sizeof(server)); | 189 | memset((char *) &server, 0, sizeof(server)); |
180 | server.sin_family = AF_INET; | 190 | server.sin_family = AF_INET; |
181 | server.sin_port = htons((unsigned short) port); | 191 | server.sin_port = htons((unsigned short) port); |