From 977b610777619df0a73b3085e21c692126bd9ecb Mon Sep 17 00:00:00 2001 From: dmitri Date: Mon, 7 Nov 2016 15:36:54 +0100 Subject: [PATCH 1/2] Set valid expiration time in the future in CreateSessionResponse. --- lib/web/web.go | 2 +- lib/web/web_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/web/web.go b/lib/web/web.go index a113690a06a..cb4e51a738b 100644 --- a/lib/web/web.go +++ b/lib/web/web.go @@ -447,7 +447,7 @@ func NewSessionResponse(ctx *SessionContext) (*CreateSessionResponse, error) { Type: roundtrip.AuthBearer, Token: webSession.WS.BearerToken, User: user.WebSessionInfo(), - ExpiresIn: int(time.Now().Sub(webSession.WS.Expires) / time.Second), + ExpiresIn: int(webSession.WS.Expires.Sub(time.Now()) / time.Second), }, nil } diff --git a/lib/web/web_test.go b/lib/web/web_test.go index 81e7ed908e5..378f0c4e445 100644 --- a/lib/web/web_test.go +++ b/lib/web/web_test.go @@ -317,6 +317,9 @@ func (s *WebSuite) authPackFromResponse(c *C, re *roundtrip.Response) *authPack if err != nil { panic(err) } + if session.ExpiresIn < 0 { + c.Errorf("expected expiry time to be in the future but got %v", session.ExpiresIn) + } return &authPack{ user: session.User.GetName(), session: session, From 1bde3e1732bcb7ef3299a41176a6452c6fe80d43 Mon Sep 17 00:00:00 2001 From: "zhengchao.deng" Date: Thu, 17 Nov 2016 12:52:56 +0800 Subject: [PATCH 2/2] make under cgo enabled --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7733094be9..a59d653a001 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Run 1. `go get github.com/gravitational/teleport` 2. `cd $GOPATH/src/github.com/gravitational/teleport` -3. `make` +3. `CGO_ENABLED=true make` If the build was successful the binaries are here: `$GOPATH/src/github.com/gravitational/teleport/build`