Skip to content
Snippets Groups Projects
Commit 80400aba authored by Kurt Spanier's avatar Kurt Spanier
Browse files

Fix ldbmcat crash problem: first use the key before deleting it!

parent b9109a9f
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,7 @@ ldbm_datum_free( LDBM ldbm, Datum data )
{
if ( data.dptr ) {
free( data.dptr );
data.dptr = NULL;
data.dsize = 0;
memset( &data, 0, sizeof( Datum ));
}
}
......@@ -327,7 +326,6 @@ ldbm_firstkey( LDBM ldbm )
if ( (*ldbm->cursor)( ldbm, NULL, &dbci, 0 ))
# endif
{
key.flags = 0;
key.dptr = NULL;
return( key );
} else {
......@@ -336,7 +334,6 @@ ldbm_firstkey( LDBM ldbm )
ldbm_datum_free( ldbm, data );
}
else {
key.flags = 0;
#else
int rc;
......@@ -381,7 +378,6 @@ ldbm_nextkey( LDBM ldbm, Datum key )
ldbm_datum_free( ldbm, data );
}
else {
key.flags = 0;
#else
int rc;
......
......@@ -26,8 +26,6 @@ main( int argc, char **argv )
#ifdef HAVE_BERKELEY_DB2
DBC *cursorp;
if ( ldbm_initialize() ) exit( 1 );
#endif
ldbm_datum_init( key );
......@@ -60,8 +58,6 @@ main( int argc, char **argv )
key = ldbm_nextkey( dbp, last ) )
#endif
{
ldbm_datum_free( dbp, last );
data = ldbm_fetch( dbp, key );
if (( s = data.dptr ) != NULL ) {
......@@ -77,18 +73,17 @@ main( int argc, char **argv )
ldbm_datum_free( dbp, data );
}
} else {
}
ldbm_datum_free( dbp, last );
last = key;
}
ldbm_datum_free( dbp, last );
ldbm_close( dbp );
#ifdef HAVE_BERKELEY_DB2
(void) ldbm_shutdown();
#endif
exit( 0 );
return 0; /* NOT REACHED */
......
......@@ -28,7 +28,7 @@ if [ $RC != 0 ]; then
fi
echo "Starting slapd on TCP/IP port $PORT..."
$SLAPD -f $CONF -p $PORT -a $ADDR -d $LVL $TIMING > $MASTERLOG 2>&1 &
$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
PID=$!
echo "Using ldapsearch to retrieve all the entries..."
......
......@@ -28,7 +28,7 @@ if [ $RC != 0 ]; then
fi
echo "Starting slapd on TCP/IP port $PORT..."
$SLAPD -f $CONF -p $PORT -a $ADDR -d $LVL $TIMING > $MASTERLOG 2>&1 &
$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
PID=$!
echo "Using ldapsearch to retrieve all the entries..."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment