Add initiateErase check for clear SEL command
Add the check of the byte initiateErase (0xAA) for clear SEL command.
Tested:
After modifying, ipmitool can report the error of invalid data request
when erase operation is not 0x00 or 0xAA.
Change-Id: Ie450755ade00c6f20197d4f28c899aeb8002fb5e
Signed-off-by: Xiaoyu Ma <maxiaoyu@ieisystem.com>
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 581a3de..18aba33 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -515,6 +515,12 @@
static_cast<uint8_t>(ipmi::sel::eraseComplete));
}
+ // Check that initiate erase is correct
+ if (eraseOperation != ipmi::sel::initiateErase)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+
// Per the IPMI spec, need to cancel any reservation when the SEL is cleared
cancelSELReservation();