2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-18 12:20:40 +00:00

modify ipmi rsp check to support openbmc ipmi interface

This commit is contained in:
XuWei
2018-05-10 01:59:05 -04:00
parent 7bbf1cacec
commit 582168e31e

View File

@ -679,9 +679,14 @@ sub handle_ipmi_packet {
if ($rsp[5] & 0b10000000) {
$encrypted = 1;
}
#------------------------modified to support openbmc ipmi command----------------
unless ($rsp[5] & 0b01000000) {
return 3; #we refuse to examine unauthenticated packets in this context
if ($self->{max_privilege} != 0) {
return 3; #we refuse to examine unauthenticated packets in this context
}
}
splice(@rsp, 0, 4); #ditch the rmcp header
my @authcode = splice(@rsp, -12); #strip away authcode and remember it
my @expectedcode = unpack("C*", hmac_sha1(pack("C*", @rsp), $self->{k1}));
@ -763,10 +768,13 @@ sub got_rmcp_response {
return 9;
}
$byte = shift @data;
unless ($byte >= 4) {
# add $byte == 0 to support openbmc ipmi command
unless ($byte >= 4 or $byte == 0) {
$self->{onlogon}->("ERROR: Cannot acquire sufficient privilege", $self->{onlogon_args});
return 9;
}
$self->{max_privilege} = $byte if ($byte == 0);
splice @data, 0, 5;
$self->{pendingsessionid} = [ splice @data, 0, 4 ];