SASL 2.1.27 pre-release 1
Ken Murchison
murch at andrew.cmu.edu
Fri Dec 9 13:50:34 EST 2016
Rather than stealing a bunch of per-platform #ifdefs from Apple, I'm
wondering if this simple typecast would work. This would essentially be
doing the same thing that happens on those platforms that use a union
inside struct in6_addr.
diff --git a/plugins/plugin_common.c b/plugins/plugin_common.c
index f2b26bd..1d633ee 100644
--- a/plugins/plugin_common.c
+++ b/plugins/plugin_common.c
@@ -94,7 +94,7 @@ static void sockaddr_unmapped(
if (!IN6_IS_ADDR_V4MAPPED((&sin6->sin6_addr)))
return;
sin4 = (struct sockaddr_in *)sa;
- addr = *(uint32_t *)&sin6->sin6_addr.s6_addr32[3];
+ addr = *(uint32_t *)&sin6->sin6_addr.s6_addr[12];
port = sin6->sin6_port;
memset(sin4, 0, sizeof(struct sockaddr_in));
sin4->sin_addr.s_addr = addr;
On 11/25/2016 04:21 PM, Julien ÉLIE via Cyrus-sasl wrote:
> Hi Ken,
>
>> Can you try this patch for OSX:
>>
>> diff --git a/plugins/plugin_common.c b/plugins/plugin_common.c
>> index f2b26bd..1211fea 100644
>> --- a/plugins/plugin_common.c
>> +++ b/plugins/plugin_common.c
>> @@ -88,6 +88,10 @@ static void sockaddr_unmapped(
>> uint32_t addr;
>> int port;
>>
>> +#if defined(__FreeBSD__) && !defined(s6_addr32)
>> +#define s6_addr32 __u6_addr.__u6_addr32
>> +#endif
>> +
>> if (sa->sa_family != AF_INET6)
>> return;
>> sin6 = (struct sockaddr_in6 *)sa;
>
> It works with "defined(__APPLE__)" instead of "defined(__FreeBSD__)".
>
> Yet, I found out there probably a better patch to integrate into Cyrus
> SASL:
> http://trillian.mit.edu/~jc/src/gs/cups/libs/cups/http.h
>
> /*
> * Oh, the wonderful world of IPv6 compatibility. Apparently some
> * implementations expose the (more logical) 32-bit address parts
> * to everyone, while others only expose it to kernel code... To
> * make supporting IPv6 even easier, each vendor chose different
> * core structure and union names, so the same defines or code
> * can't be used on all platforms.
> *
> * The following will likely need tweaking on new platforms that
> * support IPv6 - the "s6_addr32" define maps to the 32-bit integer
> * array in the in6_addr union, which is named differently on various
> * platforms.
> */
>
> #if defined(AF_INET6) && !defined(s6_addr32)
> # if defined(__sun)
> # define s6_addr32 _S6_un._S6_u32
> # elif defined(__FreeBSD__) || defined(__NetBSD__) ||
> defined(__OpenBSD__) || defined(__APPLE__)
> # define s6_addr32 __u6_addr.__u6_addr32
> # elif defined(__osf__)
> # define s6_addr32 s6_un.sa6_laddr
> # elif defined(WIN32)
> /*
> * Windows only defines byte and 16-bit word members of the union and
> * requires special casing of all raw address code...
> */
> # define s6_addr32 error_need_win32_specific_code
> # endif /* __sun */
> #endif /* AF_INET6 && !s6_addr32 */
>
>
>
>
>
>
>
> Yet, I now obtain the following error:
>
> /bin/sh ../libtool --tag=CC --mode=link gcc -Wall -W -g -O2 -o
> libobj.la -lresolv -lresolv
> libtool: link: ar cru .libs/libobj.a
> ar: no archive members specified
> usage: ar -d [-TLsv] archive file ...
> ar -m [-TLsv] archive file ...
> ar -m [-abiTLsv] position archive file ...
> ar -p [-TLsv] archive [file ...]
> ar -q [-cTLsv] archive file ...
> ar -r [-cuTLsv] archive file ...
> ar -r [-abciuTLsv] position archive file ...
> ar -t [-TLsv] archive [file ...]
> ar -x [-ouTLsv] archive [file ...]
> make[3]: *** [libobj.la] Error 1
>
>
> Maybe caused by "noinst_LTLIBRARIES" not properly defined?
>
--
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University
More information about the Cyrus-sasl
mailing list