From 70a4688a408d2aa484ee8e0d1089ff3eb2ee8be8 Mon Sep 17 00:00:00 2001 From: bluhm <> Date: Wed, 7 Feb 2018 00:52:05 +0000 Subject: Restore the old behavior when a port number without a host name is passed to BIO_get_accept_socket(). This is part of the API and it fixes "openssl ocsp -port 12345" in server mode. from markus@; OK jsing@ beck@ --- src/lib/libcrypto/bio/b_sock.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index cfa48c6860..152b080902 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b_sock.c,v 1.68 2018/02/06 14:45:52 bluhm Exp $ */ +/* $OpenBSD: b_sock.c,v 1.69 2018/02/07 00:52:05 bluhm Exp $ */ /* * Copyright (c) 2017 Bob Beck * @@ -134,16 +134,18 @@ BIO_get_accept_socket(char *host, int bind_mode) p = NULL; h = str; if ((p = strrchr(str, ':')) == NULL) { - BIOerror(BIO_R_NO_PORT_SPECIFIED); - goto err; - } - *p++ = '\0'; - if (*p == '\0') { - BIOerror(BIO_R_NO_PORT_SPECIFIED); - goto err; - } - if (*h == '\0' || strcmp(h, "*") == 0) + /* A string without a colon is treated as a port. */ + p = str; h = NULL; + } else { + *p++ = '\0'; + if (*p == '\0') { + BIOerror(BIO_R_NO_PORT_SPECIFIED); + goto err; + } + if (*h == '\0' || strcmp(h, "*") == 0) + h = NULL; + } if ((error = getaddrinfo(h, p, &hints, &res)) != 0) { ERR_asprintf_error_data("getaddrinfo: '%s:%s': %s'", h, p, -- cgit v1.2.3-55-g6feb