Hi,
the following patch makes stunnel 4.20 to operate with TCP wrappers 7.6. I had not tried other versions of stunnel nor TCP wrappers.
The problem is the missing libnsl, so TCP wrappers will never be activated in ./configure
Regards Dieter
--- configure.ac.orig 2007-03-17 12:57:32.000000000 +0100 +++ configure.ac 2007-03-17 12:55:19.000000000 +0100 @@ -310,7 +310,7 @@ AC_MSG_RESULT([no (autodetecting)]) AC_MSG_CHECKING([for hosts_access in -lwrap]) saved_LIBS="$LIBS" - LIBS="$saved_LIBS -lwrap" + LIBS="$saved_LIBS -lwrap -lnsl" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[int hosts_access(); int allow_severity, deny_severity;]],
On Saturday 17 March 2007 13:47, lists@d-ra.ath.cx wrote:
the following patch makes stunnel 4.20 to operate with TCP wrappers 7.6. I had not tried other versions of stunnel nor TCP wrappers.
The problem is the missing libnsl, so TCP wrappers will never be activated in ./configure
[cut]
LIBS="$saved_LIBS -lwrap"
LIBS="$saved_LIBS -lwrap -lnsl"
The question is why -lnsl is not in your $saved_LIBS.
Best regards, Mike
Hi Michal,
On Sat, Mar 17, 2007 at 04:34:48PM +0100, Michal Trojnara wrote:
The question is why -lnsl is not in your $saved_LIBS.
Because it is not in $LIBS. Quote from the original configure.ac:
saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap"
If you look through configure.ac you see -lnsl ist never included in LIBS.
Regards Dieter
On Saturday 17 March 2007 19:19, lists@d-ra.ath.cx wrote:
If you look through configure.ac you see -lnsl ist never included in LIBS.
Not exactly true. The relevant macro invocation is: AC_SEARCH_LIBS(gethostbyname, nsl) I hope you understand that not every system uses nsl library like yours. 8-)
See the manual for details: http://www.gnu.org/software/autoconf/manual/html_node/Libraries.html
Best regards, Mike
Hi Mike,
On Sat, Mar 17, 2007 at 08:26:15PM +0100, Michal Trojnara wrote:
... Not exactly true. The relevant macro invocation is: AC_SEARCH_LIBS(gethostbyname, nsl)
I added the following line for debugging after
AC_SEARCH_LIBS(gethostbyname, nsl) AC_MSG_NOTICE([============>> LIBS=$LIBS])
Result: -lnsl was not added to $LIB. $LIB was empty here.
Maybe it's a problem with gethostbyname. Isn't gethostbyname a part of libc? What would happens if gethostbyname is resolved with libc?
In the manual (thanks for the link, I am a newbie to autoconf):
Search for a library defining function if it's not already available. .... first with no libraries, then for each library listed in search-libs.
"first with no libraries" ... so what happens if gethostbyname is resolved without libnsl? It won't be added :-(
I hope you understand that not every system uses nsl library like yours. 8-)
Yes, clear.
I use Linux with:
gcc (GCC) 3.4.6 glibc-2.3.6 autoconf-2.60
Kind regards Dieter
On Saturday 17 March 2007 21:35, lists@d-ra.ath.cx wrote:
Result: -lnsl was not added to $LIB. $LIB was empty here.
Maybe it's a problem with gethostbyname. Isn't gethostbyname a part of libc? What would happens if gethostbyname is resolved with libc?
In Linux - yes. In Solaris it's in libnls. In fact I'm surprised that Linux needs libnls. What function does *your* system need from libnls?
"first with no libraries" ... so what happens if gethostbyname is resolved without libnsl? It won't be added :-(
That was the goal. 8-)
gcc (GCC) 3.4.6 glibc-2.3.6 autoconf-2.60
See you config.log. It's very helpful to diagnose autoconf problems.
Best regards, Mike
Hi Mike,
On Sat, Mar 17, 2007 at 10:23:28PM +0100, Michal Trojnara wrote:
In Linux - yes. In Solaris it's in libnls. In fact I'm surprised that Linux needs libnls. What function does *your* system need from libnls?
Good question! I forced libnsl only because I wanted to enable tcp wrappers in stunnel. Without libnsl it was disabled.
See you config.log. It's very helpful to diagnose autoconf problems.
See attached gzip'ped file (12k). Hopefully that Mailman won't filter it. Otherwise you will receive it direct.
Kind regards Dieter
Hi Mike,
On Sat, Mar 17, 2007 at 10:23:28PM +0100, Michal Trojnara wrote:
On Saturday 17 March 2007 21:35, lists@d-ra.ath.cx wrote:
Result: -lnsl was not added to $LIB. $LIB was empty here.
Maybe it's a problem with gethostbyname. Isn't gethostbyname a part of libc? What would happens if gethostbyname is resolved with libc?
In Linux - yes. In Solaris it's in libnls. In fact I'm surprised that Linux needs libnls. What function does *your* system need from libnls?
OK, I see your problem with different platforms. So I have tuned the patch a little bit. Now it doesn't hardcode -lnsl in the tcp wrapper section, instead it uses AC_SEARCH_LIBS(yp_get_default_domain, nsl) to conditionally add it to LIB if not already included. So in Solaris libnsl will be added via AC_SEARCH_LIBS(gethostbyname, nsl) at line 93 in configure.ac, in Linux via AC_SEARCH_LIBS(yp_get_default_domain, nsl) in line 311 (after apply patch), but only if tcp wrappers are enabled.
Why yp_get_default_domain? Because of this error message (see config.log without patch):
gcc -o conftest -g -O2 -Wall -Wshadow -Wcast-align -Wpointer-arith -I/usr/include conftest.c -lz -ldl -lutil -lpthread -L/usr/lib -lssl -lcrypto -lwrap /usr/lib/libwrap.a(hosts_access.o)(.text+0x64f): In function `host_match': : undefined reference to `yp_get_default_domain' collect2: ld returned 1 exit status
Here the patch:
--- configure.ac.orig 2007-03-18 08:25:50.000000000 +0100 +++ configure.ac 2007-03-18 09:05:49.000000000 +0100 @@ -308,6 +308,7 @@ [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no (autodetecting)]) + AC_SEARCH_LIBS(yp_get_default_domain, nsl) AC_MSG_CHECKING([for hosts_access in -lwrap]) saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap"
Kind regards Dieter
On Sunday 18 March 2007 09:47, lists@d-ra.ath.cx wrote:
--- configure.ac.orig 2007-03-18 08:25:50.000000000 +0100 +++ configure.ac 2007-03-18 09:05:49.000000000 +0100 @@ -308,6 +308,7 @@ [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no (autodetecting)])
AC_SEARCH_LIBS(yp_get_default_domain, nsl) AC_MSG_CHECKING([for hosts_access in -lwrap]) saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap"
I like this solution. I'll include it with stunnel 4.21.
Best regards, Mike
On Sun, Mar 18, 2007 at 03:12:44PM +0100, Michal Trojnara wrote:
On Sunday 18 March 2007 09:47, lists@d-ra.ath.cx wrote:
--- configure.ac.orig 2007-03-18 08:25:50.000000000 +0100 +++ configure.ac 2007-03-18 09:05:49.000000000 +0100 @@ -308,6 +308,7 @@ [AC_MSG_RESULT([yes])], [ AC_MSG_RESULT([no (autodetecting)])
AC_SEARCH_LIBS(yp_get_default_domain, nsl) AC_MSG_CHECKING([for hosts_access in -lwrap]) saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap"
I like this solution. I'll include it with stunnel 4.21.
GREAT. Seeing forward to stunnel 4.21 :-)
Kind regards Dieter