NetBSD Problem Report #3522

Received: (qmail-queue invoked from smtpd); 22 Apr 1997 08:06:50 -0000
Message-Id: <199704220806.KAA03616@saruman.ics.muni.cz>
Date: Tue, 22 Apr 1997 10:06:43 +0200 (MET DST)
From: Jaromir Dolecek <dolecek@ics.muni.cz>
Reply-To: dolecek@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: undefined symbols in libwrap
X-Send-Pr-Version: 3.95

>Number:         3522
>Category:       lib
>Synopsis:       undefined symbols in libwrap
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 22 01:20:02 +0000 1997
>Closed-Date:    Tue Apr 22 09:38:14 +0000 1997
>Last-Modified:  Tue Apr 22 09:38:42 +0000 1997
>Originator:     Jaromir Dolecek
>Release:        1.2
>Organization:
	ICS MU, Brno, Czech republic
>Environment:

System: NetBSD saruman.ics.muni.cz 1.2 NetBSD 1.2 (SARUMAN_12) #21: Mon Mar 24 15:47:33 MET 1997 dolecek@saruman.ics.muni.cz:/home/dolecek/N12/usr/src/sys/arch/i386/compile/SARUMAN_12 i386
Architecture: i386

>Description:
	I've got liwrap sources from -current and compiled it
	happily on i386/1.2 machine. I've also got inetd and
	recompiled it to use libwrap.  The same for sendmail. All
	works okay.

	My problem:
	When I compiled ssh to use libwrap, scp complains about missing
	"_deny_severity" in libwrap:

	/usr/libexec/ld.so: Undefined symbol "_deny_severity" in                        
	        scp:/usr/lib/libwrap.so.0.0

	I've played w/ it a bit and w/ help of my fried found out
	symbol deny_severity is used in libwrap, but not really
	declared anywhere:

	saruman: /home/dolecek/tmp/libwrap ###
	>grep deny_severity *.[ch]

	options.c:      syslog(deny_severity, "twist %s to %s", 
		eval_client(request), value);
	options.c:    allow_severity = deny_severity = level ?
	refuse.c:    syslog(deny_severity, "refused connect from %s", 
		eval_client(request));
	tcpd.h:extern int deny_severity; 

	When shared lib is build, this sybmol gets stripped somehow
	from library.

	So - there are a few variables, which are used w/o being
	declared; they are defined as extern in tcpd.h but not
	defined anywhere else. It's case of deny_severity and
	allow_severity at least.

	I'm sorry if these two are declared somewhere else (libc ?).

>How-To-Repeat:
	Compile ssh w/ TCPWRAPPERS; wander why scp isn't able to run

>Fix:
	It's a bit hard as libwrap isn't kinda "static" lib, but
	is imported from elsewhere; it should be nice to make
	libwrap2netbsd to "correct" it somehow.  I'm adding the
	patch of options.c just to make see kind of what should be
	done; it's really NOT rocket science ;-)

*** options.c.orig	Fri Jan 24 13:14:03 1997
--- options.c	Tue Apr 22 09:45:59 1997
***************
*** 86,91 ****
--- 86,95 ----
  static void deny_option();		/* execute "deny" option */
  static void banners_option();		/* execute "banners path" option */

+ /* necessary variables */
+ int allow_severity;              /* for connection logging */
+ int deny_severity;               /* for connection logging */
+ 
  /* Structure of the options table. */

  struct option {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mrg 
State-Changed-When: Tue Apr 22 02:38:14 PDT 1997 
State-Changed-Why:  
this is a bug in ssh. 

From: matthew green <mrg@eterna.com.au>
To: dolecek@ics.muni.cz
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: lib/3522: undefined symbols in libwrap 
Date: Tue, 22 Apr 1997 19:34:37 +1000

 this problem is that scp should _not_ be linked with libwrap.
 programs that use libwrap are required (by the libwrap interface)
 to provide symbols `deny_severity' and `allow_severity' (as int's)
 that libwrap uses.

 i will be submitting a patch to the ssh maintainers (that also
 includes support for our own libz, if present).

From: Jim Bernard <jbernard@tater.mines.edu>
To: dolecek@ics.muni.cz
Cc: "gnats-bugs@gnats.netbsd.org netbsd-bugs"@NetBSD.ORG
Subject: Re: lib/3522: undefined symbols in libwrap
Date: Tue, 22 Apr 1997 06:29:23 -0600

 On 4 22, Jaromir Dolecek wrote:
 > 
 > >Number:         3522
 > >Category:       lib
 > >Synopsis:       undefined symbols in libwrap
 > 	
 > 	My problem:
 > 	When I compiled ssh to use libwrap, scp complains about missing
 > 	"_deny_severity" in libwrap:
 > 	
 > 	/usr/libexec/ld.so: Undefined symbol "_deny_severity" in                        
 > 	        scp:/usr/lib/libwrap.so.0.0

   The intention is that allow_severity and deny_severity are to be defined
 by callers that use libwrap with host access control.  They should not be
 defined in the library.  The problem arises because the ssh Makefile adds
 -lwrap to the link lines for all programs it builds, assuming that the
 library is static and will be included only if needed.  On NetBSD, there
 is a shared version of the library, and the linker adds a shared-library
 dependency to libwrap.so to the binaries, _including_ those that don't
 use libwrap at all (these include ssh, ssh-add, ssh-agent, ssh-keygen, and
 scp).  Since libwrap.so contains references to _allow_severity and
 _deny_severity, programs that don't declare them (because they don't need
 them) but have (unnecessary) dependencies on that library will fail to load.
 Of the programs built by the ssh Makefile, only sshd itself actually needs
 libwrap, so a fix is to remove -lwrap from the LIBS macro and define a
 new macro, e.g., WRAPLIBS=-lwrap, which is then added to the link line
 for sshd alone.

   One might argue that the NetBSD linker should not add dependencies to
 any command-line-specified libraries that aren't actually needed, but libwrap
 shouldn't have these declarations added.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.