X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=apps%2Fs_socket.c;h=d83eecb6dedfae47b6a4f2175f533f22b59c8292;hp=209958ab908b0e8bcc3eb0506cc080da12e1927f;hb=96cfba0fb46a392697295eb6c1350e3110411a75;hpb=0c4e67102eb8a05ab1f6673b670a09ce89aeb568 diff --git a/apps/s_socket.c b/apps/s_socket.c index 209958ab90..d83eecb6de 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, 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); @@ -312,7 +314,9 @@ int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, uns 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);