mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 13:53:09 -06:00
Ignore port when matching servername
This commit is contained in:
parent
393cdf6405
commit
695649f329
|
|
@ -84,11 +84,15 @@ func (s *ServerACLs) OnServerACLUpdate(state *gomatrixserverlib.Event) {
|
|||
s.acls[state.RoomID()] = acls
|
||||
}
|
||||
|
||||
func (s *ServerACLs) IsServerBannedFromRoom(serverName gomatrixserverlib.ServerName, roomID string) bool {
|
||||
func (s *ServerACLs) IsServerBannedFromRoom(serverNameAndPort gomatrixserverlib.ServerName, roomID string) bool {
|
||||
acls, ok := s.acls[roomID]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
serverName, _, err := net.SplitHostPort(string(serverNameAndPort))
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
if _, _, err := net.ParseCIDR(fmt.Sprintf("%s/0", serverName)); err == nil {
|
||||
if !acls.AllowIPLiterals {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in a new issue