diff options
author | djm <> | 2008-09-06 12:17:54 +0000 |
---|---|---|
committer | djm <> | 2008-09-06 12:17:54 +0000 |
commit | 38ce604e3cc97706b876b0525ddff0121115456d (patch) | |
tree | 7ccc28afe1789ea3dbedf72365f955d5b8e105b5 /src/lib/libssl/src/crypto/bio/b_sock.c | |
parent | 12867252827c8efaa8ddd1fa3b3d6e321e2bcdef (diff) | |
download | openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.gz openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.bz2 openbsd-38ce604e3cc97706b876b0525ddff0121115456d.zip |
resolve conflicts
Diffstat (limited to 'src/lib/libssl/src/crypto/bio/b_sock.c')
-rw-r--r-- | src/lib/libssl/src/crypto/bio/b_sock.c | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index c851298d1e..ead477d8a2 100644 --- a/src/lib/libssl/src/crypto/bio/b_sock.c +++ b/src/lib/libssl/src/crypto/bio/b_sock.c | |||
@@ -56,14 +56,21 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef OPENSSL_NO_SOCK | ||
60 | |||
61 | #include <stdio.h> | 59 | #include <stdio.h> |
62 | #include <stdlib.h> | 60 | #include <stdlib.h> |
63 | #include <errno.h> | 61 | #include <errno.h> |
64 | #define USE_SOCKETS | 62 | #define USE_SOCKETS |
65 | #include "cryptlib.h" | 63 | #include "cryptlib.h" |
66 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
65 | #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK) | ||
66 | #include <netdb.h> | ||
67 | #if defined(NETWARE_CLIB) | ||
68 | #include <sys/ioctl.h> | ||
69 | NETDB_DEFINE_CONTEXT | ||
70 | #endif | ||
71 | #endif | ||
72 | |||
73 | #ifndef OPENSSL_NO_SOCK | ||
67 | 74 | ||
68 | #ifdef OPENSSL_SYS_WIN16 | 75 | #ifdef OPENSSL_SYS_WIN16 |
69 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | 76 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ |
@@ -79,7 +86,7 @@ | |||
79 | #define MAX_LISTEN 32 | 86 | #define MAX_LISTEN 32 |
80 | #endif | 87 | #endif |
81 | 88 | ||
82 | #ifdef OPENSSL_SYS_WINDOWS | 89 | #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) |
83 | static int wsa_init_done=0; | 90 | static int wsa_init_done=0; |
84 | #endif | 91 | #endif |
85 | 92 | ||
@@ -175,11 +182,11 @@ int BIO_get_port(const char *str, unsigned short *port_ptr) | |||
175 | /* Note: under VMS with SOCKETSHR, it seems like the first | 182 | /* Note: under VMS with SOCKETSHR, it seems like the first |
176 | * parameter is 'char *', instead of 'const char *' | 183 | * parameter is 'char *', instead of 'const char *' |
177 | */ | 184 | */ |
178 | s=getservbyname( | ||
179 | #ifndef CONST_STRICT | 185 | #ifndef CONST_STRICT |
180 | (char *) | 186 | s=getservbyname((char *)str,"tcp"); |
187 | #else | ||
188 | s=getservbyname(str,"tcp"); | ||
181 | #endif | 189 | #endif |
182 | str,"tcp"); | ||
183 | if(s != NULL) | 190 | if(s != NULL) |
184 | *port_ptr=ntohs((unsigned short)s->s_port); | 191 | *port_ptr=ntohs((unsigned short)s->s_port); |
185 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); | 192 | CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME); |
@@ -357,7 +364,11 @@ struct hostent *BIO_gethostbyname(const char *name) | |||
357 | #if 1 | 364 | #if 1 |
358 | /* Caching gethostbyname() results forever is wrong, | 365 | /* Caching gethostbyname() results forever is wrong, |
359 | * so we have to let the true gethostbyname() worry about this */ | 366 | * so we have to let the true gethostbyname() worry about this */ |
367 | #if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__)) | ||
368 | return gethostbyname((char*)name); | ||
369 | #else | ||
360 | return gethostbyname(name); | 370 | return gethostbyname(name); |
371 | #endif | ||
361 | #else | 372 | #else |
362 | struct hostent *ret; | 373 | struct hostent *ret; |
363 | int i,lowi=0,j; | 374 | int i,lowi=0,j; |
@@ -397,11 +408,11 @@ struct hostent *BIO_gethostbyname(const char *name) | |||
397 | /* Note: under VMS with SOCKETSHR, it seems like the first | 408 | /* Note: under VMS with SOCKETSHR, it seems like the first |
398 | * parameter is 'char *', instead of 'const char *' | 409 | * parameter is 'char *', instead of 'const char *' |
399 | */ | 410 | */ |
400 | ret=gethostbyname( | ||
401 | # ifndef CONST_STRICT | 411 | # ifndef CONST_STRICT |
402 | (char *) | 412 | ret=gethostbyname((char *)name); |
413 | # else | ||
414 | ret=gethostbyname(name); | ||
403 | # endif | 415 | # endif |
404 | name); | ||
405 | 416 | ||
406 | if (ret == NULL) | 417 | if (ret == NULL) |
407 | goto end; | 418 | goto end; |
@@ -453,9 +464,6 @@ int BIO_sock_init(void) | |||
453 | { | 464 | { |
454 | int err; | 465 | int err; |
455 | 466 | ||
456 | #ifdef SIGINT | ||
457 | signal(SIGINT,(void (*)(int))BIO_sock_cleanup); | ||
458 | #endif | ||
459 | wsa_init_done=1; | 467 | wsa_init_done=1; |
460 | memset(&wsa_state,0,sizeof(wsa_state)); | 468 | memset(&wsa_state,0,sizeof(wsa_state)); |
461 | if (WSAStartup(0x0101,&wsa_state)!=0) | 469 | if (WSAStartup(0x0101,&wsa_state)!=0) |
@@ -473,6 +481,26 @@ int BIO_sock_init(void) | |||
473 | if (sock_init()) | 481 | if (sock_init()) |
474 | return (-1); | 482 | return (-1); |
475 | #endif | 483 | #endif |
484 | |||
485 | #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
486 | WORD wVerReq; | ||
487 | WSADATA wsaData; | ||
488 | int err; | ||
489 | |||
490 | if (!wsa_init_done) | ||
491 | { | ||
492 | wsa_init_done=1; | ||
493 | wVerReq = MAKEWORD( 2, 0 ); | ||
494 | err = WSAStartup(wVerReq,&wsaData); | ||
495 | if (err != 0) | ||
496 | { | ||
497 | SYSerr(SYS_F_WSASTARTUP,err); | ||
498 | BIOerr(BIO_F_BIO_SOCK_INIT,BIO_R_WSASTARTUP); | ||
499 | return(-1); | ||
500 | } | ||
501 | } | ||
502 | #endif | ||
503 | |||
476 | return(1); | 504 | return(1); |
477 | } | 505 | } |
478 | 506 | ||
@@ -483,10 +511,16 @@ void BIO_sock_cleanup(void) | |||
483 | { | 511 | { |
484 | wsa_init_done=0; | 512 | wsa_init_done=0; |
485 | #ifndef OPENSSL_SYS_WINCE | 513 | #ifndef OPENSSL_SYS_WINCE |
486 | WSACancelBlockingCall(); | 514 | WSACancelBlockingCall(); /* Winsock 1.1 specific */ |
487 | #endif | 515 | #endif |
488 | WSACleanup(); | 516 | WSACleanup(); |
489 | } | 517 | } |
518 | #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) | ||
519 | if (wsa_init_done) | ||
520 | { | ||
521 | wsa_init_done=0; | ||
522 | WSACleanup(); | ||
523 | } | ||
490 | #endif | 524 | #endif |
491 | } | 525 | } |
492 | 526 | ||