dbwrap: dbwrap_local_open()
[metze/samba/wip.git] / lib / dbwrap / dbwrap_tdb.c
index ece7b9d8b5f0c6335c7c0f842bb2bb2058ed0818..1452ff7e8acc1d78c371a3d14cfc2bec3604d51e 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/tdb_wrap/tdb_wrap.h"
 #include "lib/util/util_tdb.h"
 #include "system/filesys.h"
+#include "ccan/str/str.h"
 
 struct db_tdb_ctx {
        struct tdb_wrap *wtdb;
@@ -385,6 +386,12 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
        struct db_tdb_ctx *db_tdb;
        struct stat st;
 
+       /* Extra paranoia. */
+       if (name && strends(name, ".ntdb")) {
+               DEBUG(0, ("can't try to open %s with tdb!\n", name));
+               return NULL;
+       }
+
        result = talloc_zero(mem_ctx, struct db_context);
        if (result == NULL) {
                DEBUG(0, ("talloc failed\n"));