2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Merge pull request #5189 from xuweibj/openbmc_ipmi

modify ipmi rsp check to support openbmc ipmi interface
This commit is contained in:
Mark Gurevich 2018-05-11 07:53:34 -04:00 committed by GitHub
commit ac6b632b6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -682,9 +682,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}));
@ -766,10 +771,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 ];