Fix for SMMDR - Send Directory Info

Issue: SMMDR send directory Info command giving response as 0xce
which is incorrect.

Fix: Update request for SMMDR send directory Info command as per IPMI
OEM commands documentation and provided fix to get correct response
as provided in test results.

Tested:
Verified using ipmitool raw commands.
Before:
Command: ipmitool raw 0x3E 0x38 0x01 0x01 2 1 1 0  40 41 42 43 44 45 46
         47 48 49 50 51 52 53 50 0x42 40 41 42 43 44 45 46 47 48 49 50
         51 52 53 50 0x42  //SMMDR send Dir info
Response: Unable to send RAW command (channel=0x0 netfn=0x3e lun=0x0
          cmd=0x38 rsp=0xce): Command response could not be provided

After:
Command: ipmitool raw 0x3E 0x38 0x01 0x01 2 1 2 0  40 41 42 43 44 45 46
         47 48 49 50 51 52 53 50 0x42 40 41 42 43 44 45 46 47 48 49 50
         51 52 53 50 0x42   //SMMDR send Dir info
Response:  01                //True
Command : ipmitool raw 0x3E 0x31 1 1  0  //SMMDR get Dir info
Response: 02 01 01 00 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33
	  34 35 36 42

Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I75d5d08c479922dbd541b1d1b6587f3cf24de5f0
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index e0d1159..058c3ee 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -348,13 +348,31 @@
     return ipmi::responseSuccess(dataOut);
 }
 
+/** @brief implements mdr2 send directory info command
+ *  @param agentId
+ *  @param dirVersion
+ *  @param dirIndex
+ *  @param returnedEntries
+ *  @param remainingEntries
+ *  @param dataInfo
+ *   dataInfo is 32 Bytes in size and contains below parameters
+ *       - dataInfo, size, dataSetSize, dataVersion, timestamp
+ *
+ *  @returns IPMI completion code plus response data
+ *  - bool
+ */
+
 ipmi::RspType<bool> mdr2SendDir(uint16_t agentId, uint8_t dirVersion,
                                 uint8_t dirIndex, uint8_t returnedEntries,
                                 uint8_t remainingEntries,
-                                std::array<uint8_t, 16> dataInfo, uint32_t size,
-                                uint32_t dataSetSize, uint32_t dataVersion,
-                                uint32_t timestamp)
+                                std::vector<uint8_t> dataInfo)
 {
+    if ((static_cast<size_t>(returnedEntries) * dataInfoSize) !=
+        dataInfo.size())
+    {
+        return ipmi::responseReqDataLenInvalid();
+    }
+
     std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
     std::string service = ipmi::getService(*bus, mdrv2Interface, mdrv2Path);
 
@@ -381,7 +399,7 @@
     sdbusplus::message::message method = bus->new_method_call(
         service.c_str(), mdrv2Path, mdrv2Interface, "SendDirectoryInformation");
     method.append(dirVersion, dirIndex, returnedEntries, remainingEntries,
-                  dataInfo, size, dataSetSize, dataVersion, timestamp);
+                  dataInfo);
 
     bool terminate = false;
     try