mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
server/auth: fix oss-fuzz issue 44478
This commit is contained in:
parent
20c89df5e5
commit
9d83325db8
@ -20,6 +20,7 @@ package auth
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
@ -212,7 +213,11 @@ func (t *tokenSimple) info(ctx context.Context, token string, revision uint64) (
|
||||
|
||||
func (t *tokenSimple) assign(ctx context.Context, username string, rev uint64) (string, error) {
|
||||
// rev isn't used in simple token, it is only used in JWT
|
||||
index := ctx.Value(AuthenticateParamIndex{}).(uint64)
|
||||
var index uint64
|
||||
var ok bool
|
||||
if index, ok = ctx.Value(AuthenticateParamIndex{}).(uint64); !ok {
|
||||
return "", errors.New("failed to assign")
|
||||
}
|
||||
simpleTokenPrefix := ctx.Value(AuthenticateParamSimpleTokenPrefix{}).(string)
|
||||
token := fmt.Sprintf("%s.%d", simpleTokenPrefix, index)
|
||||
t.assignSimpleTokenToUser(username, token)
|
||||
|
Loading…
x
Reference in New Issue
Block a user