tdb: put example hashes into header, so we notice incorrect hash_fn.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 13 Sep 2010 10:12:34 +0000 (19:42 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 13 Sep 2010 10:12:34 +0000 (19:42 +0930)
commit44eea6ca52a2de5a817cf54d5d206969845dee3d
tree995e089c443d2c4a9752a5deb6bc126ec71ec52e
parenta1ace0cd114e0c588d6ce1b9e7386af11716e0bd
tdb: put example hashes into header, so we notice incorrect hash_fn.

This is Stefan Metzmacher <metze@samba.org>'s patch with minor
changes:
1) Use the TDB_MAGIC constant so both hashes aren't of strings.
2) Check the hash in tdb_check (paranoia, really).
3) Additional check in the (unlikely!) case where both examples hash to 0.
4) Cosmetic changes to var names and complaint message.
17 files changed:
ccan/tdb/check.c
ccan/tdb/open.c
ccan/tdb/tdb_private.h
ccan/tdb/test/jenkins-be-hash.tdb
ccan/tdb/test/jenkins-le-hash.tdb
ccan/tdb/test/old-nohash-be.tdb [new file with mode: 0644]
ccan/tdb/test/old-nohash-le.tdb [new file with mode: 0644]
ccan/tdb/test/run-check.c
ccan/tdb/test/run-corrupt.c
ccan/tdb/test/run-oldhash.c [new file with mode: 0644]
ccan/tdb/test/run-rwlock-check.c [new file with mode: 0644]
ccan/tdb/test/run-wronghash-fail.c
ccan/tdb/test/run-wronghash-old.c [deleted file]
ccan/tdb/test/rwlock-be.tdb [new file with mode: 0644]
ccan/tdb/test/rwlock-le.tdb [new file with mode: 0644]
ccan/tdb/test/tdb-be.tdb [deleted file]
ccan/tdb/test/tdb-le.tdb [deleted file]