summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbluhm <>2018-02-07 00:52:05 +0000
committerbluhm <>2018-02-07 00:52:05 +0000
commit70a4688a408d2aa484ee8e0d1089ff3eb2ee8be8 (patch)
treed50272f84dc96bd54ae90bd6cad6e417c0788c9e
parent67525b4c1245bbe7564b202233fa947e15468586 (diff)
downloadopenbsd-70a4688a408d2aa484ee8e0d1089ff3eb2ee8be8.tar.gz
openbsd-70a4688a408d2aa484ee8e0d1089ff3eb2ee8be8.tar.bz2
openbsd-70a4688a408d2aa484ee8e0d1089ff3eb2ee8be8.zip
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@
-rw-r--r--src/lib/libcrypto/bio/b_sock.c22
1 files changed, 12 insertions, 10 deletions
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 @@
1/* $OpenBSD: b_sock.c,v 1.68 2018/02/06 14:45:52 bluhm Exp $ */ 1/* $OpenBSD: b_sock.c,v 1.69 2018/02/07 00:52:05 bluhm Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2017 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -134,16 +134,18 @@ BIO_get_accept_socket(char *host, int bind_mode)
134 p = NULL; 134 p = NULL;
135 h = str; 135 h = str;
136 if ((p = strrchr(str, ':')) == NULL) { 136 if ((p = strrchr(str, ':')) == NULL) {
137 BIOerror(BIO_R_NO_PORT_SPECIFIED); 137 /* A string without a colon is treated as a port. */
138 goto err; 138 p = str;
139 }
140 *p++ = '\0';
141 if (*p == '\0') {
142 BIOerror(BIO_R_NO_PORT_SPECIFIED);
143 goto err;
144 }
145 if (*h == '\0' || strcmp(h, "*") == 0)
146 h = NULL; 139 h = NULL;
140 } else {
141 *p++ = '\0';
142 if (*p == '\0') {
143 BIOerror(BIO_R_NO_PORT_SPECIFIED);
144 goto err;
145 }
146 if (*h == '\0' || strcmp(h, "*") == 0)
147 h = NULL;
148 }
147 149
148 if ((error = getaddrinfo(h, p, &hints, &res)) != 0) { 150 if ((error = getaddrinfo(h, p, &hints, &res)) != 0) {
149 ERR_asprintf_error_data("getaddrinfo: '%s:%s': %s'", h, p, 151 ERR_asprintf_error_data("getaddrinfo: '%s:%s': %s'", h, p,