This commit was manufactured by cvs2svn to create branch
[oweals/openssl.git] / crypto / bio / b_sock.c
index 710a8d6d962518ea4af07c10ef4d026c8aac7487..0eee25a0bc9b44742ff1fb12ccaf8879ab47065f 100644 (file)
 #include "cryptlib.h"
 #include <openssl/bio.h>
 #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK)
-#include "netdb.h"
+#include <netdb.h>
+#if defined(NETWARE_CLIB)
+#include <sys/ioctl.h>
+NETDB_DEFINE_CONTEXT
+#endif
 #endif
 
 #ifndef OPENSSL_NO_SOCK
 static int wsa_init_done=0;
 #endif
 
+#if defined(OPENSSL_SYS_BEOS_BONE)             
+/* BONE's IP6 support is incomplete */
+#undef AF_INET6
+#endif
+
 #if 0
 static unsigned long BIO_ghbn_hits=0L;
 static unsigned long BIO_ghbn_miss=0L;
@@ -176,11 +185,11 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
                /* Note: under VMS with SOCKETSHR, it seems like the first
                 * parameter is 'char *', instead of 'const char *'
                 */
-               s=getservbyname(
 #ifndef CONST_STRICT
-                   (char *)
+               s=getservbyname((char *)str,"tcp");
+#else
+               s=getservbyname(str,"tcp");
 #endif
-                   str,"tcp");
                if(s != NULL)
                        *port_ptr=ntohs((unsigned short)s->s_port);
                CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME);
@@ -220,6 +229,10 @@ int BIO_sock_error(int sock)
        int j,i;
        int size;
                 
+#if defined(OPENSSL_SYS_BEOS_R5)
+       return 0;
+#endif
+                
        size=sizeof(int);
        /* Note: under Windows the third parameter is of type (char *)
         * whereas under other systems it is (void *) if you don't have
@@ -358,7 +371,11 @@ struct hostent *BIO_gethostbyname(const char *name)
 #if 1
        /* Caching gethostbyname() results forever is wrong,
         * so we have to let the true gethostbyname() worry about this */
+#if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__))
+       return gethostbyname((char*)name);
+#else
        return gethostbyname(name);
+#endif
 #else
        struct hostent *ret;
        int i,lowi=0,j;
@@ -398,11 +415,11 @@ struct hostent *BIO_gethostbyname(const char *name)
                /* Note: under VMS with SOCKETSHR, it seems like the first
                 * parameter is 'char *', instead of 'const char *'
                 */
-               ret=gethostbyname(
 #  ifndef CONST_STRICT
-                   (char *)
+               ret=gethostbyname((char *)name);
+#  else
+               ret=gethostbyname(name);
 #  endif
-                   name);
 
                if (ret == NULL)
                        goto end;
@@ -454,9 +471,6 @@ int BIO_sock_init(void)
                {
                int err;
          
-#ifdef SIGINT
-               signal(SIGINT,(void (*)(int))BIO_sock_cleanup);
-#endif
                wsa_init_done=1;
                memset(&wsa_state,0,sizeof(wsa_state));
                /* Not making wsa_state available to the rest of the
@@ -487,11 +501,6 @@ int BIO_sock_init(void)
 
     if (!wsa_init_done)
     {
-   
-# ifdef SIGINT
-        signal(SIGINT,(void (*)(int))BIO_sock_cleanup);
-# endif
-
         wsa_init_done=1;
         wVerReq = MAKEWORD( 2, 0 );
         err = WSAStartup(wVerReq,&wsaData);
@@ -513,7 +522,7 @@ void BIO_sock_cleanup(void)
        if (wsa_init_done)
                {
                wsa_init_done=0;
-#ifndef OPENSSL_SYS_WINCE
+#if 0          /* this call is claimed to be non-present in Winsock2 */
                WSACancelBlockingCall();
 #endif
                WSACleanup();
@@ -799,7 +808,7 @@ int BIO_accept(int sock, char **addr)
        if (addr == NULL) goto end;
 
 #ifdef EAI_FAMILY
-# ifdef OPENSSL_SYS_VMS
+# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_BEOS_BONE) || defined(OPENSSL_SYS_MSDOS)
 #  define SOCKLEN_T size_t
 # else
 #  define SOCKLEN_T socklen_t