summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-05-22 11:59:44 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-05-29 07:47:03 +0200
commitd357dd51cbea662792b0816f441718b7fb66bd49 (patch)
treec2db31484ec52e6c5a5282a078c1f25477507c52 /apps
parent189c4759ebb7eefe6c8edb0a5493dc4082f45696 (diff)
apps/lib/s_socket.c and 80-test_cmp_http.t: Make ACCEPT port reporting more robust
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15417)
Diffstat (limited to 'apps')
-rw-r--r--apps/lib/s_socket.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/lib/s_socket.c b/apps/lib/s_socket.c
index f543551bf1..fbe913e37a 100644
--- a/apps/lib/s_socket.c
+++ b/apps/lib/s_socket.c
@@ -195,6 +195,8 @@ int report_server_accept(BIO *out, int asock, int with_address)
{
int success = 0;
+ if (BIO_printf(out, "ACCEPT") <= 0)
+ return 0;
if (with_address) {
union BIO_sock_info_u info;
char *hostname = NULL;
@@ -206,16 +208,17 @@ int report_server_accept(BIO *out, int asock, int with_address)
&& (service = BIO_ADDR_service_string(info.addr, 1)) != NULL
&& BIO_printf(out,
strchr(hostname, ':') == NULL
- ? /* IPv4 */ "ACCEPT %s:%s\n"
- : /* IPv6 */ "ACCEPT [%s]:%s\n",
+ ? /* IPv4 */ " %s:%s\n"
+ : /* IPv6 */ " [%s]:%s\n",
hostname, service) > 0)
success = 1;
+ else
+ (void)BIO_printf(out, "unknown:error\n");
OPENSSL_free(hostname);
OPENSSL_free(service);
BIO_ADDR_free(info.addr);
- } else {
- (void)BIO_printf(out, "ACCEPT\n");
+ } else if (BIO_printf(out, "\n") > 0) {
success = 1;
}
(void)BIO_flush(out);