#include <errno.h>
#include <signal.h>
-#include <openssl/e_os2.h>
-
/* With IPv6, it looks like Digital has mixed up the proper order of
recursive header file inclusion, resulting in the compiler complaining
that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
#include "s_apps.h"
#include <openssl/ssl.h>
+#ifdef FLAT_INC
+#include "e_os.h"
+#else
+#include "../e_os.h"
+#endif
+
+#ifndef OPENSSL_NO_SOCK
+
static struct hostent *GetHostByName(char *name);
-#ifdef OPENSSL_SYS_WINDOWS
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
static void ssl_sock_cleanup(void);
#endif
static int ssl_sock_init(void);
#define SOCKET_PROTOCOL IPPROTO_TCP
#endif
+#ifdef OPENSSL_SYS_NETWARE
+static int wsa_init_done=0;
+#endif
+
#ifdef OPENSSL_SYS_WINDOWS
static struct WSAData wsa_state;
static int wsa_init_done=0;
if (wsa_init_done)
{
wsa_init_done=0;
+#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall();
+#endif
+ WSACleanup();
+ }
+ }
+#elif defined(OPENSSL_SYS_NETWARE)
+static void sock_cleanup(void)
+ {
+ if (wsa_init_done)
+ {
+ wsa_init_done=0;
WSACleanup();
}
}
#ifdef WATT32
extern int _watt_do_exit;
_watt_do_exit = 0;
- dbug_init();
if (sock_init())
return (0);
#elif defined(OPENSSL_SYS_WINDOWS)
SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
#endif /* OPENSSL_SYS_WIN16 */
}
+#elif defined(OPENSSL_SYS_NETWARE)
+ WORD wVerReq;
+ WSADATA wsaData;
+ int err;
+
+ if (!wsa_init_done)
+ {
+
+# ifdef SIGINT
+ signal(SIGINT,(void (*)(int))sock_cleanup);
+# endif
+
+ wsa_init_done=1;
+ wVerReq = MAKEWORD( 2, 0 );
+ err = WSAStartup(wVerReq,&wsaData);
+ if (err != 0)
+ {
+ BIO_printf(bio_err,"unable to start WINSOCK2, error code=%d\n",err);
+ return(0);
+ }
+ }
#endif /* OPENSSL_SYS_WINDOWS */
return(1);
}
return(1);
}
-int do_server(int port, int *ret, int (*cb)(), char *context)
+int do_server(int port, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), char *context)
{
int sock;
char *name;
ret=accept(acc_sock,(struct sockaddr *)&from,(void *)&len);
if (ret == INVALID_SOCKET)
{
-#ifdef OPENSSL_SYS_WINDOWS
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
i=WSAGetLastError();
BIO_printf(bio_err,"accept error %d\n",i);
#else
perror("OPENSSL_malloc");
return(0);
}
- strcpy(*host,h1->h_name);
+ BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1);
h2=GetHostByName(*host);
if (h2 == NULL)
return(ret);
}
}
+
+#endif