samdb: Handle schema setup in samdb, not in more generic ldbsamba.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 10 Oct 2010 14:56:55 +0000 (16:56 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 10 Oct 2010 21:08:45 +0000 (23:08 +0200)
source4/dsdb/samdb/samdb.c
source4/lib/ldb-samba/ldb_wrap.c
source4/lib/ldb-samba/ldif_handlers.c
source4/lib/ldb-samba/wscript_build

index 637da4fcf2e632856d791a2435ddb05252a992ff..081ee7e2eeff3f79f56c6c12ce8d0d48f12a9403 100644 (file)
@@ -126,13 +126,22 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
                                  struct auth_session_info *session_info)
 {
        struct ldb_context *ldb;
+       struct dsdb_schema *schema;
        ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx,
                               lpcfg_sam_url(lp_ctx), session_info,
                               samdb_credentials(ev_ctx, lp_ctx),
                               0);
+
        if (!ldb) {
                return NULL;
        }
+
+       schema = dsdb_get_schema(ldb, NULL);
+       /* make the resulting schema global */
+       if (schema) {
+               dsdb_make_schema_global(ldb, schema);
+       }
+
        return ldb;
 }
 
index ebc1818c76013820c4435341de1f30c5ddbd5da5..7cf9128e96aa3358ddc48d3d05f6e461120e963b 100644 (file)
@@ -61,7 +61,7 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level,
        case LDB_DEBUG_TRACE:
                samba_level = 5;
                break;
-               
+
        };
        vasprintf(&s, fmt, ap);
        if (!s) return;
@@ -117,6 +117,7 @@ static int ldb_wrap_destructor(struct ldb_wrap *w)
        return 0;
 }
 
+
 /*
   wrapped connection to a ldb database
   to close just talloc_free() the returned ldb_context
@@ -267,14 +268,6 @@ static int ldb_wrap_destructor(struct ldb_wrap *w)
 
        DLIST_ADD(ldb_wrap_list, w);
 
-       /* make the resulting schema global */
-       if (lp_ctx != NULL && strcmp(lpcfg_sam_url(lp_ctx), url) == 0) {
-               struct dsdb_schema *schema = dsdb_get_schema(ldb, NULL);
-               if (schema) {
-                       dsdb_make_schema_global(ldb, schema);
-               }
-       }
-
        DEBUG(3,("ldb_wrap open of %s\n", url));
 
        talloc_set_destructor(w, ldb_wrap_destructor);
index 324209b836ee382d51aa81f63ef5bd2bd5a034f5..7cb42e36dc0a066117c25ef4bafe6178c52e9b4b 100644 (file)
@@ -1299,7 +1299,6 @@ int ldb_register_samba_handlers(struct ldb_context *ldb)
                        return ret;
                }
 
-               
        }
 
        return LDB_SUCCESS;
index 7fdaac8b90252c0e9466fce8a7cca62683ccd86f..d6478843533c349def18093e2de5a83768ba6838 100644 (file)
@@ -9,7 +9,7 @@ bld.SAMBA_SUBSYSTEM('LDBSAMBA',
        autoproto='ldif_handlers_proto.h',
        public_deps='ldb',
        public_headers='ldb_wrap.h',
-       deps='LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_DRSBLOBS CREDENTIALS UTIL_LDB NDR_DNSP'
+       deps='LIBSECURITY LIBNDR NDR_DRSBLOBS CREDENTIALS UTIL_LDB NDR_DNSP'
        )