/** @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
);\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
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
&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