From owner-freebsd-questions@FreeBSD.ORG Tue Oct 17 12:01:44 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4716E16A4B3 for ; Tue, 17 Oct 2006 12:01:44 +0000 (UTC) (envelope-from jonathan@hst.org.za) Received: from sirian.hst.org.za (sirian.hst.org.za [209.203.2.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4A7A43D49 for ; Tue, 17 Oct 2006 12:01:42 +0000 (GMT) (envelope-from jonathan@hst.org.za) Received: from localhost (localhost.hst.org.za [127.0.0.1]) by sirian.hst.org.za (Postfix) with ESMTP id 4884531C47C for ; Tue, 17 Oct 2006 14:04:04 +0200 (SAST) Received: from sirian.hst.org.za ([127.0.0.1]) by localhost (sirian.hst.org.za [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06880-10 for ; Tue, 17 Oct 2006 14:04:04 +0200 (SAST) Received: by sirian.hst.org.za (Postfix, from userid 1004) id 04EE431C459; Tue, 17 Oct 2006 14:04:04 +0200 (SAST) Received: from sysadmin.int.dbn.hst.org.za (sysadmin.int.dbn.hst.org.za [10.1.1.20]) by sirian.hst.org.za (Postfix) with ESMTP id F14FF31C442 for ; Tue, 17 Oct 2006 14:04:02 +0200 (SAST) From: Jonathan McKeown Organization: Health Systems Trust To: freebsd-questions@freebsd.org Date: Tue, 17 Oct 2006 14:03:45 +0200 User-Agent: KMail/1.7.2 References: <200610152219.47346.jonathan@hst.org.za> <200610161654.50208.jonathan@hst.org.za> In-Reply-To: <200610161654.50208.jonathan@hst.org.za> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610171403.45768.jonathan@hst.org.za> X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on sirian.hst.org.za X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=7.0 tests=BAYES_00 autolearn=ham version=2.61 X-Virus-Scanned: by amavisd-new at hst.org.za Subject: Re: mimedefang with LDAP-enabled sendmail X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2006 12:01:44 -0000 On Monday 16 October 2006 16:54, Jonathan McKeown wrote: > On Sunday 15 October 2006 22:19, Jonathan McKeown wrote: > > sendmail -d0.1 -bt > > > Version 8.13.6 > > Compiled with: DNSMAP LDAPMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 > > MIME8TO7 NAMED_BIND NETINET NETINET6 NETUNIX NEWDB NIS > > PIPELINING SASLv2 SCANF STARTTLS TCPWRAPPERS USERDB > > USE_LDAP_INIT XDEBUG > > > > When I try to build and install mail/mimedefang from ports (version is > > 2.57), I get (modulo wrapping) > > > > cc -O2 -fno-strict-aliasing -pipe -pthread -o mimedefang mimedefang.o > > drop_privs_threaded.o utils.o rm_r.o syslog-fac.o /usr/lib/libmilter.a > > -lpthread > > > > /usr/lib/libmilter.a(errstring.o)(.text+0xd6): In function `sm_errstring': > > : undefined reference to `ldap_err2string' > > The undefined reference is apparently in libmilter.a and it seems (Google > again) that the ldap_err2string symbol comes from the openldap library. Is > it possible that the build of libmilter is not picking up libldap > from /usr/local/lib? OK, this seems to be the same problem that was reported in (at least) PR ports/95646 and PR ports/95647 (both ports which would not build with an LDAP-enabled core sendmail). The solution proposed in ports/95646 was to make the various Sendmail LDAP options in /etc/make.conf invisible to libmilter. This certainly works - it prevents a build of libmilter passing the LDAP flags through to libsm at this line in the build of /usr/src/lib/libmilter: cc -O2 -fno-strict-aliasing -pipe -I/usr/src/lib/libmilter/../../contrib/sendmail/src -I/usr/src/lib/libmilter/../../contrib/sendmail/include -I. -DNOT_SENDMAIL -Dsm_snprintf=snprintf -D_THREAD_SAFE -DNETINET6 -I/usr/local/include -DSASL=2 -c /usr/src/lib/libmilter/../../contrib/sendmail/libsm/errstring.c libsm/errstring.c refers to ldap_err2string in a conditional testing on LDAPMAP. ldap_err2string is declared in the #included /usr/local/lib/ldap.h. (I didn't search for where it's defined). It looks as though the problem is less with ports, and more with a subtle breakage of the core sendmail when built with LDAP - specifically in building libsm/errstring.c as part of the libmilter build. Is pretending that LDAPMAP is not set while compiling libmilter the right solution? Should the necessary changes to /etc/make.conf be documented somewhere or even automated in some way? I have spent five days trying to solve this. I have rewritten my /etc/make.conf as follows: WANT_OPENLDAP_SASL=true SENDMAIL_CFLAGS = -I/usr/local/include -DSASL=2 SENDMAIL_LDFLAGS = -L/usr/local/lib SENDMAIL_LDADD = -lsasl2 .if ${.CURDIR} != /usr/src/lib/libmilter SENDMAIL_CFLAGS += -DLDAPMAP SENDMAIL_LDADD += -lldap -llber .endif This works but it Just Feels Wrong. Jonathan