Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
a61e4522
Commit
a61e4522
authored
8 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Shuffle things around to make unit tests work
parent
1168cbd5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/api/auth.py
+15
-14
15 additions, 14 deletions
synapse/api/auth.py
synapse/types.py
+1
-1
1 addition, 1 deletion
synapse/types.py
with
16 additions
and
15 deletions
synapse/api/auth.py
+
15
−
14
View file @
a61e4522
...
...
@@ -91,23 +91,24 @@ class Auth(object):
if
not
hasattr
(
event
,
"
room_id
"
):
raise
AuthError
(
500
,
"
Event has no room_id: %s
"
%
event
)
sender_domain
=
get_domain_from_id
(
event
.
sender
)
event_id_domain
=
get_domain_from_id
(
event
.
event_id
)
if
do_sig_check
:
sender_domain
=
get_domain_from_id
(
event
.
sender
)
event_id_domain
=
get_domain_from_id
(
event
.
event_id
)
is_invite_via_3pid
=
(
event
.
type
==
EventTypes
.
Member
and
event
.
membership
==
Membership
.
INVITE
and
"
third_party_invite
"
in
event
.
content
)
is_invite_via_3pid
=
(
event
.
type
==
EventTypes
.
Member
and
event
.
membership
==
Membership
.
INVITE
and
"
third_party_invite
"
in
event
.
content
)
# Check the sender's domain has signed the event
if
do_sig_check
and
not
event
.
signatures
.
get
(
sender_domain
):
if
not
is_invite_via_3pid
:
raise
AuthError
(
403
,
"
Event not signed by sender
'
s server
"
)
# Check the sender's domain has signed the event
if
not
event
.
signatures
.
get
(
sender_domain
):
if
not
is_invite_via_3pid
:
raise
AuthError
(
403
,
"
Event not signed by sender
'
s server
"
)
# Check the event_id's domain has signed the event
if
do_sig_check
and
not
event
.
signatures
.
get
(
event_id_domain
):
raise
AuthError
(
403
,
"
Event not signed by sending server
"
)
# Check the event_id's domain has signed the event
if
not
event
.
signatures
.
get
(
event_id_domain
):
raise
AuthError
(
403
,
"
Event not signed by sending server
"
)
if
auth_events
is
None
:
# Oh, we don't know what the state of the room was, so we
...
...
This diff is collapsed.
Click to expand it.
synapse/types.py
+
1
−
1
View file @
a61e4522
...
...
@@ -56,7 +56,7 @@ def get_domain_from_id(string):
try
:
return
string
.
split
(
"
:
"
,
1
)[
1
]
except
IndexError
:
raise
SynapseError
(
400
,
"
Invalid ID: %r
"
,
string
)
raise
SynapseError
(
400
,
"
Invalid ID: %r
"
%
(
string
,)
)
class
DomainSpecificString
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment