[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
RE: ldbmcat problem - fix
Bill and Brent,
The problem is that ldbm_firstkey() sets the key flags to DB_DBT_MALLOC
whereas the DB functions called by ldbm_fetch() expect the key flags to be
zero. I fixed the problem by setting the key flags to zero before calling
ldbm_fetch() and then setting them back to DB_DBT_MALLOC. Note that the key
flags should be set back to DB_DBT_MALLOC before calling ldbm_nextkey():
/* Add before call to ldbm_fetch() */
key.flags = 0;
/* Add immediately after call to ldbm_fetch() */
key.flags = DB_DBT_MALLOC;
Another problem I noticed was that some chunks of memory were being free
twice. The problem there is that ldbmcat tries to free key.data. This
memory is already freed by ldbm_nextkey(). Removing the
if ( last.dptr != NULL )
ldbm_datum_free( dbp, last );
lines will fix the problem.
Note that the above two fixes are for use with the Berkeley DB
(HAVE_BERKEKEY_DB2 is defined).
Regards,
Sumit A. Vakil
Internet Devices, Inc.
> -----Original Message-----
> From: owner-openldap-general@OpenLDAP.org
> [mailto:owner-openldap-general@OpenLDAP.org]On Behalf Of William L
> Anderson
> Sent: Monday, February 22, 1999 9:39 AM
> To: openldap-general@OpenLDAP.org
> Subject: ldbmcat problem
>
>
> I'm attempting to use ldbmcat as specified in the manpage to dump my
> database; viz.,
>
> /usr1/local/sbin/ldbmcat id2entry.dbb > ldif
>
> but my resulting file is empty. Any suggestions?
> Oh, the first time I tried I got a read error (I wasn't root). But
> changing user, and or permissions to 644 didn't make any difference.
>
> Bill Anderson
>
>
>