mirror of
https://github.com/matrix-org/dendrite
synced 2024-11-11 20:31:08 +01:00
Fixes #661.
This commit is contained in:
parent
7edf197ecc
commit
f8463063ac
1 changed files with 10 additions and 6 deletions
|
@ -117,12 +117,16 @@ func SetLocalAlias(
|
||||||
// 1. The new method for checking for things matching an AS's namespace
|
// 1. The new method for checking for things matching an AS's namespace
|
||||||
// 2. Using an overall Regex object for all AS's just like we did for usernames
|
// 2. Using an overall Regex object for all AS's just like we did for usernames
|
||||||
for _, appservice := range cfg.Derived.ApplicationServices {
|
for _, appservice := range cfg.Derived.ApplicationServices {
|
||||||
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
|
// Don't prevent AS from creating aliases in its own namespace
|
||||||
for _, namespace := range aliasNamespaces {
|
// Note that Dendrite uses SenderLocalpart as UserID for AS users
|
||||||
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
if device.UserID != appservice.SenderLocalpart {
|
||||||
return util.JSONResponse{
|
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
|
||||||
Code: http.StatusBadRequest,
|
for _, namespace := range aliasNamespaces {
|
||||||
JSON: jsonerror.ASExclusive("Alias is reserved by an application service"),
|
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusBadRequest,
|
||||||
|
JSON: jsonerror.ASExclusive("Alias is reserved by an application service"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue