summaryrefslogtreecommitdiffstats
path: root/source3/tdb/tdbtool.c
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
commitd0ea72d0b7c6a9ea0f582cda3b94ba7cb8cb1fbe (patch)
tree9ff7b578dd8b3e9cd6ef2f106d85210b8331bc3d /source3/tdb/tdbtool.c
parenteec9e8a052407611df223fec982588e7a2bd7f49 (diff)
downloadsamba-d0ea72d0b7c6a9ea0f582cda3b94ba7cb8cb1fbe.tar.gz
samba-d0ea72d0b7c6a9ea0f582cda3b94ba7cb8cb1fbe.tar.xz
samba-d0ea72d0b7c6a9ea0f582cda3b94ba7cb8cb1fbe.zip
Added a 'keys' command to tdbtool which prints out all keys in the tdb.
(This used to be commit 1d2305c233ef40ccb016688f918e34392d1a691e)
Diffstat (limited to 'source3/tdb/tdbtool.c')
-rw-r--r--source3/tdb/tdbtool.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c
index 86b534fb017..4e674664b79 100644
--- a/source3/tdb/tdbtool.c
+++ b/source3/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();
}