s4-dsdb: call dsdb_make_schema_global() from ldb_wrap
authorAndrew Tridgell <tridge@samba.org>
Tue, 27 Oct 2009 09:30:53 +0000 (20:30 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 27 Oct 2009 09:30:53 +0000 (20:30 +1100)
Calling it from samdb_connect() can cause a stale schema to be put
into the global schema.

Thanks to Andrew Bartlett for spotting this.

source4/dsdb/samdb/samdb.c
source4/lib/ldb_wrap.c

index 70f0409c3d90ff4a759439fb95d642f9358f1408..b3ba63388d71e4e693b56c0e12beb96ea11cc8d6 100644 (file)
@@ -133,7 +133,6 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
        if (!ldb) {
                return NULL;
        }
-       dsdb_make_schema_global(ldb);
        return ldb;
 }
 
index ecd7bf455436c55a86f342324ccc602544afd37c..134c2271fde242ef22b6e42d3ab3bcbd86d85df9 100644 (file)
@@ -248,6 +248,11 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
 
        DLIST_ADD(ldb_wrap_list, w);
 
+       /* make the resulting schema global */
+       if (lp_ctx != NULL && strcmp(lp_sam_url(lp_ctx), url) == 0) {
+               dsdb_make_schema_global(ldb);
+       }
+
        DEBUG(3,("ldb_wrap open of %s\n", url));
 
        talloc_set_destructor(w, ldb_wrap_destructor);