[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#3704) slapd: socket problem using gcc elf-64



On Sat, Sep 17, 2005 at 10:09:57PM +0000, h.b.furuseth@usit.uio.no wrote:
> hyc@symas.com writes:
> >vbrindus@adexa.com wrote:
> >> (...) the thing to do is
> >> to add -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1  to CFLAGS (I also added
> >> it to CPPFLAGS, although I don't know if it's mandatory), and also add
> >> -lxnet to LDFLAGS. (...)
> >>
> > Thanks for the information. Apparently the trouble is that on the 64 bit
> > compile, sizeof(int) < sizeof(socklen_t). Since daemon.c uses socklen_t
> > and the default HPUX implementation uses int, accept() sees a zero
> > passed for the addrlen. There are probably other reasons to use
> > -D_XOPEN_SOURCE hiding in there too.
> >
> >> P.S. when compiling openldap on HP-UX 11.00 using native cc compiler (v
> >> 3.45) you could run into trouble because the usr/include/arpa/nameser.h file
> >> has a problem at line 94 (some nested comments). So better correct the file,
> >> if possible (you should need root acces for that...).
> 
> Sounds like a more portable fix - or fallback - would be for configure
> to try to compile
> 
>   #include <whatever socket files are needed>
>   int accept(int, struct sockaddr *, AC_SOCKLEN_T *);
> 
> with -DAC_SOCKLEN_T=socklen_t, if that fail then -DAC_SOCKLEN_T=int,
> if that succeeds then use int instead.
> 
> (Actually it must also try void* instead of struct sockaddr *;
> HPUX is *different*.  But that differente is harmless.)

See ITS#4629 for a patch that portably fixes this by determining the
3rd arg to accept() via autoconf. Patch against 2.3.25.

-- 
albert chin (china@thewrittenword.com)