s3:idmap_tdb: prevent opening the idmap db more than once.
[amitay/samba.git] / source3 / winbindd / idmap_tdb.c
index 86bb018bb0c20f202151eb2766aae1d7a1a66e2d..8bb615d8f8ddcdb3c8b72200ba397076a6a3dcbe 100644 (file)
@@ -268,6 +268,11 @@ static NTSTATUS idmap_tdb_open_db(struct idmap_domain *dom)
 
        ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
 
+       if (ctx->db) {
+               /* it is already open */
+               return NT_STATUS_OK;
+       }
+
        /* use our own context here */
        mem_ctx = talloc_stackframe();