Moves the coordinate fetch after the ACL check.

This commit is contained in:
James Phillips 2018-01-19 15:25:22 -08:00
parent f689b22639
commit 93fd6bfeb4
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 8 additions and 8 deletions

View File

@ -35,14 +35,6 @@ func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (int
return nil, MethodNotAllowedError{req.Method, []string{"GET"}}
}
var cs lib.CoordinateSet
if !s.agent.config.DisableCoordinates {
var err error
if cs, err = s.agent.GetLANCoordinate(); err != nil {
return nil, err
}
}
// Fetch the ACL token, if any, and enforce agent policy.
var token string
s.parseToken(req, &token)
@ -54,6 +46,14 @@ func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (int
return nil, acl.ErrPermissionDenied
}
var cs lib.CoordinateSet
if !s.agent.config.DisableCoordinates {
var err error
if cs, err = s.agent.GetLANCoordinate(); err != nil {
return nil, err
}
}
config := struct {
Datacenter string
NodeName string