projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Submitted by: "Victor B. Wagner" <vitus@cryptocom.ru>
[oweals/openssl.git]
/
apps
/
s_socket.c
diff --git
a/apps/s_socket.c
b/apps/s_socket.c
index b5dd47d76bbb100bb7d99784fd4bfdd372d96f4a..b5f9db3062ea3a300c8a97bbfbf7eebe420471b6 100644
(file)
--- a/
apps/s_socket.c
+++ b/
apps/s_socket.c
@@
-87,8
+87,12
@@
typedef unsigned int u_int;
#ifndef OPENSSL_NO_SOCK
#ifndef OPENSSL_NO_SOCK
+#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK)
+#include "netdb.h"
+#endif
+
static struct hostent *GetHostByName(char *name);
static struct hostent *GetHostByName(char *name);
-#if defined(OPENSSL_SYS_WINDOWS) ||
defined(OPENSSL_SYS_NETWARE
)
+#if defined(OPENSSL_SYS_WINDOWS) ||
(defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
)
static void ssl_sock_cleanup(void);
#endif
static int ssl_sock_init(void);
static void ssl_sock_cleanup(void);
#endif
static int ssl_sock_init(void);
@@
-104,7
+108,7
@@
static int host_ip(char *str, unsigned char ip[4]);
#define SOCKET_PROTOCOL IPPROTO_TCP
#endif
#define SOCKET_PROTOCOL IPPROTO_TCP
#endif
-#if
def OPENSSL_SYS_NETWARE
+#if
defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
static int wsa_init_done=0;
#endif
static int wsa_init_done=0;
#endif
@@
-156,7
+160,7
@@
static void ssl_sock_cleanup(void)
WSACleanup();
}
}
WSACleanup();
}
}
-#elif defined(OPENSSL_SYS_NETWARE)
+#elif defined(OPENSSL_SYS_NETWARE)
&& !defined(NETWARE_BSDSOCK)
static void sock_cleanup(void)
{
if (wsa_init_done)
static void sock_cleanup(void)
{
if (wsa_init_done)
@@
-199,7
+203,7
@@
static int ssl_sock_init(void)
SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
#endif /* OPENSSL_SYS_WIN16 */
}
SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
#endif /* OPENSSL_SYS_WIN16 */
}
-#elif defined(OPENSSL_SYS_NETWARE)
+#elif defined(OPENSSL_SYS_NETWARE)
&& !defined(NETWARE_BSDSOCK)
WORD wVerReq;
WSADATA wsaData;
int err;
WORD wVerReq;
WSADATA wsaData;
int err;
@@
-227,13
+231,11
@@
static int ssl_sock_init(void)
int init_client(int *sock, char *host, int port, int type)
{
unsigned char ip[4];
int init_client(int *sock, char *host, int port, int type)
{
unsigned char ip[4];
- short p=0;
if (!host_ip(host,&(ip[0])))
{
return(0);
}
if (!host_ip(host,&(ip[0])))
{
return(0);
}
- if (p != 0) port=p;
return(init_client_ip(sock,ip,port,type));
}
return(init_client_ip(sock,ip,port,type));
}
@@
-262,7
+264,7
@@
static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
if (s == INVALID_SOCKET) { perror("socket"); return(0); }
if (s == INVALID_SOCKET) { perror("socket"); return(0); }
-#if
ndef OPENSSL_SYS_MPE
+#if
defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE)
if (type == SOCK_STREAM)
{
i=0;
if (type == SOCK_STREAM)
{
i=0;
@@
-272,16
+274,16
@@
static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
#endif
if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
#endif
if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
- { close(s); perror("connect"); return(0); }
+ { close
socket
(s); perror("connect"); return(0); }
*sock=s;
return(1);
}
*sock=s;
return(1);
}
-int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), char *context)
+int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context),
unsigned
char *context)
{
int sock;
char *name = NULL;
{
int sock;
char *name = NULL;
- int accept_socket;
+ int accept_socket
= 0
;
int i;
if (!init_server(&accept_socket,port,type)) return(0);
int i;
if (!init_server(&accept_socket,port,type)) return(0);
@@
-398,7
+400,7
@@
redoit:
ret=accept(acc_sock,(struct sockaddr *)&from,(void *)&len);
if (ret == INVALID_SOCKET)
{
ret=accept(acc_sock,(struct sockaddr *)&from,(void *)&len);
if (ret == INVALID_SOCKET)
{
-#if defined(OPENSSL_SYS_WINDOWS) ||
defined(OPENSSL_SYS_NETWARE
)
+#if defined(OPENSSL_SYS_WINDOWS) ||
(defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
)
i=WSAGetLastError();
BIO_printf(bio_err,"accept error %d\n",i);
#else
i=WSAGetLastError();
BIO_printf(bio_err,"accept error %d\n",i);
#else