1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

Added a 'keys' command to tdbtool which prints out all keys in the tdb.

(This used to be commit 1d2305c233ef40ccb016688f918e34392d1a691e)
This commit is contained in:
Tim Potter 2001-11-28 03:58:33 +00:00
parent eec9e8a052
commit d0ea72d0b7

View File

@ -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();
}