Is samba 64bit safe ? (PR#19852)

Darren Reed darrenr at telnetmedia.com
Thu Aug 26 13:49:13 GMT 1999


> 
> darrenr at telnetmedia.com wrote:
> > Attempting to run swat on Solaris7/64bit compiled with SUNWspro5.0 to
> > generate 64bit binaries results in empty documents being served by
> > swat.  Is this application 64bit-safe ?
> 
> Status report:
>   I've found a problem which is **sometimes** reproducable
> on Solaris 7, using swat with the -xarch=v9 compiler option.
>   In  password_check() in pass_check.c, in the HAVE_CRYPT case,
> the strcmp of crypt(password,this_salt) with this_crypted will
> segfault when attempting to load the first character
> pointed to by the return value of crypt.
>   Alas, this is reproduceable only some of the time, as is
> experiments with a smaller snippet of crypt-using code.
> 
>   A possible workaround is to add the declaration 
> "char *crypt(char *, char *)" to the beginning of the code block.
> This caused the swat application to operate properly, but I can't
> confirm whether this was the fix or whether god reached dewn from
> her heaven and whacked the program on its head.

Ack.  This sounds like a missing prototype for crypt().

C defaults the prototype to return int, so if it ain't declared, then
the compiler will make it return int, possible chopping off half of the
pointer as an int is 32 bits and pointers are 64 bits.  Common mistake.
gcc -Wstrict-prototypes -Wmissing-prototypes -Werror is called for ?

Darren


More information about the samba-technical mailing list