]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiConfig.c
MdeModulePkg-DxeCore: rename CoreGetMemoryMapPropertiesTable
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiConfig.c
index 1d648f78bd4c0e2afdb9f58e1e4bf7584abf1808..69a400389dc5d57372b665ac1f0a2e3442dacdb6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper functions for configuring or getting the parameters relating to iSCSI.\r
 \r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -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
@@ -2143,6 +2160,25 @@ IScsiFormCallback (
   if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
     switch (QuestionId) {\r
     case KEY_ADD_ATTEMPT:\r
+      //\r
+      // Check whether iSCSI initiator name is configured already.\r
+      //\r
+      mPrivate->InitiatorNameLength = ISCSI_NAME_MAX_SIZE;\r
+      Status = gIScsiInitiatorName.Get (\r
+                                     &gIScsiInitiatorName,\r
+                                     &mPrivate->InitiatorNameLength,\r
+                                     mPrivate->InitiatorName\r
+                                     );\r
+      if (EFI_ERROR (Status)) {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"Error: please configure iSCSI initiator name first!",\r
+          NULL\r
+          );        \r
+        break;\r
+      }\r
+      \r
       Status = IScsiConfigAddAttempt ();\r
       break;\r
 \r
@@ -2355,9 +2391,9 @@ IScsiFormCallback (
           &Key,\r
           L"Invalid iSCSI Name!",\r
           NULL\r
-          );       \r
+          );\r
       } else {\r
-        AsciiStrCpy (Private->Current->SessionConfigData.TargetName, IScsiName);\r
+        AsciiStrCpyS (Private->Current->SessionConfigData.TargetName, ISCSI_NAME_MAX_SIZE, IScsiName);\r
       }\r
 \r
       break;\r