-/* $OpenBSD: b_sock.c,v 1.69 2018/02/07 00:52:05 bluhm Exp $ */
+/* $OpenBSD: b_sock.c,v 1.70 2022/12/22 20:13:45 schwarze Exp $ */
/*
* Copyright (c) 2017 Bob Beck <beck@openbsd.org>
*
int error;
if (str == NULL) {
+ BIOerror(BIO_R_BAD_HOSTNAME_LOOKUP);
ERR_asprintf_error_data("NULL host provided");
return (0);
}
}
if ((error = getaddrinfo(NULL, str, &hints, &res)) != 0) {
+ BIOerror(BIO_R_INVALID_ARGUMENT);
ERR_asprintf_error_data("getaddrinfo: service='%s' : %s'", str,
gai_strerror(error));
return (0);
char *h, *p, *str = NULL;
int error, ret = 0, s = -1;
- if (host == NULL || (str = strdup(host)) == NULL)
+ if (host == NULL) {
+ BIOerror(BIO_R_NO_PORT_SPECIFIED);
+ return (-1);
+ }
+ if ((str = strdup(host)) == NULL) {
+ BIOerror(ERR_R_MALLOC_FAILURE);
return (-1);
+ }
p = NULL;
h = str;
if ((p = strrchr(str, ':')) == NULL) {
}
if ((error = getaddrinfo(h, p, &hints, &res)) != 0) {
+ BIOerror(BIO_R_BAD_HOSTNAME_LOOKUP);
ERR_asprintf_error_data("getaddrinfo: '%s:%s': %s'", h, p,
gai_strerror(error));
goto err;
socklen_t sin_len = sizeof(sin);
int ret = -1;
- if (addr == NULL)
+ if (addr == NULL) {
+ BIOerror(BIO_R_NULL_PARAMETER);
goto end;
-
+ }
ret = accept(sock, (struct sockaddr *)&sin, &sin_len);
if (ret == -1) {
if (BIO_sock_should_retry(ret))