Enhance TargetName check when save iSCSI configuration.
authorYe Ting <ting.ye@intel.com>
Wed, 24 Sep 2014 09:35:54 +0000 (09:35 +0000)
committertye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Sep 2014 09:35:54 +0000 (09:35 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu, Siyuan <siyuan.fu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16168 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/IScsiDxe/IScsiConfig.c

index 1d648f7..c6b48c6 100644 (file)
@@ -541,7 +541,24 @@ IScsiConvertIfrNvDataToAttemptConfigData (
           );\r
         return EFI_INVALID_PARAMETER;\r
       }\r
+\r
+      //\r
+      // Validate iSCSI target name configuration again:\r
+      // The format of iSCSI target name is already verified in IScsiFormCallback() when\r
+      // user input the name; here we only check the case user does not input the name.\r
+      //\r
+      if (Attempt->SessionConfigData.TargetName[0] == '\0') {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"iSCSI target name is NULL!",\r
+          NULL\r
+          );\r
+        return EFI_INVALID_PARAMETER;\r
+      }\r
     }\r
+\r
+\r
     //\r
     // Validate the authentication info.\r
     //\r
@@ -2355,7 +2372,7 @@ IScsiFormCallback (
           &Key,\r
           L"Invalid iSCSI Name!",\r
           NULL\r
-          );       \r
+          );\r
       } else {\r
         AsciiStrCpy (Private->Current->SessionConfigData.TargetName, IScsiName);\r
       }\r