[patch] openssh 3.0.2p1: Libwrap gets linked in unnecessarily

Maciej W. Rozycki macro at ds2.pg.gda.pl
Sat Jan 19 03:55:28 EST 2002


Hello,

 There is a small but annoying problem with linking libwrap in openssh.
The library is added to LIBS which makes it be linked in to all binaries.
This is unnecessary and leads to bogus dependencies if libwrap is a shared
library.

 Following is a trivial fix that reserves a separate autoconf substitution
variable LIBWRAP, which is only used for sshd.  Please apply. 

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro at ds2.pg.gda.pl, PGP key available        +

openssh-3.0.1p1-libwrap.patch
diff -up --recursive --new-file openssh-3.0.1p1.macro/Makefile.in openssh-3.0.1p1/Makefile.in
--- openssh-3.0.1p1.macro/Makefile.in	Sun Nov 11 23:34:23 2001
+++ openssh-3.0.1p1/Makefile.in	Wed Dec 19 21:34:07 2001
@@ -30,6 +30,7 @@ LD=@LD@
 CFLAGS=@CFLAGS@
 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
 LIBS=@LIBS@
+LIBWRAP=@LIBWRAP@
 AR=@AR@
 RANLIB=@RANLIB@
 INSTALL=@INSTALL@
@@ -98,7 +99,7 @@ ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SS
 	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
 
 sshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
-	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBWRAP)
 
 scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o
 	$(LD) -o $@ scp.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
diff -up --recursive --new-file openssh-3.0.1p1.macro/configure.ac openssh-3.0.1p1/configure.ac
--- openssh-3.0.1p1.macro/configure.ac	Sat Nov  3 19:09:33 2001
+++ openssh-3.0.1p1/configure.ac	Wed Dec 19 21:37:19 2001
@@ -546,7 +546,8 @@ AC_ARG_WITH(tcp-wrappers,
 					CPPFLAGS="-I${withval} ${CPPFLAGS}"
 				fi
 			fi
-			LIBS="-lwrap $LIBS"
+			LIBWRAP="-lwrap"
+			LIBS="$LIBS $LIBWRAP"
 			AC_MSG_CHECKING(for libwrap)
 			AC_TRY_LINK(
 				[
@@ -557,12 +558,14 @@ AC_ARG_WITH(tcp-wrappers,
 				[
 					AC_MSG_RESULT(yes)
 					AC_DEFINE(LIBWRAP)
+					AC_SUBST(LIBWRAP)
 					TCPW_MSG="yes"
 				],
 				[
 					AC_MSG_ERROR([*** libwrap missing])
 				]
 			)
+			LIBS="$saved_LIBS"
 		fi
 	]
 )




More information about the openssh-unix-dev mailing list