summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/s_socket.c
diff options
context:
space:
mode:
authortb <>2021-08-29 12:33:15 +0000
committertb <>2021-08-29 12:33:15 +0000
commit3958737f5fc329b07f544deb10827ed41270c9e0 (patch)
tree1efbd8b53fbcab129721e03799552eb949d13bb2 /src/usr.bin/openssl/s_socket.c
parent8f799e7126310d2baff5f3f8aa6f0832a10de650 (diff)
downloadopenbsd-3958737f5fc329b07f544deb10827ed41270c9e0.tar.gz
openbsd-3958737f5fc329b07f544deb10827ed41270c9e0.tar.bz2
openbsd-3958737f5fc329b07f544deb10827ed41270c9e0.zip
Implement -naccept in the s_server.
doc fixes/ok jmc ok beck
Diffstat (limited to 'src/usr.bin/openssl/s_socket.c')
-rw-r--r--src/usr.bin/openssl/s_socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c
index 5d90fad8bb..f22c88d228 100644
--- a/src/usr.bin/openssl/s_socket.c
+++ b/src/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_socket.c,v 1.11 2019/06/28 13:35:02 deraadt Exp $ */ 1/* $OpenBSD: s_socket.c,v 1.12 2021/08/29 12:33:15 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -132,7 +132,7 @@ init_client(int *sock, char *host, char *port, int type, int af)
132int 132int
133do_server(int port, int type, int *ret, 133do_server(int port, int type, int *ret,
134 int (*cb) (char *hostname, int s, unsigned char *context), 134 int (*cb) (char *hostname, int s, unsigned char *context),
135 unsigned char *context) 135 unsigned char *context, int naccept)
136{ 136{
137 int sock; 137 int sock;
138 char *name = NULL; 138 char *name = NULL;
@@ -161,7 +161,9 @@ do_server(int port, int type, int *ret,
161 shutdown(sock, SHUT_RDWR); 161 shutdown(sock, SHUT_RDWR);
162 close(sock); 162 close(sock);
163 } 163 }
164 if (i < 0) { 164 if (naccept != -1)
165 naccept--;
166 if (i < 0 || naccept == 0) {
165 shutdown(accept_socket, SHUT_RDWR); 167 shutdown(accept_socket, SHUT_RDWR);
166 close(accept_socket); 168 close(accept_socket);
167 return (i); 169 return (i);