Samba 2.0 Beta1 released !

Tim Rice tim at trr.metro.NET
Mon Nov 16 18:46:09 GMT 1998


On Mon, 16 Nov 1998, Andrej Borsenkow wrote:

> 
> >
> > I've also attached a patch I'd like to see included to adress the fact
> > that some vendors have changed the socket API so that call-by-reference
> > parameters that give buffer lengths are not int.
> >
> 
> 
> Unfortunately, the patch as is is wrong. It unconditionally resets agrument
> to size_t. In our case e.g., the system provides two environments (32 bits
> and 64 bits); the argument is size_t in 32 bits case, and int in 64 bits
> case. Setting it to size_t in 64bit environment will break all possible
> things (size_t is 64 bit long in this case). The test for ostype is porbably
> too generic to handle such things.

It only sets it to size_t for System V release 4.2 and System V release 5
machines.
All others default to int like before.
---< include/includes.h >----
	#ifdef SOCKARGLENTYPE
        	typedef SOCKARGLENTYPE socklen_t;
	#else
        	typedef int socklen_t;
	#endif
I see below the output of config.guess on your machine is mips-sni-sysv4.
My patch would not reset to size_t  on your platform.
------< configure.in >----
	*sysv4.2*) AC_CHECK_LIB(resolv, strcasecmp)
 	 ^^^^^^^
        	AC_DEFINE(SOCKARGLENTYPE,size_t)
                	;;

> 
> Perl does the same check for several socket functions. The idea is as
> following:
> 
> #include <sys/socket.h>
> 
> int getsockopt(int socket,
>                 int level,
>                 int option_name,
>                 void *option_value,
>                 size_t *option_len)
> {
> }
> 
> With well-behaving C-Compiler this code will *not* compile, because of
> prototype mismatch, which is unconditional error in ANSI (if option_len has
> int * type).

The native compilers on UnixWare complain if it's an int but it compiles.

> 
> BTW you test for strncasecmp in -lresolv in case of SVR4.2. Our system is
> autoconf'ed as mips-sni-sysv4, but still has str[n]casecmp in -resolv as
> well. May be, test just for *sysv4*?

Maybe what we need in configure.in is
 *sysv4*) AC_CHECK_LIB(resolv, strcasecmp);;
 *sysv4.2*) AC_DEFINE(SOCKARGLENTYPE,size_t);;
 *sysv5*) AC_DEFINE(SOCKARGLENTYPE,size_t);;

> 
> /andrej
> 
> 

-- 
Tim Rice			Multitalents	(707) 887-1469 (voice)
tim at trr.metro.net



More information about the samba-technical mailing list