X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=apps%2Fs_socket.c;h=a04b990540c94750a28bfb1f50fa720c0212b6dd;hp=209958ab908b0e8bcc3eb0506cc080da12e1927f;hb=e933f91f50108a43c0198cdc63ecdfdbc77b4d0d;hpb=0c4e67102eb8a05ab1f6673b670a09ce89aeb568 diff --git a/apps/s_socket.c b/apps/s_socket.c index 209958ab90..a04b990540 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -235,10 +235,8 @@ int init_client(int *sock, char *host, int port, int type) ip[0] = ip[1] = ip[2] = ip[3] = 0; if (!host_ip(host,&(ip[0]))) - { - return(0); - } - return(init_client_ip(sock,ip,port,type)); + return 0; + return init_client_ip(sock,ip,port,type); } static int init_client_ip(int *sock, const unsigned char ip[4], int port, @@ -282,7 +280,7 @@ static int init_client_ip(int *sock, const unsigned char ip[4], int port, return(1); } -int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context) +int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, int stype, unsigned char *context), unsigned char *context, int naccept) { int sock; char *name = NULL; @@ -300,7 +298,11 @@ int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, uns { if (type==SOCK_STREAM) { +#ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL + if (do_accept(accept_socket,&sock,NULL) == 0) +#else if (do_accept(accept_socket,&sock,&name) == 0) +#endif { SHUTDOWN(accept_socket); return(0); @@ -308,11 +310,13 @@ int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, uns } else sock = accept_socket; - i=(*cb)(name,sock, context); + i=(*cb)(name,sock, type, context); if (name != NULL) OPENSSL_free(name); if (type==SOCK_STREAM) SHUTDOWN2(sock); - if (i < 0) + if (naccept != -1) + naccept--; + if (i < 0 || naccept == 0) { SHUTDOWN2(accept_socket); return(i);