From 6b2f461d520753636f555671a0cf1594c5000e4e Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Thu, 9 Jan 2020 13:36:39 +0000 Subject: [PATCH 1/5] make cmd directory path absolute in build.sh (#830) --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 9a8050f3c..cb1091114 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -GOBIN=$PWD/`dirname $0`/bin go install -v ./cmd/... +GOBIN=$PWD/`dirname $0`/bin go install -v $PWD/`dirname $0`/cmd/... From f7faf74528e1508f43d8d3705c6982b822bb3e9b Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Thu, 9 Jan 2020 16:40:30 +0000 Subject: [PATCH 2/5] Resync testfile with current sytest pass/fail (#832) * Resync testfile with current sytest pass/fail * Add displayname test --- testfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testfile b/testfile index 8a4e9de12..a869aeff1 100644 --- a/testfile +++ b/testfile @@ -197,3 +197,9 @@ Regular users cannot create room aliases within the AS namespace Deleting a non-existent alias should return a 404 Users can't delete other's aliases Outbound federation can query room alias directory +After deactivating account, can't log in with an email +Remote room alias queries can handle Unicode +Newly joined room is included in an incremental sync after invite +Outbound federation can query v1 /send_join +Inbound /v1/make_join rejects remote attempts to join local users to rooms +Inbound federation rejects invites which are not signed by the sender From 714959126beca3a85bac0bd0e8be2e20e8cf8c84 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 9 Jan 2020 17:03:36 +0000 Subject: [PATCH 3/5] Fall back to postgres when database connection string parsing fails (#842) * Fall back to postgres when parsing the database connection string for a URI schema fails * Fix behaviour so that it really tries postgres when URL parsing fails and it complains about unknown schema if it succeeds --- common/keydb/keydb.go | 4 +++- federationsender/storage/storage.go | 6 ++++-- mediaapi/storage/storage.go | 4 +++- publicroomsapi/storage/storage.go | 4 +++- roomserver/storage/storage.go | 4 +++- syncapi/storage/storage.go | 4 +++- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/common/keydb/keydb.go b/common/keydb/keydb.go index b9fa884e2..04692e98c 100644 --- a/common/keydb/keydb.go +++ b/common/keydb/keydb.go @@ -33,7 +33,9 @@ type Database interface { func NewDatabase(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - return nil, err + // if the scheme doesn't match, fall back to postgres in case the config has + // postgres key=value connection strings + return postgres.NewDatabase(dataSourceName) } switch uri.Scheme { case "postgres": diff --git a/federationsender/storage/storage.go b/federationsender/storage/storage.go index 8cffdbf1a..9f2805cf7 100644 --- a/federationsender/storage/storage.go +++ b/federationsender/storage/storage.go @@ -34,12 +34,14 @@ type Database interface { func NewDatabase(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - return nil, err + // if the scheme doesn't match, fall back to postgres in case the config has + // postgres key=value connection strings + return postgres.NewDatabase(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.NewDatabase(dataSourceName) default: - return nil, errors.New("unknown schema") + return errors.New("unknown schema") } } diff --git a/mediaapi/storage/storage.go b/mediaapi/storage/storage.go index 0f39c1d0c..ca9f69f8f 100644 --- a/mediaapi/storage/storage.go +++ b/mediaapi/storage/storage.go @@ -36,7 +36,9 @@ type Database interface { func Open(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - return nil, err + // if the scheme doesn't match, fall back to postgres in case the config has + // postgres key=value connection strings + return postgres.Open(dataSourceName) } switch uri.Scheme { case "postgres": diff --git a/publicroomsapi/storage/storage.go b/publicroomsapi/storage/storage.go index a6a39d523..d611686ba 100644 --- a/publicroomsapi/storage/storage.go +++ b/publicroomsapi/storage/storage.go @@ -39,7 +39,9 @@ type Database interface { func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - return nil, err + // if the scheme doesn't match, fall back to postgres in case the config has + // postgres key=value connection strings + return postgres.NewPublicRoomsServerDatabase(dataSourceName) } switch uri.Scheme { case "postgres": diff --git a/roomserver/storage/storage.go b/roomserver/storage/storage.go index 325d96e99..62e8b64c3 100644 --- a/roomserver/storage/storage.go +++ b/roomserver/storage/storage.go @@ -61,7 +61,9 @@ type Database interface { func Open(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - return nil, err + // if the scheme doesn't match, fall back to postgres in case the config has + // postgres key=value connection strings + return postgres.Open(dataSourceName) } switch uri.Scheme { case "postgres": diff --git a/syncapi/storage/storage.go b/syncapi/storage/storage.go index eedb42f0e..4d896531a 100644 --- a/syncapi/storage/storage.go +++ b/syncapi/storage/storage.go @@ -52,7 +52,9 @@ type Database interface { func NewSyncServerDatasource(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - return nil, err + // if the scheme doesn't match, fall back to postgres in case the config has + // postgres key=value connection strings + return postgres.NewSyncServerDatasource(dataSourceName) } switch uri.Scheme { case "postgres": From ee8e167844fd4d18175cba384996bd2e198f41e4 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 9 Jan 2020 17:09:17 +0000 Subject: [PATCH 4/5] Fix #842 --- federationsender/storage/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federationsender/storage/storage.go b/federationsender/storage/storage.go index 9f2805cf7..98877140a 100644 --- a/federationsender/storage/storage.go +++ b/federationsender/storage/storage.go @@ -42,6 +42,6 @@ func NewDatabase(dataSourceName string) (Database, error) { case "postgres": return postgres.NewDatabase(dataSourceName) default: - return errors.New("unknown schema") + return nil, errors.New("unknown schema") } } From 9e489845eb64636821c180bbf07ffe5e0bcf1ed6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 9 Jan 2020 17:18:19 +0000 Subject: [PATCH 5/5] Fix #842 - again... --- common/keydb/keydb.go | 5 +---- federationsender/storage/storage.go | 5 +---- mediaapi/storage/storage.go | 5 +---- publicroomsapi/storage/storage.go | 5 +---- roomserver/storage/storage.go | 5 +---- syncapi/storage/storage.go | 5 +---- 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/common/keydb/keydb.go b/common/keydb/keydb.go index 04692e98c..d6e590806 100644 --- a/common/keydb/keydb.go +++ b/common/keydb/keydb.go @@ -16,7 +16,6 @@ package keydb import ( "context" - "errors" "net/url" "github.com/matrix-org/dendrite/common/keydb/postgres" @@ -33,14 +32,12 @@ type Database interface { func NewDatabase(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - // if the scheme doesn't match, fall back to postgres in case the config has - // postgres key=value connection strings return postgres.NewDatabase(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.NewDatabase(dataSourceName) default: - return nil, errors.New("unknown schema") + return postgres.NewDatabase(dataSourceName) } } diff --git a/federationsender/storage/storage.go b/federationsender/storage/storage.go index 98877140a..4ce151c7a 100644 --- a/federationsender/storage/storage.go +++ b/federationsender/storage/storage.go @@ -16,7 +16,6 @@ package storage import ( "context" - "errors" "net/url" "github.com/matrix-org/dendrite/common" @@ -34,14 +33,12 @@ type Database interface { func NewDatabase(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - // if the scheme doesn't match, fall back to postgres in case the config has - // postgres key=value connection strings return postgres.NewDatabase(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.NewDatabase(dataSourceName) default: - return nil, errors.New("unknown schema") + return postgres.NewDatabase(dataSourceName) } } diff --git a/mediaapi/storage/storage.go b/mediaapi/storage/storage.go index ca9f69f8f..2c7f937dd 100644 --- a/mediaapi/storage/storage.go +++ b/mediaapi/storage/storage.go @@ -16,7 +16,6 @@ package storage import ( "context" - "errors" "net/url" "github.com/matrix-org/dendrite/mediaapi/storage/postgres" @@ -36,14 +35,12 @@ type Database interface { func Open(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - // if the scheme doesn't match, fall back to postgres in case the config has - // postgres key=value connection strings return postgres.Open(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.Open(dataSourceName) default: - return nil, errors.New("unknown schema") + return postgres.Open(dataSourceName) } } diff --git a/publicroomsapi/storage/storage.go b/publicroomsapi/storage/storage.go index d611686ba..a6e18fbcb 100644 --- a/publicroomsapi/storage/storage.go +++ b/publicroomsapi/storage/storage.go @@ -16,7 +16,6 @@ package storage import ( "context" - "errors" "net/url" "github.com/matrix-org/dendrite/common" @@ -39,14 +38,12 @@ type Database interface { func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - // if the scheme doesn't match, fall back to postgres in case the config has - // postgres key=value connection strings return postgres.NewPublicRoomsServerDatabase(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.NewPublicRoomsServerDatabase(dataSourceName) default: - return nil, errors.New("unknown schema") + return postgres.NewPublicRoomsServerDatabase(dataSourceName) } } diff --git a/roomserver/storage/storage.go b/roomserver/storage/storage.go index 62e8b64c3..df08c124b 100644 --- a/roomserver/storage/storage.go +++ b/roomserver/storage/storage.go @@ -16,7 +16,6 @@ package storage import ( "context" - "errors" "net/url" "github.com/matrix-org/dendrite/roomserver/api" @@ -61,14 +60,12 @@ type Database interface { func Open(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - // if the scheme doesn't match, fall back to postgres in case the config has - // postgres key=value connection strings return postgres.Open(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.Open(dataSourceName) default: - return nil, errors.New("unknown schema") + return postgres.Open(dataSourceName) } } diff --git a/syncapi/storage/storage.go b/syncapi/storage/storage.go index 4d896531a..586e630d3 100644 --- a/syncapi/storage/storage.go +++ b/syncapi/storage/storage.go @@ -16,7 +16,6 @@ package storage import ( "context" - "errors" "net/url" "time" @@ -52,14 +51,12 @@ type Database interface { func NewSyncServerDatasource(dataSourceName string) (Database, error) { uri, err := url.Parse(dataSourceName) if err != nil { - // if the scheme doesn't match, fall back to postgres in case the config has - // postgres key=value connection strings return postgres.NewSyncServerDatasource(dataSourceName) } switch uri.Scheme { case "postgres": return postgres.NewSyncServerDatasource(dataSourceName) default: - return nil, errors.New("unknown schema") + return postgres.NewSyncServerDatasource(dataSourceName) } }