Re: libwrap bug?
On Sun, Aug 18, 2002 at 12:55:27AM -0400, Yuri Victorovich wrote: Is it a bug that function sock_host is declared sock_host() in /usr/include/tcpd.h but defined as sock_host(struct request_info *) in /usr/src/contrib/tcp_wrappers/socket.c ? A fucntion which is declared with no arguments (eg sock_host()) is assumed to be a function defined in the KR way. Argument number and types don't need to be known. To decalre a function which takes no arguments (and which has an ANSI style definition) you say function(void). So this prototype is correct because the definition in socket.c is a KR definition. Bruce tells me that gcc has some magic which allows KR function definitions to work OK with ANSI prototypes, as long as the prototype is visable both where the function is defined and where then function is used. Otherwise, mixing KR and ANSI can have unexpected side effects. MySQL on Alpha gives unaligned access... error because they use it w/out an argument and actual libwrap expects an argument. The bug would seem to be calling sock_host without an argument. I've been considering adding ANSI prototypes to tcpd.h, so we get more useful warnings from it. David. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: libwrap bug?
David, A fucntion which is declared with no arguments (eg sock_host()) is assumed to be a function defined in the KR way. Argument number and types don't need to be known. To decalre a function which takes no arguments (and which has an ANSI style definition) you say function(void). So this prototype is correct because the definition in socket.c is a KR definition. Such KR way to declare functions sounds like an open invitation for bugs. MySQL on Alpha gives unaligned access... error because they use it w/out an argument and actual libwrap expects an argument. The bug would seem to be calling sock_host without an argument. C++ complains if function was declared KR style and used correctly. So I had to change those declarations in tcpd.h to compile correctly. I've been considering adding ANSI prototypes to tcpd.h, so we get more useful warnings from it. Yes, please add them! Right now MySQL calls functions the wrong way but due to the specifics of i386 assembly they get away with this. Since compiler pushes this argument to stack before calling them for some function following later on. So they use it as if it was theirs )) And Alpha code is built differently so this bug comes up. Regards, Yuri. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: libwrap bug?
Such KR way to declare functions sounds like an open invitation for bugs. Agreed. I've been considering adding ANSI prototypes to tcpd.h, so we get more useful warnings from it. I have a local ISOfication (and lint cleanup) of tcp_wrappers that I've been meaning to contribute back to the author. Wanna play? :-) M -- o Mark Murray \_ O.\_Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: libwrap bug?
I've been considering adding ANSI prototypes to tcpd.h, so we get more useful warnings from it. I have a local ISOfication (and lint cleanup) of tcp_wrappers that I've been meaning to contribute back to the author. Wanna play? :-) Sure! Would appreciate if you send it to me ) Regards, Yuri. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
libwrap bug?
Is it a bug that function sock_host is declared sock_host() in /usr/include/tcpd.h but defined as sock_host(struct request_info *) in /usr/src/contrib/tcp_wrappers/socket.c ? Good question also why compiler passes this and doesn't issue even a warning when I call it with the argument. MySQL on Alpha gives unaligned access... error because they use it w/out an argument and actual libwrap expects an argument. Yuri. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message