代码拉取完成,页面将自动刷新
package ipmi
import "fmt"
// 22.16
type GetSessionChallengeRequest struct {
// Authentication Type for Challenge
// indicating what type of authentication type the console wants to use.
AuthType AuthType
// Sixteen-bytes. All 0s for null user name (User 1)
Username [16]byte
}
type GetSessionChallengeResponse struct {
TemporarySessionID uint32 // LS byte first
Challenge [16]byte
}
func (req *GetSessionChallengeRequest) Command() Command {
return CommandGetSessionChallenge
}
func (req *GetSessionChallengeRequest) Pack() []byte {
out := make([]byte, 17)
packUint8(uint8(req.AuthType), out, 0)
packBytes(req.Username[:], out, 1)
return out
}
func (res *GetSessionChallengeResponse) Unpack(msg []byte) error {
if len(msg) < 20 {
return ErrUnpackedDataTooShortWith(len(msg), 20)
}
res.TemporarySessionID, _, _ = unpackUint32L(msg, 0)
b, _, _ := unpackBytes(msg, 4, 16)
res.Challenge = array16(b)
return nil
}
func (*GetSessionChallengeResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{
0x81: "invalid user name",
0x82: "null user name (User 1) not enabled",
}
}
func (res *GetSessionChallengeResponse) Format() string {
return fmt.Sprintf("%v", res)
}
// The command selects which of the BMC-supported authentication types the Remote Console would like to use,
// and a username that selects which set of user information should be used for the session
func (c *Client) GetSessionChallenge() (response *GetSessionChallengeResponse, err error) {
username := padBytes(c.Username, 16, 0x00)
request := &GetSessionChallengeRequest{
AuthType: c.session.authType,
Username: array16(username),
}
response = &GetSessionChallengeResponse{}
err = c.Exchange(request, response)
if err != nil {
return
}
c.session.v15.sessionID = response.TemporarySessionID
c.session.v15.challenge = response.Challenge
return
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。