diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:10:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:10:13 +0930 |
commit | e69c90e5d59027695f158751ed7922d2389d2b5b (patch) | |
tree | 7a0755d7aa3ccb0f7ebfb05d3c126552e0d55980 /lib/tdb2/open.c | |
parent | 34c2d1658a89462e9b34210cb19fe9ab33bc2194 (diff) | |
download | samba-e69c90e5d59027695f158751ed7922d2389d2b5b.tar.gz samba-e69c90e5d59027695f158751ed7922d2389d2b5b.tar.bz2 samba-e69c90e5d59027695f158751ed7922d2389d2b5b.zip |
tdb2: enforce TDB_CONVERT
If the caller actually specifies TDB_CONVERT, fail if the TDB does not
need conversion. It's unusual for the user to specify TDB_CONVERT
(it's auto-detected) but better to be strict.
(Imported from CCAN commit 3e3ee8b0c1e77340ab9e8678c2d23646d8cdb627)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb2/open.c')
-rw-r--r-- | lib/tdb2/open.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/tdb2/open.c b/lib/tdb2/open.c index fb0e05fcaa..bf901c7b35 100644 --- a/lib/tdb2/open.c +++ b/lib/tdb2/open.c @@ -532,6 +532,12 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags, name, (long long)hdr.version); goto fail; } + } else if (tdb->flags & TDB_CONVERT) { + ecode = tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR, + "tdb_open:" + " %s does not need TDB_CONVERT", + name); + goto fail; } tdb_convert(tdb, &hdr, sizeof(hdr)); |