diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2023-05-23 21:54:26 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2023-08-15 20:41:26 +0200 |
commit | 830b6a13f9aecd42da61b79c93f236575cc58793 (patch) | |
tree | a5d86912172ca10e58898c23da8cce8377a1ab5a /apps/lib | |
parent | Fix a leak in an error path in OSSL_DECODER_CTX_new_for_pkey() (diff) | |
download | openssl-830b6a13f9aecd42da61b79c93f236575cc58793.tar.xz openssl-830b6a13f9aecd42da61b79c93f236575cc58793.zip |
http_server.c: allow clients to connect with IPv6
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/21033)
Diffstat (limited to 'apps/lib')
-rw-r--r-- | apps/lib/http_server.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/lib/http_server.c b/apps/lib/http_server.c index 5c26497abc..93f06626fb 100644 --- a/apps/lib/http_server.c +++ b/apps/lib/http_server.c @@ -198,7 +198,9 @@ BIO *http_server_init(const char *prog, const char *port, int verb) BIO *acbio = NULL, *bufbio; int asock; int port_num; + char name[40]; + snprintf(name, sizeof(name), "[::]:%s", port); /* port may be "0" */ if (verb >= 0 && !log_set_verbosity(prog, verb)) return NULL; bufbio = BIO_new(BIO_f_buffer()); @@ -207,7 +209,7 @@ BIO *http_server_init(const char *prog, const char *port, int verb) acbio = BIO_new(BIO_s_accept()); if (acbio == NULL || BIO_set_bind_mode(acbio, BIO_BIND_REUSEADDR) < 0 - || BIO_set_accept_port(acbio, port /* may be "0" */) < 0) { + || BIO_set_accept_name(acbio, name) < 0) { log_HTTP(prog, LOG_ERR, "error setting up accept BIO"); goto err; } |