From 0137ff498aaf392a2ad583a266a6e398e43210cb Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 18 Feb 2017 03:15:42 -0800 Subject: [PATCH] auth/rpc: Token can be concurrently edited protect it. (#3764) Make sure we protect when we access `authToken` in authClient. Fixes #3761 --- cmd/auth-rpc-client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/auth-rpc-client.go b/cmd/auth-rpc-client.go index 74c7815b6..f59fb8b5f 100644 --- a/cmd/auth-rpc-client.go +++ b/cmd/auth-rpc-client.go @@ -115,8 +115,10 @@ func (authClient *AuthRPCClient) call(serviceMethod string, args interface { }, reply interface{}) (err error) { // On successful login, execute RPC call. if err = authClient.Login(); err == nil { + authClient.Lock() // Set token and timestamp before the rpc call. args.SetAuthToken(authClient.authToken) + authClient.Unlock() args.SetRequestTime(time.Now().UTC()) // Do RPC call.