Issue 106 - ldbmcat segmentation fault on FreeBSD 3.1-STABLE
Summary: ldbmcat segmentation fault on FreeBSD 3.1-STABLE
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1999-03-22 06:52 UTC by Darian Ong
Modified: 2014-08-01 21:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Darian Ong 1999-03-22 06:52:52 UTC
Hi,

I am running OpenLDAP version 1.2 on a FreeBSD 3.1-STABLE system and am
using
Berkeley DB 2.3.16 database. When I run ldbmcat, it resulted in a
segmentation
fault. I saw an earlier complaint by Sumit A. Vakil of a similar problem. I
have also CVS the latest OpenLDAP version 1.2 source tree and compiled a new
set of binaries. However, I still got the segmentation fault error. Is there
any workaround?


Regards,
Darian Ong


Comment 1 Kurt Zeilenga 1999-03-26 18:57:05 UTC
moved from Incoming to Software Bugs
Comment 2 Kurt Zeilenga 1999-03-26 19:09:30 UTC
changed notes
Comment 3 Kurt Zeilenga 1999-03-26 21:06:13 UTC
changed state Open to Release
Comment 4 Kurt Zeilenga 1999-03-26 21:15:59 UTC
changed notes
Comment 5 Kurt Spanier 1999-03-29 14:02:19 UTC
Folks,

