0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-07-04 04:08:24 +02:00

Actually check if alias is reserved (#534)

This commit is contained in:
Andrew Morgan 2018-07-06 03:29:15 -07:00 committed by GitHub
parent ae19db60e3
commit 385cab8dc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,9 +115,12 @@ func SetLocalAlias(
// Check that the alias does not fall within an exclusive namespace of an
// application service
// TODO: This code should eventually be refactored with:
// 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
for _, appservice := range cfg.Derived.ApplicationServices {
if userNamespaces, ok := appservice.NamespaceMap["users"]; ok {
for _, namespace := range userNamespaces {
if aliasNamespaces, ok := appservice.NamespaceMap["aliases"]; ok {
for _, namespace := range aliasNamespaces {
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
return util.JSONResponse{
Code: http.StatusBadRequest,