mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
roomserver: don't make_join with ourselves if clients ask us to (#1797)
* roomserver: don't make_join with ourselves if clients ask us to * delete properly
This commit is contained in:
parent
77fb981da5
commit
3c419be6af
@ -151,6 +151,16 @@ func (r *Joiner) performJoinRoomByID(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *api.PerformJoinRequest,
|
req *api.PerformJoinRequest,
|
||||||
) (string, gomatrixserverlib.ServerName, error) {
|
) (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 := 0; i < len(req.ServerNames); i++ {
|
||||||
|
if req.ServerNames[i] == r.Cfg.Matrix.ServerName {
|
||||||
|
// delete this entry
|
||||||
|
req.ServerNames = append(req.ServerNames[:i], req.ServerNames[i+1:]...)
|
||||||
|
i--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the domain part of the room ID.
|
// Get the domain part of the room ID.
|
||||||
_, domain, err := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias)
|
_, domain, err := gomatrixserverlib.SplitID('!', req.RoomIDOrAlias)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user