[19653] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: Port on AIX 32bit : unsigned int len; and __ulong32_t socklen_t

daemon@ATHENA.MIT.EDU (Robbie Harwood)
Wed Aug 30 12:38:30 2017

From: Robbie Harwood <rharwood@redhat.com>
To: "REIX\, Tony" <tony.reix@atos.net>, "krbdev\@mit.edu" <krbdev@mit.edu>
In-Reply-To: <B37989F2852398498001550C29155BE5178C9ED2@FRCRPVV9EX3MSX.ww931.my-it-solutions.net>
Date: Wed, 30 Aug 2017 12:38:53 -0400
Message-ID: <jlg7exl2eoy.fsf@redhat.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6138833706233437128=="
Errors-To: krbdev-bounces@mit.edu

--===============6138833706233437128==
Content-Type: multipart/signed; boundary="=-=-=";
	micalg=pgp-sha256; protocol="application/pgp-signature"

--=-=-=
Content-Type: text/plain

"REIX, Tony" <tony.reix@atos.net> writes:

> Hi,
>
> On AIX, in:
>   src/appl/simple/client/sim_client.c
>   src/appl/simple/server/sim_server.c
>
> the following definition works in 64bit but not in 32bit:
>    unsigned int len;
>   if (getsockname(sock, (struct sockaddr *)&c_sock, &len) < 0) {
>
> This is due to:
>   /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed/sys/socket.h :
>   int     getsockname(int, struct sockaddr *__restrict__, socklen_t *__restrict__);
>   typedef __ulong32_t socklen_t;
> and:
>   /usr/include/inttypes.h
> #ifdef __64BIT__
> typedef unsigned int    __ulong32_t;
> #else
> typedef unsigned long   __ulong32_t;
> #endif /* __64BIT__ */
>
>
> I do not know what happens on Linux/x86_64 in 32bit.
> I'm looking at Linux/x86_64 now, using krb5-1.15.1-8.fc26.spec.
> However I think that it builds by default in 64bit.

krb5-1.15.1 builds fine on both 32 and 64-bit Linux.  POSIX[1] states:

     <sys/socket.h> makes available a type, socklen_t, which is an
     unsigned opaque integral type of length of at least 32 bits. To
     forestall portability problems, it is recommended that applications
     should not use values larger than 2^32 - 1.

> Moreover:
>   - /root/rpmbuild/BUILD/gcc-7.1.0/fixincludes/tests/base/sys/socket.h
>           does not contain any definition for getsockname()

I would expect that to be at /usr/include/sys/socket.h on Fedora, and
it's declared as:

    /* Put the local address of FD into *ADDR and its length in *LEN.  */
    extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
                            socklen_t *__restrict __len) __THROW;

(It comes out of the glibc-headers package.)

> So: if krb5 on Linux is always built in 64bit, and never in 32bit, the issue does not appear.
> However, maybe that, even in 32bit, the issue does not appear. Unless
> some # if __WORDSIZE == 64  is required ?

krb5 has abstraction around getsockname's third type.  The #define to
look for is GETSOCKNAME_ARG3_TYPE; there are some rules in aclocal.m4
for determining it.

Thanks,
--Robbie

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAlmm6h0ACgkQJTL5F2qV
pELrKA/+KTV8cvpv5VBoek1W2bqQ0GFRYpz+ut+8FeULypkDkXoSzoEVwBeOKwDE
5tp0a57JvHNJcli2jwPFXb2QNTzh6WLWJ//IAaJkZRZw7P0QICRKD5B8aTXU2QYU
l5SRMDqKAVJhKNuYhN1d/RLmea+2BYNVgFb8ruwBYkizWWr5IkVirhXjUkrImHGY
gRg8V33ivCl77/axRZf/zNcmuNRQQzr9KtEawS2gh/pTKSwrqHP9tXtYaoOpamb1
dSmnGgvyqhXjEWAOLSrc0zen9QdrhMNmcis2rJF/TPupXOmeI5gD3N3BSd1d8uZ4
eRmvjrkGBFUBog8x4WvuyTIcnMOqPasujcoba5FN3XbCW1VZvhNs1+dpN8bCl4vC
DPrSWI04pnZb88SmGMhCCZRWUCInDiZvoKNgdcTpdj7QhCER/etij1jC8cK2jW5F
FMx526qLL5UCn+eoYN494yOgSG1wXoeI8HOkClDxN17GpndUWGwB7i9mwXQYpBX8
QaExXNBf5P34i6gJ93AskU94zKCkXhE0WAx0dXqAnKv6XEQ6QUf3paGn5KQ5nfWX
5GoITCFq1tfQADl21oKL+5UezaqFAzixz1riOaCfKrTIPt2PyDAlUETkXfL8XAZH
aSO2sst4704H5WxA6gttf+zxK4doQoIbvwb2txnYLcSjT6uOW/0=
=wAcy
-----END PGP SIGNATURE-----
--=-=-=--

--===============6138833706233437128==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
krbdev mailing list             krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev

--===============6138833706233437128==--

home help back first fref pref prev next nref lref last post