return ldb_next_request(module, req);
}
+ /*
+ * schemaUpdateNow has been requested. Allow this to refresh the schema
+ * even if we're currently in the middle of a transaction
+ */
+ ret = ldb_set_opaque(ldb, "dsdb_schema_refresh_expected", (void *)1);
+ if (ret != LDB_SUCCESS) {
+ return ldb_operr(ldb);
+ }
+
ret = ldb_extended(ldb, DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID, schema_dn, &ext_res);
if (ret != LDB_SUCCESS) {
+ ldb_set_opaque(ldb, "dsdb_schema_refresh_expected", (void *)0);
return ldb_operr(ldb);
}
talloc_free(ext_res);
+
+ ret = ldb_set_opaque(ldb, "dsdb_schema_refresh_expected", (void *)0);
+ if (ret != LDB_SUCCESS) {
+ return ldb_operr(ldb);
+ }
+
return ldb_module_done(req, NULL, NULL, ret);
}
return schema;
}
- /* We don't allow a schema reload during a transaction - nobody else can modify our schema behind our backs */
if (private_data->in_transaction) {
- return schema;
+
+ /*
+ * If the refresh is not an expected part of a larger
+ * transaction, then we don't allow a schema reload during a
+ * transaction. This stops others from modifying our schema
+ * behind our backs
+ */
+ if (ldb_get_opaque(ldb, "dsdb_schema_refresh_expected") != (void *)1) {
+ return schema;
+ }
}
SMB_ASSERT(ev == ldb_get_event_context(ldb));