Skip to content

Commit

Permalink
tdb_wrap: prevent tdbs called ".ntdb" or without extensions.
Browse files Browse the repository at this point in the history
This is another belt-and-braces check in case someone decides to turn
on the fancy new .ntdb extension, and we haven't converted it to ntdb.

Signed-off-by: Rusty Russell <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
rustyrussell committed Feb 20, 2013
1 parent 53aac0b commit e201033
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/tdb_wrap/tdb_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "lib/util/dlinklist.h"
#include "lib/tdb_wrap/tdb_wrap.h"
#include "lib/param/param.h"
#include "ccan/str/str.h"

/*
Log tdb messages via DEBUG().
Expand Down Expand Up @@ -145,6 +146,13 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
struct tdb_wrap *result;
struct tdb_wrap_private *w;

/* If they specify a .ntdb extension, but the code hasn't been
* converted, we want to complain. */
if (name && strends(name, ".ntdb")) {
DEBUG(2, ("tdb(%s): This code does not yet understand ntdb. Please report.\n", name));
return NULL;
}

result = talloc(mem_ctx, struct tdb_wrap);
if (result == NULL) {
return NULL;
Expand Down

0 comments on commit e201033

Please sign in to comment.