diff options
author | Max Bachmann <kontakt@maxbachmann.de> | 2022-05-05 18:46:03 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-07-08 14:08:45 +1000 |
commit | 081f3484593cdd3be2b7fdd8818c3f928ce729bc (patch) | |
tree | abf9752f80ddb03021ce1b2ac4bcc0c1aad99f9c /crypto/bio | |
parent | d104c6ff7499b0638c82557ce94e284b00f74627 (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)
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio_addr.c | 20 | ||||
-rw-r--r-- | crypto/bio/bio_local.h | 9 |
2 files changed, 11 insertions, 18 deletions
diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c index 92305cc7dc..b9027e684b 100644 --- a/crypto/bio/bio_addr.c +++ b/crypto/bio/bio_addr.c @@ -101,7 +101,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; @@ -115,7 +115,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; @@ -169,7 +169,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; @@ -308,7 +308,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 @@ -350,7 +350,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 @@ -390,7 +390,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 @@ -442,7 +442,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 @@ -601,7 +601,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 @@ -671,7 +671,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 @@ -683,7 +683,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 557a1d35d7..87779c8e02 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 }; |