mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
Signed event copies should be complete
This commit is contained in:
parent
35bc2e98e6
commit
cef7db0469
4 changed files with 19 additions and 8 deletions
|
@ -161,9 +161,16 @@ func processInvite(
|
|||
}
|
||||
|
||||
// Sign the event so that other servers will know that we have received the invite.
|
||||
signedEvent := event.Sign(
|
||||
signedEvent, err := event.Sign(
|
||||
string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey,
|
||||
)
|
||||
if err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("event.Sign failed")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: jsonerror.InternalServerError(),
|
||||
}
|
||||
}
|
||||
|
||||
// Add the invite event to the roomserver.
|
||||
err = api.SendInvite(
|
||||
|
@ -178,12 +185,12 @@ func processInvite(
|
|||
if isInviteV2 {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: gomatrixserverlib.RespInviteV2{Event: &signedEvent},
|
||||
JSON: gomatrixserverlib.RespInviteV2{Event: signedEvent},
|
||||
}
|
||||
} else {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: gomatrixserverlib.RespInvite{Event: &signedEvent},
|
||||
JSON: gomatrixserverlib.RespInvite{Event: signedEvent},
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -296,11 +296,15 @@ func attemptMakeJoinForRestrictedMembership(
|
|||
// other servers can use to verify that the user we put into the
|
||||
// `join_authorised_via_users_server` field was actually checked
|
||||
// and found by us.
|
||||
signed := event.Sign(string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey)
|
||||
signed, err := event.Sign(string(cfg.Matrix.ServerName), cfg.Matrix.KeyID, cfg.Matrix.PrivateKey)
|
||||
if err != nil {
|
||||
logger.WithError(err).Error("Failed to sign event")
|
||||
return jsonerror.InternalServerError()
|
||||
}
|
||||
|
||||
// Now, see if the join is valid with the new changes. If it isn't
|
||||
// then something else is forbidding the join.
|
||||
if err = gomatrixserverlib.Allowed(&signed, &provider); err != nil {
|
||||
if err = gomatrixserverlib.Allowed(signed, &provider); err != nil {
|
||||
logger.WithError(err).Error("Join is not allowed")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusForbidden,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue