mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-02 04:59:39 -05:00
Fix ldbmcat crash problem: first use the key before deleting it!
This commit is contained in:
parent
b9109a9f20
commit
80400aba52
4 changed files with 7 additions and 16 deletions
|
|
@ -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..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue