diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-10-04 09:04:19 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-10-04 09:04:19 +0930 |
commit | 90f463b25f7bb0bc944732773c56e356834ea203 (patch) | |
tree | 3d554227142580e6393ac77b6da85c67d1257507 /lib/tdb/include | |
parent | fe38a93c71d0adc0be1d43b438ac3b54eaf4ba53 (diff) | |
download | samba-90f463b25f7bb0bc944732773c56e356834ea203.tar.gz samba-90f463b25f7bb0bc944732773c56e356834ea203.tar.xz samba-90f463b25f7bb0bc944732773c56e356834ea203.zip |
tdb: add tdb_rescue()
This allows for an emergency best-effort dump. It's a little better than
strings(1).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb/include')
-rw-r--r-- | lib/tdb/include/tdb.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h index 5eb95625da..d19439e760 100644 --- a/lib/tdb/include/tdb.h +++ b/lib/tdb/include/tdb.h @@ -814,6 +814,28 @@ int tdb_check(struct tdb_context *tdb, int (*check) (TDB_DATA key, TDB_DATA data, void *private_data), void *private_data); +/** + * @brief Dump all possible records in a corrupt database. + * + * This is the only way to get data out of a database where tdb_check() fails. + * It will call walk() with anything which looks like a database record; this + * may well include invalid, incomplete or duplicate records. + * + * @param[in] tdb The database to check. + * + * @param[in] walk The walk function to use. + * + * @param[in] private_data the private data to pass to the walk function. + * + * @return 0 on success, -1 on error with error code set. + * + * @see tdb_error() + * @see tdb_errorstr() + */ +int tdb_rescue(struct tdb_context *tdb, + void (*walk) (TDB_DATA key, TDB_DATA data, void *private_data), + void *private_data); + /* @} ******************************************************************/ /* Low level locking functions: use with care */ |