diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index 18b5d3990..cfad87489 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -88,6 +88,7 @@ struct ircd::m::vm::eval event::conforms report; string_view room_version; const hook::base::site *phase {nullptr}; + bool room_internal {false}; static bool for_each_pdu(const std::function &); static const event *find_pdu(const eval &, const event::id &); diff --git a/matrix/vm_execute.cc b/matrix/vm_execute.cc index 8fcabd58d..1db532aa7 100644 --- a/matrix/vm_execute.cc +++ b/matrix/vm_execute.cc @@ -468,14 +468,14 @@ ircd::m::vm::execute_pdu(eval &eval, at<"type"_>(event) }; - const bool internal + const scope_restore room_internal { - m::internal(room_id) + eval.room_internal, m::internal(room_id) }; const bool authenticate { - opts.auth && !internal + opts.auth && !eval.room_internal }; // The conform hook runs static checks on an event's formatting and @@ -486,7 +486,7 @@ ircd::m::vm::execute_pdu(eval &eval, call_hook(conform_hook, eval, event, eval); } - if(unlikely(internal && !my(event))) + if(unlikely(eval.room_internal && !my(event))) throw error { fault::GENERAL, "Internal room event denied from external source." @@ -730,7 +730,7 @@ ircd::m::vm::write_append(eval &eval, //XXX const auto &[pass, fail] { - opts.auth && !internal(room.room_id)? + opts.auth && !eval.room_internal? room::auth::check(event, room): room::auth::passfail{true, {}} };