summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorMax Bachmann <kontakt@maxbachmann.de>2022-05-05 18:46:03 +0200
committerTomas Mraz <tomas@openssl.org>2022-11-21 10:49:52 +0100
commitdc6daead2f2111de077e2c350d999291223fe749 (patch)
treea4fe085bf37fa0941d8007b45b89773ac6df1637 /crypto
parent713f6a14e2510b9de56559f2433da3179fdc9c84 (diff)
Add config option OPENSSL_NO_UNIX_SOCK
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18256) (cherry picked from commit 081f3484593cdd3be2b7fdd8818c3f928ce729bc)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bio_addr.c20
-rw-r--r--crypto/bio/bio_local.h9
2 files changed, 11 insertions, 18 deletions
diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c
index c3f7567a58..7cfd87c088 100644
--- a/crypto/bio/bio_addr.c
+++ b/crypto/bio/bio_addr.c
@@ -89,7 +89,7 @@ int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa)
return 1;
}
#endif
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (sa->sa_family == AF_UNIX) {
memcpy(&(ap->s_un), sa, sizeof(struct sockaddr_un));
return 1;
@@ -103,7 +103,7 @@ int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
const void *where, size_t wherelen,
unsigned short port)
{
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (family == AF_UNIX) {
if (wherelen + 1 > sizeof(ap->s_un.sun_path))
return 0;
@@ -157,7 +157,7 @@ int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l)
addrptr = &ap->s_in6.sin6_addr;
}
#endif
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
else if (ap->sa.sa_family == AF_UNIX) {
len = strlen(ap->s_un.sun_path);
addrptr = &ap->s_un.sun_path;
@@ -296,7 +296,7 @@ char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric)
char *BIO_ADDR_path_string(const BIO_ADDR *ap)
{
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (ap->sa.sa_family == AF_UNIX)
return OPENSSL_strdup(ap->s_un.sun_path);
#endif
@@ -338,7 +338,7 @@ socklen_t BIO_ADDR_sockaddr_size(const BIO_ADDR *ap)
if (ap->sa.sa_family == AF_INET6)
return sizeof(ap->s_in6);
#endif
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (ap->sa.sa_family == AF_UNIX)
return sizeof(ap->s_un);
#endif
@@ -378,7 +378,7 @@ int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai)
if (bai->bai_protocol != 0)
return bai->bai_protocol;
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (bai->bai_family == AF_UNIX)
return 0;
#endif
@@ -430,7 +430,7 @@ void BIO_ADDRINFO_free(BIO_ADDRINFO *bai)
return;
#ifdef AI_PASSIVE
-# ifdef AF_UNIX
+# ifndef OPENSSL_NO_UNIX_SOCK
# define _cond bai->bai_family != AF_UNIX
# else
# define _cond 1
@@ -589,7 +589,7 @@ static int addrinfo_wrap(int family, int socktype,
(*bai)->bai_protocol = IPPROTO_TCP;
if (socktype == SOCK_DGRAM)
(*bai)->bai_protocol = IPPROTO_UDP;
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (family == AF_UNIX)
(*bai)->bai_protocol = 0;
#endif
@@ -659,7 +659,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
#if OPENSSL_USE_IPV6
case AF_INET6:
#endif
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
case AF_UNIX:
#endif
#ifdef AF_UNSPEC
@@ -671,7 +671,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
return 0;
}
-#ifdef AF_UNIX
+#ifndef OPENSSL_NO_UNIX_SOCK
if (family == AF_UNIX) {
if (addrinfo_wrap(family, socktype, host, strlen(host), 0, res))
return 1;
diff --git a/crypto/bio/bio_local.h b/crypto/bio/bio_local.h
index fcabc7b9cd..b74e950d77 100644
--- a/crypto/bio/bio_local.h
+++ b/crypto/bio/bio_local.h
@@ -33,13 +33,6 @@
# error openssl/bio.h included before bio_local.h
# endif
-/*
- * Undefine AF_UNIX on systems that define it but don't support it.
- */
-# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_VMS)
-# undef AF_UNIX
-# endif
-
# ifdef AI_PASSIVE
/*
@@ -77,7 +70,7 @@ union bio_addr_st {
struct sockaddr_in6 s_in6;
# endif
struct sockaddr_in s_in;
-# ifdef AF_UNIX
+# ifndef OPENSSL_NO_UNIX_SOCK
struct sockaddr_un s_un;
# endif
};