I have once again had a look to the ldbmcat crash problem. As it turned
out (Sumit, have you tested already ?), the newly allocated key in the
loop was deleted before using it in ldbm_fetch :-( I have moved free'ing
up the memory of the last key to the end of the loop, so that new keys are
usable within the loop.


Regards,
Kurt Spanier


On Wed, 24 Mar 1999, Sumit A. Vakil wrote:

> Date: Wed, 24 Mar 1999 08:17:23 -0800
> From: "Sumit A. Vakil" <svakil@internetdevices.com>
> To: Kurt Spanier <kurt.spanier@zdv.uni-tuebingen.de>
> Cc: Yusuf Goolamabbas <yusufg@outblaze.com>, openldap-core@openldap.org
> Subject: RE: Did you get the OpenLDAP ldbmcat crash problem fixed ?
> 
> #include "portable.h"
> 
> #include <stdio.h>
> 
> #include <ac/ctype.h>
> #include <ac/socket.h>
> #include <ac/string.h>
> 
> #include "ldbm.h"
> #include "../slap.h"
> 
> static void
> usage( char *name )
> {
>         fprintf( stderr, "usage: %s [-n] <filename>\n", name );
>         exit( 1 );
> }
> 
> int
> main( int argc, char **argv )
> {
>         Datum                key, last, data;
>         LDBM                dbp;
>         int                rc, type;
>         long                id;
>         char                *file, *s;
>         int                printid = 1;
> 
> #ifdef HAVE_BERKELEY_DB2
>         DBC        *cursorp;
> #endif
> 
>         ldbm_datum_init( key );
>         ldbm_datum_init( last );
>         ldbm_datum_init( data );
> 
>         if ( argc < 2 || argc > 3 || ( argc == 3 && strcmp( argv[1], "-n" )
>             != 0 )) {
>                 usage( argv[0] );
>         }
>         if ( argc == 3 && strcmp( argv[1], "-n" ) == 0 ) {
>                 printid = 0;
>                 file = argv[2];
>         } else {
>                 file = argv[1];
>         }
> 
>         if ( (dbp = ldbm_open( file, LDBM_READER, 0, 0 )) == NULL ) {
>                 perror( file );
>                 exit ( 1 );
>         }
> 
>         last.dptr = NULL;
> 
> #ifdef HAVE_BERKELEY_DB2
>         for ( key = ldbm_firstkey( dbp, &cursorp ); key.dptr != NULL;
>             key = ldbm_nextkey( dbp, last, cursorp ) )
> #else
>         for ( key = ldbm_firstkey( dbp ); key.dptr != NULL;
>             key = ldbm_nextkey( dbp, last ) )
> #endif
>         {
> 
> /* Begin Internet Devices mods. */
> #ifdef HAVE_BERKELEY_DB2
> 		key.flags = 0;
>                 data = ldbm_fetch( dbp, key );
> 		key.flags = DB_DBT_MALLOC;
> #else
>                 if ( last.dptr != NULL )
>                         ldbm_datum_free( dbp, last );
>                 data = ldbm_fetch( dbp, key );
> #endif HAVE_BERKELEY_DB2
> /* End Internet Devices mods. */
> 
>                 if (( s = data.dptr ) != NULL ) {
> 
>                     if ( !printid && isdigit( *s )) {
>                         if (( s = strchr( s, '\n' )) != NULL ) {
>                                 ++s;
>                         }
>                     }
>                     if ( s != NULL ) {
>                         puts( s );
>                     }
> 
>                     if ( data.dptr != NULL ) {
>                         ldbm_datum_free( dbp, data );
>                     }
> 
>                 }
> 
>                 last = key;
>         }
> 
> /* Begin Internet Devices mods. */
> #ifndef HAVE_BERKELEY_DB2
>         if ( last.dptr != NULL )
>                 ldbm_datum_free( dbp, last );
> #endif HAVE_BERKELEY_DB2
> /* End Internet Devices mods. */
> 
>         ldbm_close( dbp );
> 
>         exit( 0 );
> }
> 
> > -----Original Message-----
> > From: Kurt Spanier [mailto:kurt.spanier@zdv.uni-tuebingen.de]
> > Sent: Wednesday, March 24, 1999 8:07 AM
> > To: Sumit A. Vakil
> > Cc: Yusuf Goolamabbas; openldap-core@openldap.org
> > Subject: RE: Did you get the OpenLDAP ldbmcat crash problem fixed ?
> >
> >
> > Hello,
> >
> > I'm quite sure, I have commited the changes two weeks ago, so it should be
> > part of the latest -devel.
> >
> > Nonetheless, I cannot read your attached patch file. Could you please send
> > it again in plain ascii. Otherwise, I could not say anything.
> >
> >
> > Kurt
> >
> >
> > On Wed, 24 Mar 1999, Sumit A. Vakil wrote:
> >
> > > Date: Wed, 24 Mar 1999 07:27:31 -0800
> > > From: "Sumit A. Vakil" <svakil@internetdevices.com>
> > > To: Yusuf Goolamabbas <yusufg@outblaze.com>
> > > Cc: zrnsk01@zdv.uni-tuebingen.de
> > > Subject: RE: Did you get the OpenLDAP ldbmcat crash problem fixed ?
> > >
> > > I got e-mail from Kurt a while back which said that he had fixed the
> > > problem.  Don't know if he's put the fix in yet.
> > >
> > > Yes, I fixed the problem.  We don't have trouble with ldbmcat
> > anymore.  I've
> > > attached the fixed ldbmcat.c file to this e-mail.  The changes
> > I've made are
> > > between comments of the form
> > > /* Begin Internet Devices mods. */ and /* End Internet Devices mods. */.
> > > I'm not an expert on the OpenLDAP code so it might not be the
> > best way to
> > > fix the problem.  But the changes are working for us and we
> > make frequent
> > > use of ldbmcat.
> > >
> > > Regards,
> > >
> > > Sumit
> > >
> > > > -----Original Message-----
> > > > From: Yusuf Goolamabbas [mailto:yusufg@outblaze.com]
> > > > Sent: Tuesday, March 23, 1999 9:56 PM
> > > > To: svakil@internetdevices.com
> > > > Cc: zrnsk01@zdv.uni-tuebingen.de
> > > > Subject: Did you get the OpenLDAP ldbmcat crash problem fixed ?
> > > >
> > > >
> > > > Hi Sumit, I have configured both OpenLDAP 1.2 as well OpenLDAP CVS
> > > > (checked out a few hours ago) on a FreeBSD 3.1-STABLE box with
> > > > Berkeley DB 2.3.16.
> > > >
> > > > In both cases, whilst running ldbmcat. I get a core dump or sometimes
> > > > ldbmcat returns nothing.
> > > >
> > > > According to cvsweb, Kurt Spanier (messg cc'ed to him) had apparently
> > > > fixed the ITS.
> > > >
> > > > Are you still facing the same problem or you have a workaround/fix ?
> > > >
> > > > Thanks, Yusuf
> > > >
> > >
> >
> >
> > ----------==========#########>>>>>ZDV<<<<<#########==========----------
> >
> > X.500:                                              Tel.:
> >    Kurt Spanier, Zentrum fuer Datenverarbeitung,      +49 7071 29-70334
> >    Universitaet Tuebingen, DE
> > SMTP-Mail:                                          FAX.:
> >    kurt.spanier@zdv.uni-tuebingen.de                   +49 7071 29-5912
> > Snail-Mail:
> >    Dr. Kurt Spanier, Zentrum fuer Datenverarbeitung,
> >    Universitaet Tuebingen, Waechterstrasse 76, D-72074 Tuebingen
> > PGP-Public-Key:
> >    finger "Kurt Spanier"@x500.uni-tuebingen.de
> >
> > ----------==========##########>>>>>@<<<<<##########==========----------
> >
> >
> >
> 


----------==========#########>>>>>ZDV<<<<<#########==========----------

X.500:                                              Tel.:
   Kurt Spanier, Zentrum fuer Datenverarbeitung,      +49 7071 29-70334
   Universitaet Tuebingen, DE
SMTP-Mail:                                          FAX.:
   kurt.spanier@zdv.uni-tuebingen.de                   +49 7071 29-5912
Snail-Mail:
   Dr. Kurt Spanier, Zentrum fuer Datenverarbeitung,
   Universitaet Tuebingen, Waechterstrasse 76, D-72074 Tuebingen
PGP-Public-Key:
   finger "Kurt Spanier"@x500.uni-tuebingen.de

----------==========##########>>>>>@<<<<<##########==========----------



Comment 6 Kurt Zeilenga 1999-04-01 07:20:44 UTC
Please test 1.2.1
Comment 7 Kurt Zeilenga 1999-04-01 07:24:20 UTC
changed notes
changed state Release to Closed
Comment 8 Darian Ong 1999-04-01 07:31:44 UTC
thanks!

-----Original Message-----
From: Kurt Zeilenga [mailto:openldap-its@OpenLDAP.org]
Sent: Thursday, April 01, 1999 3:21 PM
To: darian@source.portal2.com
Subject: Re: ldbmcat segmentation fault on FreeBSD 3.1-STABLE (ITS#106)


Please test 1.2.1
Comment 9 Darian Ong 1999-04-01 07:34:55 UTC
btw, do I get it with CVS on the openldap web site?

-----Original Message-----
From: Kurt Zeilenga [mailto:openldap-its@OpenLDAP.org]
Sent: Thursday, April 01, 1999 3:21 PM
To: darian@source.portal2.com
Subject: Re: ldbmcat segmentation fault on FreeBSD 3.1-STABLE (ITS#106)


Please test 1.2.1
Comment 10 Darian Ong 1999-04-01 08:42:31 UTC
Hi Kurt,

Thanks for your message. I immediately tried it out. However, it didn't
work.
I tried using the tar file openldap-1.2.1.tgz and I also tried the CVS.
Unfortunately both didn't work. 

ldbmcat seemed to pick up all the entries in the database and died at the
end
of the process.


Regards,
Darian Ong


-----Original Message-----
From: Kurt Zeilenga [mailto:openldap-its@OpenLDAP.org]
Sent: Thursday, April 01, 1999 3:21 PM
To: darian@source.portal2.com
Subject: Re: ldbmcat segmentation fault on FreeBSD 3.1-STABLE (ITS#106)


Please test 1.2.1
Comment 11 Kurt Zeilenga 1999-04-04 18:31:23 UTC
changed notes
changed state Closed to Feedback
Comment 12 Kurt Zeilenga 1999-04-16 22:32:27 UTC
Please try OpenLDAP 1.2.1 with BerkeleyDB 2.7.4.
Support both 2.7.4 and 2.3.16 appears to be difficult.
As 2.7.4 is newer and appears to be stable, we're considerring
changing our recommended BerkeleyDB version to 2.7.4.

Kurt
Comment 13 Kurt Zeilenga 1999-04-16 22:33:38 UTC
changed notes
changed state Feedback to Release
Comment 14 Darian Ong 1999-04-19 01:03:09 UTC
Hi Kurt,

Thanks for your message and recommendation.


Regards,
Darian

-----Original Message-----
From: Kurt Zeilenga [mailto:openldap-its@OpenLDAP.org]
Sent: Saturday, April 17, 1999 6:32 AM
To: darian@source.portal2.com
Subject: Re: ldbmcat segmentation fault on FreeBSD 3.1-STABLE (ITS#106)


Please try OpenLDAP 1.2.1 with BerkeleyDB 2.7.4.
Support both 2.7.4 and 2.3.16 appears to be difficult.
As 2.7.4 is newer and appears to be stable, we're considerring
changing our recommended BerkeleyDB version to 2.7.4.

Kurt
Comment 15 Kurt Zeilenga 1999-04-20 23:17:52 UTC
changed notes
Comment 16 Kurt Zeilenga 1999-04-20 23:20:51 UTC
changed notes
Comment 17 Kurt Zeilenga 1999-06-01 17:58:26 UTC
changed notes
changed state Release to Closed
Comment 18 OpenLDAP project 2014-08-01 21:06:52 UTC
1.2.1 appears to incompatible with DB 2.3.16.
Advised user to use DB 2.7.3/.4
See Also: ITS#85