s4:dsdb_find_nc_root - fix it up to let the provisioning work correctly
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 15 Jan 2011 17:12:09 +0000 (18:12 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 15 Jan 2011 18:01:11 +0000 (19:01 +0100)
Use the temporary list unless we have at least the three main
"namingContexts" from the rootDSE available (Default, Configuration, Schema -
these are mandatory on all AD deployments!).

This bug has been discovered by Nadya in relation with her SD work.

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Sat Jan 15 19:01:11 CET 2011 on sn-devel-104

source4/dsdb/common/util.c

index b2d4be00689c0a15b2f397b381aa6743ef6131ac..148a77d153477dbc827349145cb5457a55ec0099 100644 (file)
@@ -3284,10 +3284,10 @@ int dsdb_find_nc_root(struct ldb_context *samdb, TALLOC_CTX *mem_ctx, struct ldb
        }
 
        el = ldb_msg_find_element(root_res->msgs[0], "namingContexts");
-       if (!el) {
+       if ((el == NULL) || (el->num_values < 3)) {
                struct ldb_message *tmp_msg;
 
-               DEBUG(5,("Finding namingContexts element in root_res failed. Using a temporary list."));
+               DEBUG(5,("dsdb_find_nc_root: Finding a valid 'namingContexts' element in the RootDSE failed. Using a temporary list."));
 
                /* This generates a temporary list of NCs in order to let the
                 * provisioning work. */