static int descriptor_rename(struct ldb_module *module, struct ldb_request *req)
{
	struct ldb_context *ldb = ldb_module_get_ctx(module);
	struct ldb_dn *olddn = req->op.rename.olddn;
	struct ldb_dn *newdn = req->op.rename.newdn;
	int ret;

	/* do not manipulate our control entries */
	if (ldb_dn_is_special(req->op.rename.olddn)) {
		return ldb_next_request(module, req);
	}

	ldb_debug(ldb, LDB_DEBUG_TRACE,"descriptor_rename: %s\n",
		  ldb_dn_get_linearized(olddn));

	if (ldb_dn_compare(olddn, newdn) != 0) {
		struct ldb_dn *nc_root;
		struct GUID guid;

		ret = dsdb_find_nc_root(ldb, req, newdn, &nc_root);
		if (ret != LDB_SUCCESS) {
			return ldb_oom(ldb);
		}

		ret = dsdb_module_guid_by_dn(module,
					     olddn,
					     &guid,
					     req);
		if (ret == LDB_SUCCESS) {
			/*
			 * Without disturbing any errors if the olddn
			 * does not exit, force SD propagation on
			 * this record (get a new inherited SD from
			 * the potentially new parent
			 *
			 * We don't now the parent guid here,
			 * but we're not in a hot code path here,
			 * as the "descriptor" module is located
			 * above the "repl_meta_data", only
			 * originating changes are handled here.
			 *
			 * If it turns out to be a problem we may
			 * search for the new parent guid.
			 */
			struct GUID parent_guid = { .time_low = 0 };

			ret = dsdb_module_schedule_sd_propagation(module,
								  nc_root,
								  guid,
								  parent_guid,
								  true);
			if (ret != LDB_SUCCESS) {
				return ldb_operr(ldb);
			}
		}
	}

	return ldb_next_request(module, req);
}
static int descriptor_rename(struct ldb_module *module, struct ldb_request *req)
{
	struct ldb_context *ldb = ldb_module_get_ctx(module);
	struct ldb_dn *olddn = req->op.rename.olddn;
	struct ldb_dn *newdn = req->op.rename.newdn;
	int ret;

	 
	if (ldb_dn_is_special(req->op.rename.olddn)) {
		return ldb_next_request(module, req);
	}

	ldb_debug(ldb, LDB_DEBUG_TRACE,"descriptor_rename: %s\n",
		  ldb_dn_get_linearized(olddn));

	if (ldb_dn_compare(olddn, newdn) != 0) {
		struct ldb_dn *nc_root;
		struct GUID guid;

		ret = dsdb_find_nc_root(ldb, req, newdn, &nc_root);
		if (ret != LDB_SUCCESS) {
			return ldb_oom(ldb);
		}

		ret = dsdb_module_guid_by_dn(module,
					     olddn,
					     &guid,
					     req);
		if (ret == LDB_SUCCESS) {
			 
			struct GUID parent_guid = { .time_low = 0 };

			ret = dsdb_module_schedule_sd_propagation(module,
								  nc_root,
								  guid,
								  parent_guid,
								  true);
			if (ret != LDB_SUCCESS) {
				return ldb_operr(ldb);
			}
		}
	}

	return ldb_next_request(module, req);
}