summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-03-22 15:17:58 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-03-22 20:24:40 +1100
commitfc5a507a86f37aecb6702d8c2c3bdc462e49f9fd (patch)
tree49b35c16cf6459e8684c4446cb609bbad1bb78d1
parent8195832c6cde7ebb2de5543be76979a111bd5712 (diff)
downloadsamba-fc5a507a86f37aecb6702d8c2c3bdc462e49f9fd.tar.gz
samba-fc5a507a86f37aecb6702d8c2c3bdc462e49f9fd.tar.bz2
samba-fc5a507a86f37aecb6702d8c2c3bdc462e49f9fd.zip
s4:dsdb Don't load the schema unconditionally
Schema loads now come at a price, so avoid doing them if we don't have to (such as when doing an @REPLCHANGED or other special DN based search). Andrew Bartlett
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn_out.c5
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_data.c17
2 files changed, 19 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
index b5f4567e5f..b0d618ab83 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
@@ -564,6 +564,11 @@ static int extended_dn_out_search(struct ldb_module *module, struct ldb_request
struct extended_dn_out_private *p = talloc_get_type(ldb_module_get_private(module), struct extended_dn_out_private);
+ /* The schema manipulation does not apply to special DNs */
+ if (ldb_dn_is_special(req->op.search.base)) {
+ return ldb_next_request(module, req);
+ }
+
/* check if there's an extended dn control */
control = ldb_request_get_control(req, LDB_CONTROL_EXTENDED_DN_OID);
if (control && control->data) {
diff --git a/source4/dsdb/samdb/ldb_modules/schema_data.c b/source4/dsdb/samdb/ldb_modules/schema_data.c
index 25f2dcec8b..655b4892af 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_data.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_data.c
@@ -417,12 +417,17 @@ static int schema_data_search(struct ldb_module *module, struct ldb_request *req
int ret;
struct schema_data_search_data *search_context;
struct ldb_request *down_req;
- struct dsdb_schema *schema = dsdb_get_schema(ldb, NULL);
+ const struct dsdb_schema *schema;
+ if (!ldb_module_get_private(module)) {
+ /* If there is no module data, there is little we can do */
+ return ldb_next_request(module, req);
+ }
- if (!schema || !ldb_module_get_private(module)) {
- /* If there is no schema, there is little we can do */
+ /* The schema manipulation does not apply to special DNs */
+ if (ldb_dn_is_special(req->op.search.base)) {
return ldb_next_request(module, req);
}
+
for (i=0; i < ARRAY_SIZE(generated_attrs); i++) {
if (ldb_attr_in_list(req->op.search.attrs, generated_attrs[i].attr)) {
break;
@@ -434,6 +439,12 @@ static int schema_data_search(struct ldb_module *module, struct ldb_request *req
return ldb_next_request(module, req);
}
+ schema = dsdb_get_schema(ldb, NULL);
+ if (!schema || !ldb_module_get_private(module)) {
+ /* If there is no schema, there is little we can do */
+ return ldb_next_request(module, req);
+ }
+
search_context = talloc(req, struct schema_data_search_data);
if (!search_context) {
ldb_oom(ldb);