Adds guard in session ACL check in case session is not found.

Fixes #2624.
This commit is contained in:
James Phillips 2017-04-13 15:03:17 -07:00
parent d549c9c9f0
commit 76c1e2dd6d
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 3 additions and 0 deletions

View File

@ -43,6 +43,9 @@ func (s *Session) Apply(args *structs.SessionRequest, reply *string) error {
state := s.srv.fsm.State()
_, existing, err := state.SessionGet(nil, args.Session.ID)
if err != nil {
return fmt.Errorf("Session lookup failed: %v", err)
}
if existing == nil {
return fmt.Errorf("Unknown session %q", args.Session.ID)
}
if !acl.SessionWrite(existing.Node) {