mirror of https://github.com/docker/docs.git
comment about token location ordering
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
parent
d2ca58bbf4
commit
e0c5bb7b83
|
@ -38,6 +38,8 @@ const (
|
||||||
// what key mode to use when generating keys
|
// what key mode to use when generating keys
|
||||||
var (
|
var (
|
||||||
yubikeyKeymode = KeymodeTouch | KeymodePinOnce
|
yubikeyKeymode = KeymodeTouch | KeymodePinOnce
|
||||||
|
// order in which to prefer token locations on the yubikey.
|
||||||
|
// corresponds to: 9c, 9e, 9d, 9a
|
||||||
slotIDs = []int{2, 1, 3, 0}
|
slotIDs = []int{2, 1, 3, 0}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -525,9 +527,11 @@ func getNextEmptySlot(ctx *pkcs11.Ctx, session pkcs11.SessionHandle) ([]byte, er
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, i := range slotIDs {
|
// iterate the token locations in our preferred order and use the first
|
||||||
if !taken[i] {
|
// available one. Otherwise exit the loop and return an error.
|
||||||
return []byte{byte(i)}, nil
|
for _, loc := range slotIDs {
|
||||||
|
if !taken[loc] {
|
||||||
|
return []byte{byte(loc)}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, errors.New("Yubikey has no available slots.")
|
return nil, errors.New("Yubikey has no available slots.")
|
||||||
|
|
Loading…
Reference in New Issue