ports/128025: [patch] security/heimdal ldap support broken under 7

Ryan T.Dean rtdean at cytherianage.net
Sun Oct 12 02:30:02 UTC 2008


>Number:         128025
>Category:       ports
>Synopsis:       [patch] security/heimdal ldap support broken under 7
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 12 02:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ryan T. Dean
>Release:        FreeBSD 7.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD noisy.cytherianage.net 7.0-STABLE FreeBSD 7.0-STABLE #1: Mon Jul 14 04:40:56 UTC 2008 root at noisy.cytherianage.net:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
The WITH_LDAP option in security/heimdal does not work under FreeBSD 7.  
If you attempt to initalize a realm, add or change a key, or perform any 
operation that affects the krb5Key attribute in the LDAP tree, the
program attempting the modification will segmentation fault.

The issue lies in heimdal-1.0.1/lib/hdb/hdb-ldap.c, in the 
LDAP_addmod_len() function.  When allocating memory to store the krb5Key
attribute, it only allocates enough memory for a pointer to a berval
structure, not enough memory for the structure itself.  This results in 
a memory alignment error, and each added krb5Key attribute ends up
clobbering the previous entry's data pointers.

This issue is present everywhere from 1.0 through the 1.2.1 release, and
will be fixed upstream when 1.2.2 is released.  This change was applied
upstream in change # 23726, and can be viewed via heimdal's fisheye at
http://www.h5l.org/fisheye/changelog/heimdal?cs=23726

This issue does not affect installations that are not using the LDAP hdb
available in Heimdal.

>How-To-Repeat:
Build the current port with WITH_LDAP enabled.
Attempt to initialize a test realm, i.e., EXAMPLE.COM using the LDAP 
backend.  (Instructions here: 
http://www.h5l.org/manual/heimdal-1-0-branch/info/heimdal.html#Using-LDAP-to-store-the-database
or
http://www.openinput.com/auth-howto/ ).  When you get to the step where
you inialize your heimdal database, kadmin will segfault.

>Fix:

Add the file patch-lib_hdb_hdb-ldap.c to the 'files' directory under
the security/heimdal port.  This is the same change from the changeset
listed above.

--- patch-lib_hdb_hdb-ldap.c begins here ---
--- lib/hdb/hdb-ldap.c	2008-10-12 01:15:38.000000000 +0000
+++ lib/hdb/hdb-ldap.c	2008-10-12 01:15:55.000000000 +0000
@@ -222,7 +222,7 @@
 
 	(*modlist)[cMods]->mod_bvalues = bv;
 
-	bv[i] = ber_memalloc(sizeof(*bv));;
+	bv[i] = ber_memalloc(sizeof(**bv));;
 	if (bv[i] == NULL)
 	    return ENOMEM;
 
--- patch-lib_hdb_hdb-ldap.c ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list