mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +00:00
control/controlclient: fix crash in tests elsewhere when GetNLPublicKey is nil
4001d0bf256 caused tests in another repo to fail with a crash, calling a nil func. This might not be the right fix, but fixes the build. Change-Id: I67263f883c298f307abdd22bc2a30b3393f062e6 Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
8cfd775885
commit
9e5954c598
@ -67,7 +67,7 @@ type Direct struct {
|
|||||||
linkMon *monitor.Mon // or nil
|
linkMon *monitor.Mon // or nil
|
||||||
discoPubKey key.DiscoPublic
|
discoPubKey key.DiscoPublic
|
||||||
getMachinePrivKey func() (key.MachinePrivate, error)
|
getMachinePrivKey func() (key.MachinePrivate, error)
|
||||||
getNLPublicKey func() (key.NLPublic, error)
|
getNLPublicKey func() (key.NLPublic, error) // or nil
|
||||||
debugFlags []string
|
debugFlags []string
|
||||||
keepSharerAndUserSplit bool
|
keepSharerAndUserSplit bool
|
||||||
skipIPForwardingCheck bool
|
skipIPForwardingCheck bool
|
||||||
@ -108,7 +108,10 @@ type Options struct {
|
|||||||
LinkMonitor *monitor.Mon // optional link monitor
|
LinkMonitor *monitor.Mon // optional link monitor
|
||||||
PopBrowserURL func(url string) // optional func to open browser
|
PopBrowserURL func(url string) // optional func to open browser
|
||||||
Dialer *tsdial.Dialer // non-nil
|
Dialer *tsdial.Dialer // non-nil
|
||||||
GetNLPublicKey func() (key.NLPublic, error)
|
|
||||||
|
// GetNLPublicKey specifies an optional function to use
|
||||||
|
// Network Lock. If nil, it's not used.
|
||||||
|
GetNLPublicKey func() (key.NLPublic, error)
|
||||||
|
|
||||||
// Status is called when there's a change in status.
|
// Status is called when there's a change in status.
|
||||||
Status func(Status)
|
Status func(Status)
|
||||||
@ -427,9 +430,12 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
|
|||||||
oldNodeKey = persist.OldPrivateNodeKey.Public()
|
oldNodeKey = persist.OldPrivateNodeKey.Public()
|
||||||
}
|
}
|
||||||
|
|
||||||
nlPub, err := c.getNLPublicKey()
|
var nlPub key.NLPublic
|
||||||
if err != nil {
|
if c.getNLPublicKey != nil {
|
||||||
return false, "", fmt.Errorf("get nl key: %v", err)
|
nlPub, err = c.getNLPublicKey()
|
||||||
|
if err != nil {
|
||||||
|
return false, "", fmt.Errorf("get nl key: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if tryingNewKey.IsZero() {
|
if tryingNewKey.IsZero() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user