roomserver: don't make_join with ourselves if clients ask us to

This commit is contained in:
Kegan Dougal 2021-03-08 17:43:07 +00:00
parent e865a1507a
commit 5b7468263e

View file

@ -151,6 +151,15 @@ func (r *Joiner) performJoinRoomByID(
ctx context.Context,
req *api.PerformJoinRequest,
) (string, gomatrixserverlib.ServerName, error) {
// The original client request ?server_name=... may include this HS so filter that out so we
// don't attempt to make_join with ourselves
for i, srv := range req.ServerNames {
if srv == r.Cfg.Matrix.ServerName {
// delete this entry
req.ServerNames = append(req.ServerNames[:i], req.ServerNames[i+1:]...)
}
}
// Get the domain part of the room ID.
_, domain, err := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias)
if err != nil {