Skip site navigation (1)Skip section navigation (2)
Date:      18 Jul 2001 16:19:30 -0000
From:      Greg@fnord.ir.bbn.com, Troxel@fnord.ir.bbn.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/29062: krb4 and krb5 multiply defined version symbol
Message-ID:  <20010718161930.48599.qmail@fnord.ir.bbn.com>

next in thread | raw e-mail | index | archive | help

>Number:         29062
>Category:       bin
>Synopsis:       krb4 and krb5 multiply defined version symbol
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 18 09:20:01 PDT 2001
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010718161930.48599.qmail>