From 2da3330555bcd6f8d5edf879f38f0068b70ebee5 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 16 Jul 2003 16:26:40 +0000 Subject: make tdbtool deal with NULL and non-NULL terminated keys (This used to be commit 5df7b9a3efaf5b7828d0405bc14504d14d9e833a) --- source3/tdb/tdbtool.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source3/tdb') diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c index 221ef4a5f2..7369fe8d80 100644 --- a/source3/tdb/tdbtool.c +++ b/source3/tdb/tdbtool.c @@ -251,16 +251,26 @@ static void show_tdb(void) } key.dptr = k; -/* key.dsize = strlen(k)+1;*/ - key.dsize = strlen(k); + key.dsize = strlen(k)+1; dbuf = tdb_fetch(tdb, key); if (!dbuf.dptr) { - terror("fetch failed"); - return; + /* maybe it is non-NULL terminated key? */ + key.dsize = strlen(k); + dbuf = tdb_fetch(tdb, key); + + if ( !dbuf.dptr ) { + terror("fetch failed"); + return; + } } + /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ print_rec(tdb, key, dbuf, NULL); + + free( dbuf.dptr ); + + return; } static void delete_tdb(void) -- cgit