Merge commit 'master/master'
[samba.git] / source4 / dsdb / samdb / ldb_modules / partition.c
index 1274061e775549666f13c9dbd6f2f6060f60d5a9..8e4483a78e375c81a9db5bffba4118bd48320f04 100644 (file)
@@ -472,6 +472,14 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
+       /*
+        * for now pass down the LDB_CONTROL_SEARCH_OPTIONS_OID control
+        * down as uncritical to make windows 2008 dcpromo happy.
+        */
+       if (search_control) {
+               search_control->critical = 0;
+       }
+
        /* TODO:
           Generate referrals (look for a partition under this DN) if we don't have the above control specified
        */
@@ -1186,6 +1194,20 @@ static int partition_init(struct ldb_module *module)
                }
        }
 
+       ret = ldb_mod_register_control(module, LDB_CONTROL_DOMAIN_SCOPE_OID);
+       if (ret != LDB_SUCCESS) {
+               ldb_debug(module->ldb, LDB_DEBUG_ERROR,
+                       "partition: Unable to register control with rootdse!\n");
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
+
+       ret = ldb_mod_register_control(module, LDB_CONTROL_SEARCH_OPTIONS_OID);
+       if (ret != LDB_SUCCESS) {
+               ldb_debug(module->ldb, LDB_DEBUG_ERROR,
+                       "partition: Unable to register control with rootdse!\n");
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
+
        talloc_free(mem_ctx);
        return ldb_next_init(module);
 }