* [patch] NetworkPkg: Fix some bugs related to iSCSI keyword configuration.
@ 2017-03-24 8:43 Zhang Lubo
2017-03-30 8:32 ` Ye, Ting
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Lubo @ 2017-03-24 8:43 UTC (permalink / raw)
To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Wu Jiaxin
Add check logic and error message for some keywords validity.
show target address in URL format and MAC address correctly.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
---
NetworkPkg/IScsiDxe/IScsiConfig.c | 78 +++++++++++++++++++++++++++------------
1 file changed, 54 insertions(+), 24 deletions(-)
diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 1fe279e..56a8685 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -626,14 +626,17 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
LIST_ENTRY *Entry;
ISCSI_ATTEMPT_CONFIG_NVDATA *Attempt;
ISCSI_SESSION_CONFIG_NVDATA *SessionConfigData;
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfigData;
CHAR16 AttemptNameList[ATTEMPT_NAME_LIST_SIZE];
+ ISCSI_NIC_INFO *NicInfo;
+ CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
EFI_IP_ADDRESS Ip;
UINTN Index;
UINTN StringLen;
+ NicInfo = NULL;
ZeroMem (AttemptNameList, sizeof (AttemptNameList));
if ((mPrivate != NULL) && (mPrivate->AttemptCount != 0)) {
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
Attempt = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
@@ -700,12 +703,12 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
);
if (SessionConfigData->DnsMode) {
AsciiStrToUnicodeStrS (
SessionConfigData->TargetUrl,
- IfrNvData->TargetIp,
- sizeof (IfrNvData->TargetIp) / sizeof (IfrNvData->TargetIp[0])
+ IfrNvData->Keyword[Index].ISCSITargetIpAddress,
+ sizeof (IfrNvData->Keyword[Index].ISCSITargetIpAddress) / sizeof (IfrNvData->Keyword[Index].ISCSITargetIpAddress[0])
);
}
IScsiLunToUnicodeStr (SessionConfigData->BootLun, IfrNvData->Keyword[Index].ISCSILun);
IScsiConvertIsIdToString (IfrNvData->Keyword[Index].ISCSIIsId, SessionConfigData->IsId);
@@ -738,13 +741,29 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
IfrNvData->Keyword[Index].ISCSIReverseChapSecret,
ISCSI_CHAP_SECRET_STORAGE
);
}
}
-
CopyMem(IfrNvData->ISCSIDisplayAttemptList, AttemptNameList, ATTEMPT_NAME_LIST_SIZE);
}
+
+ NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
+ NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
+ IScsiMacAddrToStr (
+ &NicInfo->PermanentAddress,
+ NicInfo->HwAddressSize,
+ NicInfo->VlanId,
+ MacString
+ );
+ CopyMem (
+ IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr),
+ MacString,
+ StrLen (MacString) * sizeof (CHAR16)
+ );
+
+ *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) = L'/';
+ }
}
/**
Convert the IFR data to iSCSI configuration data.
@@ -1193,10 +1212,12 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
)
{
ISCSI_ATTEMPT_CONFIG_NVDATA *Attempt;
UINT8 AttemptIndex;
UINT8 Index;
+ UINT8 ChapSecretLen;
+ UINT8 ReverseChapSecretLen;
CHAR16 *AttemptName1;
CHAR16 *AttemptName2;
ISCSI_ATTEMPT_CONFIG_NVDATA *SameNicAttempt;
CHAR8 LunString[ISCSI_LUN_STR_MAX_LEN];
CHAR8 IScsiName[ISCSI_NAME_MAX_SIZE];
@@ -1342,38 +1363,45 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
AttemptIndex = (UINT8) ((OffSet - ATTEMPT_CONNECT_RETRY_VAR_OFFSET) + 1);
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
if (Attempt == NULL) {
return EFI_INVALID_PARAMETER;
}
- Attempt->SessionConfigData.ConnectRetryCount = IfrNvData->ISCSIConnectRetry[AttemptIndex - 1];
- if (Attempt->SessionConfigData.ConnectRetryCount == 0) {
- Attempt->SessionConfigData.ConnectRetryCount = CONNECT_MIN_RETRY;
+
+ if (IfrNvData->ISCSIConnectRetry[AttemptIndex - 1] > CONNECT_MAX_RETRY) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"The minimum value is 0 and the maximum is 16. 0 means no retry.",
+ NULL
+ );
+ return EFI_INVALID_PARAMETER;
}
+ Attempt->SessionConfigData.ConnectRetryCount = IfrNvData->ISCSIConnectRetry[AttemptIndex - 1];
} else if ((OffSet >= ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET)) {
AttemptIndex = (UINT8) ((OffSet - ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) / 2 + 1);
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
if (Attempt == NULL) {
return EFI_INVALID_PARAMETER;
}
+
+ if ((IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] < CONNECT_MIN_TIMEOUT) ||
+ (IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] > CONNECT_MAX_TIMEOUT)) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"The minimum value is 100 milliseconds and the maximum is 20 seconds.",
+ NULL
+ );
+ return EFI_INVALID_PARAMETER;
+ }
+
Attempt->SessionConfigData.ConnectTimeout = IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1];
if (Attempt->SessionConfigData.ConnectTimeout == 0) {
Attempt->SessionConfigData.ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
}
- if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (Attempt->SessionConfigData.ConnectTimeout < CONNECT_MIN_TIMEOUT) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"Connection Establishing Timeout is less than minimum value 100ms.",
- NULL
- );
- return EFI_INVALID_PARAMETER;
- }
- }
-
} else if ((OffSet >= ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET)) {
AttemptIndex = (UINT8) ((OffSet - ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) + 1);
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
if (Attempt == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1621,11 +1649,11 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
Attempt->AuthConfigData.CHAP.CHAPName,
ISCSI_CHAP_NAME_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->CHAPName[0] == L'\0') {
+ if (IfrNvData->Keyword[Index].ISCSIChapUsername[0] == L'\0') {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
L"CHAP Name is invalid!",
NULL
@@ -1643,22 +1671,23 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
return EFI_INVALID_PARAMETER;
}
} else if ((OffSet >= ATTEMPT_CHAR_SECRET_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET)) {
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
+ ChapSecretLen = (UINT8)StrLen (IfrNvData->Keyword[Index].ISCSIChapSecret);
UnicodeStrToAsciiStrS (
IfrNvData->Keyword[Index].ISCSIChapSecret,
Attempt->AuthConfigData.CHAP.CHAPSecret,
ISCSI_CHAP_SECRET_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->CHAPSecret[0] == L'\0') {
+ if ((ChapSecretLen < ISCSI_CHAP_SECRET_MIN_LEN) || (ChapSecretLen > ISCSI_CHAP_SECRET_MAX_LEN)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
- L"CHAP Secret is invalid!",
+ L"The Chap Secret minimum length is 12 bytes and the maximum length is 16 bytes.",
NULL
);
return EFI_INVALID_PARAMETER;
}
}
@@ -1678,11 +1707,11 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
IfrNvData->Keyword[Index].ISCSIReverseChapUsername,
Attempt->AuthConfigData.CHAP.ReverseCHAPName,
ISCSI_CHAP_NAME_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->ReverseCHAPName[0] == L'\0') {
+ if (IfrNvData->Keyword[Index].ISCSIReverseChapUsername[0] == L'\0') {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
L"Reverse CHAP Name is invalid!",
NULL
@@ -1700,22 +1729,23 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
return EFI_INVALID_PARAMETER;
}
} else if (OffSet >= ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET) {
if (Attempt->AuthConfigData.CHAP.CHAPType == ISCSI_CHAP_MUTUAL) {
+ ReverseChapSecretLen = (UINT8)StrLen (IfrNvData->Keyword[Index].ISCSIReverseChapSecret);
UnicodeStrToAsciiStrS (
IfrNvData->Keyword[Index].ISCSIReverseChapSecret,
Attempt->AuthConfigData.CHAP.ReverseCHAPSecret,
ISCSI_CHAP_SECRET_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->ReverseCHAPSecret[0] == L'\0') {
+ if ((ReverseChapSecretLen < ISCSI_CHAP_SECRET_MIN_LEN) || (ReverseChapSecretLen > ISCSI_CHAP_SECRET_MAX_LEN)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
- L"Reverse CHAP Secret is invalid!",
+ L"The Reverse CHAP Secret minimum length is 12 bytes and the maximum length is 16 bytes.",
NULL
);
return EFI_INVALID_PARAMETER;
}
}
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] NetworkPkg: Fix some bugs related to iSCSI keyword configuration.
2017-03-24 8:43 [patch] NetworkPkg: Fix some bugs related to iSCSI keyword configuration Zhang Lubo
@ 2017-03-30 8:32 ` Ye, Ting
0 siblings, 0 replies; 2+ messages in thread
From: Ye, Ting @ 2017-03-30 8:32 UTC (permalink / raw)
To: Zhang, Lubo, edk2-devel@lists.01.org; +Cc: Fu, Siyuan, Wu, Jiaxin
Reviewed-by: Ye Ting <ting.ye@intel.com>
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhang Lubo
Sent: Friday, March 24, 2017 4:43 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [patch] NetworkPkg: Fix some bugs related to iSCSI keyword configuration.
Add check logic and error message for some keywords validity.
show target address in URL format and MAC address correctly.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
---
NetworkPkg/IScsiDxe/IScsiConfig.c | 78 +++++++++++++++++++++++++++------------
1 file changed, 54 insertions(+), 24 deletions(-)
diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 1fe279e..56a8685 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -626,14 +626,17 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
LIST_ENTRY *Entry;
ISCSI_ATTEMPT_CONFIG_NVDATA *Attempt;
ISCSI_SESSION_CONFIG_NVDATA *SessionConfigData;
ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfigData;
CHAR16 AttemptNameList[ATTEMPT_NAME_LIST_SIZE];
+ ISCSI_NIC_INFO *NicInfo;
+ CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
EFI_IP_ADDRESS Ip;
UINTN Index;
UINTN StringLen;
+ NicInfo = NULL;
ZeroMem (AttemptNameList, sizeof (AttemptNameList));
if ((mPrivate != NULL) && (mPrivate->AttemptCount != 0)) {
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
Attempt = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link); @@ -700,12 +703,12 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
);
if (SessionConfigData->DnsMode) {
AsciiStrToUnicodeStrS (
SessionConfigData->TargetUrl,
- IfrNvData->TargetIp,
- sizeof (IfrNvData->TargetIp) / sizeof (IfrNvData->TargetIp[0])
+ IfrNvData->Keyword[Index].ISCSITargetIpAddress,
+ sizeof (IfrNvData->Keyword[Index].ISCSITargetIpAddress) /
+ sizeof (IfrNvData->Keyword[Index].ISCSITargetIpAddress[0])
);
}
IScsiLunToUnicodeStr (SessionConfigData->BootLun, IfrNvData->Keyword[Index].ISCSILun);
IScsiConvertIsIdToString (IfrNvData->Keyword[Index].ISCSIIsId, SessionConfigData->IsId); @@ -738,13 +741,29 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
IfrNvData->Keyword[Index].ISCSIReverseChapSecret,
ISCSI_CHAP_SECRET_STORAGE
);
}
}
-
CopyMem(IfrNvData->ISCSIDisplayAttemptList, AttemptNameList, ATTEMPT_NAME_LIST_SIZE);
}
+
+ NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
+ NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
+ IScsiMacAddrToStr (
+ &NicInfo->PermanentAddress,
+ NicInfo->HwAddressSize,
+ NicInfo->VlanId,
+ MacString
+ );
+ CopyMem (
+ IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr),
+ MacString,
+ StrLen (MacString) * sizeof (CHAR16)
+ );
+
+ *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) = L'/';
+ }
}
/**
Convert the IFR data to iSCSI configuration data.
@@ -1193,10 +1212,12 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
)
{
ISCSI_ATTEMPT_CONFIG_NVDATA *Attempt;
UINT8 AttemptIndex;
UINT8 Index;
+ UINT8 ChapSecretLen;
+ UINT8 ReverseChapSecretLen;
CHAR16 *AttemptName1;
CHAR16 *AttemptName2;
ISCSI_ATTEMPT_CONFIG_NVDATA *SameNicAttempt;
CHAR8 LunString[ISCSI_LUN_STR_MAX_LEN];
CHAR8 IScsiName[ISCSI_NAME_MAX_SIZE];
@@ -1342,38 +1363,45 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
AttemptIndex = (UINT8) ((OffSet - ATTEMPT_CONNECT_RETRY_VAR_OFFSET) + 1);
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
if (Attempt == NULL) {
return EFI_INVALID_PARAMETER;
}
- Attempt->SessionConfigData.ConnectRetryCount = IfrNvData->ISCSIConnectRetry[AttemptIndex - 1];
- if (Attempt->SessionConfigData.ConnectRetryCount == 0) {
- Attempt->SessionConfigData.ConnectRetryCount = CONNECT_MIN_RETRY;
+
+ if (IfrNvData->ISCSIConnectRetry[AttemptIndex - 1] > CONNECT_MAX_RETRY) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"The minimum value is 0 and the maximum is 16. 0 means no retry.",
+ NULL
+ );
+ return EFI_INVALID_PARAMETER;
}
+ Attempt->SessionConfigData.ConnectRetryCount =
+ IfrNvData->ISCSIConnectRetry[AttemptIndex - 1];
} else if ((OffSet >= ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET)) {
AttemptIndex = (UINT8) ((OffSet - ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) / 2 + 1);
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
if (Attempt == NULL) {
return EFI_INVALID_PARAMETER;
}
+
+ if ((IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] < CONNECT_MIN_TIMEOUT) ||
+ (IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] > CONNECT_MAX_TIMEOUT)) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"The minimum value is 100 milliseconds and the maximum is 20 seconds.",
+ NULL
+ );
+ return EFI_INVALID_PARAMETER;
+ }
+
Attempt->SessionConfigData.ConnectTimeout = IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1];
if (Attempt->SessionConfigData.ConnectTimeout == 0) {
Attempt->SessionConfigData.ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
}
- if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (Attempt->SessionConfigData.ConnectTimeout < CONNECT_MIN_TIMEOUT) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"Connection Establishing Timeout is less than minimum value 100ms.",
- NULL
- );
- return EFI_INVALID_PARAMETER;
- }
- }
-
} else if ((OffSet >= ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET)) {
AttemptIndex = (UINT8) ((OffSet - ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) + 1);
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
if (Attempt == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1621,11 +1649,11 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
Attempt->AuthConfigData.CHAP.CHAPName,
ISCSI_CHAP_NAME_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->CHAPName[0] == L'\0') {
+ if (IfrNvData->Keyword[Index].ISCSIChapUsername[0] == L'\0')
+ {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
L"CHAP Name is invalid!",
NULL
@@ -1643,22 +1671,23 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
return EFI_INVALID_PARAMETER;
}
} else if ((OffSet >= ATTEMPT_CHAR_SECRET_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET)) {
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
+ ChapSecretLen = (UINT8)StrLen
+ (IfrNvData->Keyword[Index].ISCSIChapSecret);
UnicodeStrToAsciiStrS (
IfrNvData->Keyword[Index].ISCSIChapSecret,
Attempt->AuthConfigData.CHAP.CHAPSecret,
ISCSI_CHAP_SECRET_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->CHAPSecret[0] == L'\0') {
+ if ((ChapSecretLen < ISCSI_CHAP_SECRET_MIN_LEN) ||
+ (ChapSecretLen > ISCSI_CHAP_SECRET_MAX_LEN)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
- L"CHAP Secret is invalid!",
+ L"The Chap Secret minimum length is 12 bytes and the
+ maximum length is 16 bytes.",
NULL
);
return EFI_INVALID_PARAMETER;
}
}
@@ -1678,11 +1707,11 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
IfrNvData->Keyword[Index].ISCSIReverseChapUsername,
Attempt->AuthConfigData.CHAP.ReverseCHAPName,
ISCSI_CHAP_NAME_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->ReverseCHAPName[0] == L'\0') {
+ if (IfrNvData->Keyword[Index].ISCSIReverseChapUsername[0] ==
+ L'\0') {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
L"Reverse CHAP Name is invalid!",
NULL
@@ -1700,22 +1729,23 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
return EFI_INVALID_PARAMETER;
}
} else if (OffSet >= ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET) {
if (Attempt->AuthConfigData.CHAP.CHAPType == ISCSI_CHAP_MUTUAL) {
+ ReverseChapSecretLen = (UINT8)StrLen
+ (IfrNvData->Keyword[Index].ISCSIReverseChapSecret);
UnicodeStrToAsciiStrS (
IfrNvData->Keyword[Index].ISCSIReverseChapSecret,
Attempt->AuthConfigData.CHAP.ReverseCHAPSecret,
ISCSI_CHAP_SECRET_STORAGE
);
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
- if (IfrNvData->ReverseCHAPSecret[0] == L'\0') {
+ if ((ReverseChapSecretLen < ISCSI_CHAP_SECRET_MIN_LEN) ||
+ (ReverseChapSecretLen > ISCSI_CHAP_SECRET_MAX_LEN)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
- L"Reverse CHAP Secret is invalid!",
+ L"The Reverse CHAP Secret minimum length is 12 bytes and
+ the maximum length is 16 bytes.",
NULL
);
return EFI_INVALID_PARAMETER;
}
}
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-30 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-24 8:43 [patch] NetworkPkg: Fix some bugs related to iSCSI keyword configuration Zhang Lubo
2017-03-30 8:32 ` Ye, Ting
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox