From 9f1b5403194f55501ded4f9f8e2c50665092b3a2 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 3 Aug 2019 01:44:28 -0700 Subject: [PATCH] ircd::m::join: Check argument is my(user). --- modules/client/rooms/join.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/client/rooms/join.cc b/modules/client/rooms/join.cc index 95f105ef9..0b040a4d4 100644 --- a/modules/client/rooms/join.cc +++ b/modules/client/rooms/join.cc @@ -49,8 +49,18 @@ IRCD_MODULE_EXPORT ircd::m::join(const room &room, const id::user &user_id) { + if(unlikely(!my(user_id))) + throw panic + { + "Can only join my users." + }; + + // Branch for when nothing is known about the room. if(!exists(room)) { + // The bootstrap condcts a blocking make_join and issues a join + // event, returning the event_id; afterward asynchronously it will + // attempt a send_join, and then process the room events. m::event::id::buf ret; m::room::bootstrap { @@ -115,6 +125,12 @@ IRCD_MODULE_EXPORT ircd::m::join(const m::room::alias &room_alias, const m::user::id &user_id) { + if(unlikely(!my(user_id))) + throw panic + { + "Can only join my users." + }; + const room::id::buf room_id { m::room_id(room_alias)