Commit 826e1544 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

apps/s_socket.c: print only dynamically allocated port in do_server.



For formal backward compatibility print original "ACCEPT" message for
fixed port and "ACCEPT host:port" for dynamically allocated.

Reviewed-by: default avatarBernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5956)
parent dbabc862
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -283,7 +283,8 @@ int do_server(int *accept_sock, const char *host, const char *port,
    BIO_ADDRINFO_free(res);
    res = NULL;

    {
    if (BIO_ADDR_rawport(sock_address) == 0) {
        /* dynamically allocated port, report which one */
        union BIO_sock_info_u info;
        char *hostname = NULL;
        char *service = NULL;
@@ -309,6 +310,9 @@ int do_server(int *accept_sock, const char *host, const char *port,
            ERR_print_errors(bio_err);
            goto end;
        }
    } else {
        (void)BIO_printf(bio_s_out, "ACCEPT\n");
        (void)BIO_flush(bio_s_out);
    }

    if (accept_sock != NULL)