summaryrefslogtreecommitdiffstats
path: root/source/tdb
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-28 03:58:33 +0000
committerTim Potter <tpot@samba.org>2001-11-28 03:58:33 +0000
commit1d2305c233ef40ccb016688f918e34392d1a691e (patch)
treed3faf59443ec8d5830807582cd8dc915a238a126 /source/tdb
parente2ba2383c9f679c076749a8f4fccefc3559e37ec (diff)
downloadsamba-1d2305c233ef40ccb016688f918e34392d1a691e.tar.gz
samba-1d2305c233ef40ccb016688f918e34392d1a691e.tar.xz
samba-1d2305c233ef40ccb016688f918e34392d1a691e.zip
Added a 'keys' command to tdbtool which prints out all keys in the tdb.
Diffstat (limited to 'source/tdb')
-rw-r--r--source/tdb/tdbtool.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/tdb/tdbtool.c b/source/tdb/tdbtool.c
index 86b534fb017..4e674664b79 100644
--- a/source/tdb/tdbtool.c
+++ b/source/tdb/tdbtool.c
@@ -306,6 +306,13 @@ static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
#endif
}
+static int print_key(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+{
+ printf("\nkey %d bytes\n", key.dsize);
+ print_data(key.dptr, key.dsize);
+ return 0;
+}
+
static int total_bytes;
static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
@@ -445,6 +452,9 @@ int main(int argc, char *argv[])
} else if ((strcmp(tok, "n") == 0) ||
(strcmp(tok, "next") == 0)) {
next_record(tdb, &iterate_kbuf);
+ } else if ((strcmp(tok, "keys") == 0)) {
+ bIterate = 0;
+ tdb_traverse(tdb, print_key, NULL);
} else {
help();
}