From gdt@ir.bbn.com  Wed Jul 18 09:19:32 2001
Return-Path: <gdt@ir.bbn.com>
Received: from fnord.ir.bbn.com (FNORD.IR.BBN.COM [192.1.100.210])
	by hub.freebsd.org (Postfix) with SMTP id 7D84037B409
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 18 Jul 2001 09:19:31 -0700 (PDT)
	(envelope-from gdt@ir.bbn.com)
Received: (qmail 48600 invoked by uid 10853); 18 Jul 2001 16:19:30 -0000
Message-Id: <20010718161930.48599.qmail@fnord.ir.bbn.com>
Date: 18 Jul 2001 16:19:30 -0000
From: Greg@fnord.ir.bbn.com, Troxel@fnord.ir.bbn.com
Reply-To: Greg@fnord.ir.bbn.com, Troxel@fnord.ir.bbn.com
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: krb4 and krb5 multiply defined version symbol
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         29062
>Category:       bin
>Synopsis:       [libkrb] krb4 and krb5 multiply defined version symbol
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    markm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 18 09:20:01 PDT 2001
>Closed-Date:    Mon Mar 05 11:12:29 UTC 2012
>Last-Modified:  Mon Mar 05 11:12:29 UTC 2012
>Originator:     Greg Troxel
>Release:        FreeBSD 4.3-STABLE
>Organization:
BBN Technologies
>Environment:
System: FreeBSD fnord.ir.bbn.com 4.3-STABLE FreeBSD 4.3-STABLE #0: Thu Jun 28 08:37:11 EDT 2001 root@fnord.ir.bbn.com:/u2e/gdt-extra/FreeBSD/FreeBSD-T-RELENG_4/src/sys/compile/FNORD i386

4.3-STABLE from mid-june buildworld from sources

>Description:
When linking a program with both krb4 and krb5 libraries, and making a
static executable, the link fails with a multiply defined symbol.
The following krb5 and krb4 lines, in concert, provoked the failure.

LDADD+= -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcom_err

LDADD+=	-lkrb -lcrypto -lcom_err

Each library defines symbols referring to version strings, and
includes then in a module that is almost certain to be included.

>How-To-Repeat:

Apply the following patch to src/gnu/usr.bin/cvs/cvs/Makefile and build

Index: gnu/usr.bin/cvs/cvs/Makefile
===================================================================
RCS file: /FREEBSD-CVS/src/gnu/usr.bin/cvs/cvs/Makefile,v
retrieving revision 1.32.2.1
diff -u -r1.32.2.1 Makefile
--- gnu/usr.bin/cvs/cvs/Makefile	2001/04/25 12:03:33	1.32.2.1
+++ gnu/usr.bin/cvs/cvs/Makefile	2001/07/18 16:15:37
@@ -28,6 +28,21 @@
 DPADD+=	${LIBCVS} ${LIBDIFF} ${LIBGNUREGEX} ${LIBMD} ${LIBCRYPT} ${LIBZ}
 LDADD+=	${LIBCVS} ${LIBDIFF} -lgnuregex -lmd -lcrypt -lz
 
+# KLUDGE!  gssapi/krb5 is first because the resolv.o in libroken
+# appears to be a superset of the resolv.o in libkrb, and this
+# order avoids the libkrb version being added, and thus avoids
+# multiply defined symbol errors for the symbols that are defined.
+.if exists(${DESTDIR}${LIBDIR}/libgssapi.a) && defined(MAKE_KERBEROS5)
+CFLAGS+=-DHAVE_GSSAPI -DHAVE_GSSAPI_H -DHAVE_GSS_C_NT_HOSTBASED_SERVICE
+# The LDADD line below is for the heimdal implementation of gssapi/krb5
+LDADD+= -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcom_err
+# XXX DPADD should have gssapi, krb5, adn1, roken but not in libnames.mk
+DPADD+= ${LIBCRYPTO} ${LIBCOM_ERR}
+DISTRIBUTION=	krb5
+# definitely want encryption
+CFLAGS+= -DENCRYPTION
+.endif
+
 .if exists(${DESTDIR}${LIBDIR}/libkrb.a) && defined(MAKE_KERBEROS4)
 CFLAGS+=-DHAVE_KERBEROS -DHAVE_KRB_GET_ERR_TEXT
 LDADD+=	-lkrb -lcrypto -lcom_err


>Fix:

Both kerberosIV and kerberos5 define krb4 and heimdal version strings.
The following patch causes each library to define its own version, and
avoids trying to reference the krb4 version string in the krb5
library.

Index: kerberosIV/include/version.h
===================================================================
RCS file: /FREEBSD-CVS/src/kerberosIV/include/version.h,v
retrieving revision 1.3
diff -u -r1.3 version.h
--- version.h	2000/01/09 08:59:34	1.3
+++ version.h	2001/07/17 21:02:43
@@ -1,5 +1,7 @@
 /* $FreeBSD: src/kerberosIV/include/version.h,v 1.3 2000/01/09 08:59:34 markm Exp $ */
 char *krb4_long_version = "@(#)$Version: krb4-1.0 by root on greenpeace.grondar.za (i386-unknown-freebsd4.0) Sat Jan  8 19:34:57 SAST 2000 $";
 char *krb4_version = "krb4-1.0";
+#if 0
 char *heimdal_long_version = "@(#)$Version: heimdal-0.1l by root on greenpeace.grondar.za (i386-unknown-freebsd4.0) Sat Jan  8 20:56:02 SAST 2000 $";
 char *heimdal_version = "heimdal-0.1l";
+#endif
Index: kerberos5/include/version.h
===================================================================
RCS file: /FREEBSD-CVS/src/kerberos5/include/version.h,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 version.h
--- version.h	2001/05/11 16:57:50	1.2.2.2
+++ version.h	2001/07/17 21:02:44
@@ -1,5 +1,7 @@
 /* $FreeBSD: src/kerberos5/include/version.h,v 1.2.2.2 2001/05/11 16:57:50 assar Exp $ */
+#if 0
 char *krb4_long_version = "@(#)$Version: krb4-1.0.5 (FreeBSD) $";
 char *krb4_version = "krb4-1.0.5";
+#endif
 const char *heimdal_long_version = "@(#)$Version: heimdal-0.3e (FreeBSD) $";
 const char *heimdal_version = "heimdal-0.3e";

Index: crypto/heimdal/lib/vers/make-print-version.c
===================================================================
RCS file: /FREEBSD-CVS/src/crypto/heimdal/lib/vers/make-print-version.c,v
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.2 make-print-version.c
--- crypto/heimdal/lib/vers/make-print-version.c	2001/05/08 15:12:01	1.1.1.1.2.2
+++ crypto/heimdal/lib/vers/make-print-version.c	2001/07/18 14:22:41
@@ -41,6 +41,7 @@
 #ifdef KRB5
 extern const char *heimdal_version;
 #endif
+#undef KRB4 /* conflicts with krb4 version so removed */
 #ifdef KRB4
 extern char *krb4_version;
 #endif
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->markm 
Responsible-Changed-By: kris 
Responsible-Changed-When: Wed Jul 25 19:35:26 PDT 2001 
Responsible-Changed-Why:  
Over to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29062 
State-Changed-From-To: open->closed 
State-Changed-By: markm 
State-Changed-When: Mon Mar 5 11:11:44 UTC 2012 
State-Changed-Why:  
KerberosIV no longer used. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29062 
>Unformatted:
