don't fall for nil pointer dereference in account file
This commit is contained in:
parent
fc6a4fd5d8
commit
a6e263adb6
@ -55,12 +55,17 @@ func (s *StepCreateWindowsPassword) Run(ctx context.Context, state multistep.Sta
|
|||||||
buf := make([]byte, 4)
|
buf := make([]byte, 4)
|
||||||
binary.BigEndian.PutUint32(buf, uint32(priv.E))
|
binary.BigEndian.PutUint32(buf, uint32(priv.E))
|
||||||
|
|
||||||
|
email := ""
|
||||||
|
if c.Account != nil {
|
||||||
|
email = c.Account.Email
|
||||||
|
}
|
||||||
|
|
||||||
data := WindowsPasswordConfig{
|
data := WindowsPasswordConfig{
|
||||||
key: priv,
|
key: priv,
|
||||||
UserName: c.Comm.WinRMUser,
|
UserName: c.Comm.WinRMUser,
|
||||||
Modulus: base64.StdEncoding.EncodeToString(priv.N.Bytes()),
|
Modulus: base64.StdEncoding.EncodeToString(priv.N.Bytes()),
|
||||||
Exponent: base64.StdEncoding.EncodeToString(buf[1:]),
|
Exponent: base64.StdEncoding.EncodeToString(buf[1:]),
|
||||||
Email: c.Account.Email,
|
Email: email,
|
||||||
ExpireOn: time.Now().Add(time.Minute * 5),
|
ExpireOn: time.Now().Add(time.Minute * 5),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user