Not always used.
[oweals/openssl.git] / crypto / bio / b_sock.c
index e4c7ee12778667ee7daa076f709530ef108a9508..e5c99c6954bceda3fead27c0a9946c8a4c3eb3d9 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
@@ -181,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);
@@ -367,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;
@@ -407,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;
@@ -724,9 +732,9 @@ again:
 #endif
                                if (client.sa_family == AF_INET)
                                        {
-                                       struct sockaddr_in *sin6 =
+                                       struct sockaddr_in *sin4 =
                                                (struct sockaddr_in *)&client;
-                                       sin6->sin_addr.s_addr=htonl(0x7F000001);
+                                       sin4->sin_addr.s_addr=htonl(0x7F000001);
                                        }
                                else    goto err;
                                }
@@ -800,18 +808,18 @@ int BIO_accept(int sock, char **addr)
        if (addr == NULL) goto end;
 
 #ifdef EAI_FAMILY
-# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_BEOS_BONE)
-#  define SOCKLEN_T size_t
-# else
-#  define SOCKLEN_T socklen_t
-#endif
        do {
        char   h[NI_MAXHOST],s[NI_MAXSERV];
        size_t nl;
        static union {  void *p;
-                       int (*f)(const struct sockaddr *,SOCKLEN_T,
+                       int (*f)(const struct sockaddr *,size_t/*socklen_t*/,
                                 char *,size_t,char *,size_t,int);
                        } p_getnameinfo = {NULL};
+                       /* 2nd argument to getnameinfo is specified to
+                        * be socklen_t. Unfortunately there is a number
+                        * of environments where socklen_t is not defined.
+                        * As it's passed by value, it's safe to pass it
+                        * as size_t... <appro> */
 
        if (p_getnameinfo.p==NULL)
                {