summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-16 16:26:40 +0000
committerGerald Carter <jerry@samba.org>2003-07-16 16:26:40 +0000
commit2da3330555bcd6f8d5edf879f38f0068b70ebee5 (patch)
tree3612744a4621a0fcb86aa2c51f96a711854722eb /source3
parent449a1bc8481bd9fa86df1d808d73ffc61b59a2b7 (diff)
downloadsamba-2da3330555bcd6f8d5edf879f38f0068b70ebee5.tar.gz
samba-2da3330555bcd6f8d5edf879f38f0068b70ebee5.tar.bz2
samba-2da3330555bcd6f8d5edf879f38f0068b70ebee5.zip
make tdbtool deal with NULL and non-NULL terminated keys
(This used to be commit 5df7b9a3efaf5b7828d0405bc14504d14d9e833a)
Diffstat (limited to 'source3')
-rw-r--r--source3/tdb/tdbtool.c18
1 files changed, 14 insertions, 4 deletions
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)