return ldb_next_request(module, req);
}
+static int schema_data_rename(struct ldb_module *module, struct ldb_request *req)
+{
+ struct schema_data_private_data *mc = NULL;
+ struct ldb_dn *parent_dn = NULL;
+ int cmp;
+ int ret;
+
+ /* special objects should always go through */
+ if (ldb_dn_is_special(req->op.del.dn)) {
+ return ldb_next_request(module, req);
+ }
+
+ /* replicated update should always go through */
+ if (ldb_request_get_control(req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
+ return ldb_next_request(module, req);
+ }
+
+ ret = schema_data_check_master(module, req, "rename", &mc, NULL);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ parent_dn = ldb_dn_get_parent(req, req->op.rename.newdn);
+ if (parent_dn == NULL) {
+ return ldb_module_oom(module);
+ }
+
+ cmp = ldb_dn_compare(parent_dn, mc->schema_dn);
+ if (cmp != 0) {
+ return dsdb_module_werror(module,
+ LDB_ERR_UNWILLING_TO_PERFORM,
+ WERR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC,
+ "Move not allowed in schema nc");
+ }
+
+ /*
+ * We may need further contraints here.
+ *
+ * Note some are already handled in samldb.c
+ */
+
+ return ldb_next_request(module, req);
+}
+
static int schema_data_del(struct ldb_module *module, struct ldb_request *req)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
return ldb_next_request(module, down_req);
}
-
static const struct ldb_module_ops ldb_schema_data_module_ops = {
.name = "schema_data",
.init_context = schema_data_init,
.add = schema_data_add,
.modify = schema_data_modify,
+ .rename = schema_data_rename,
.del = schema_data_del,
.search = schema_data_search
};