public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: Karunakar P <karunakarp@amiindia.co.in>,
	"Ye, Ting" <ting.ye@intel.com>,
	"Fu, Siyuan" <siyuan.fu@intel.com>,
	"'edk2-devel@lists.01.org'" <edk2-devel@lists.01.org>
Subject: Re: AsciiPrint() in HttpBootDxe Corrupting the Setup screen
Date: Sat, 20 Jan 2018 06:37:11 +0000	[thread overview]
Message-ID: <895558F6EA4E3B41AC93A00D163B72741635E5C1@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <A885E3F3F1F22B44AF7CC779C062228E012158B7BB@Venus2.in.megatrends.com>

Hi Karunakar,

You should sent out the attached patches for the review:).

Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>

Thanks,
Jiaxin


From: Karunakar P [mailto:karunakarp@amiindia.co.in]
Sent: Wednesday, January 17, 2018 6:29 PM
To: Wu, Jiaxin <jiaxin.wu@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; 'edk2-devel@lists.01.org' <edk2-devel@lists.01.org>
Subject: RE: AsciiPrint() in HttpBootDxe Corrupting the Setup screen

[Patch] NetworkPkg\HttpBootDxe: AsciiPrint() in HttpBootDxe Corrupting the Setup screen

NetworkPkg\HttpBootDxe\HttpBootSupport.c | 2 ----
NetworkPkg\HttpBootDxe\HttpBootClient.c|  10 ++++
2 files changed, 10 insertions(+), 2 deletions(-)

NetworkPkg\HttpBootDxe\HttpBootSupport.c
NetworkPkg\HttpBootDxe\HttpBootClient.c

EFI_STATUS
HttpBootCheckUriScheme (
  IN      CHAR8                  *Uri
  )
{
  UINTN                Index;
  EFI_STATUS           Status;.
.
.
  //
  // Return EFI_INVALID_PARAMETER if the URI is not HTTP or HTTPS.
  //
  if ((AsciiStrnCmp (Uri, "http://", 7) != 0) && (AsciiStrnCmp (Uri, "https://", 8) != 0)) {
-    AsciiPrint ("\n  Error: Invalid URI address.\n");
    DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: Invalid Uri.\n"));
    return EFI_INVALID_PARAMETER;
  }

  //
  // HTTP is disabled, return EFI_ACCESS_DENIED if the URI is HTTP.
  //
  if (!PcdGetBool (PcdAllowHttpConnections) && (AsciiStrnCmp (Uri, "http://", 7) == 0)) {
-    AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");
    DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: HTTP is disabled.\n"));
    return EFI_ACCESS_DENIED;
  }
.
.
.
}


EFI_STATUS
HttpBootDhcp4ExtractUriInfo (
  IN     HTTP_BOOT_PRIVATE_DATA   *Private
  )
{
  HTTP_BOOT_DHCP4_PACKET_CACHE    *SelectOffer;
  HTTP_BOOT_DHCP4_PACKET_CACHE    *HttpOffer;
  UINT32                          SelectIndex;.
.
.
.
//
  // Check the URI scheme.
  //
  Status = HttpBootCheckUriScheme (Private->BootFileUri);
  if (EFI_ERROR (Status)) {
    DEBUG ((EFI_D_ERROR, "HttpBootDhcp4ExtractUriInfo: %r.\n", Status));
+    if (Status == EFI_INVALID_PARAMETER) {
+        AsciiPrint ("\n  Error: Invalid URI address.\n");
+   } else if (Status == EFI_ACCESS_DENIED) {
+        AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");
+   }
    return Status;
  }
.
.
.
}


EFI_STATUS
HttpBootDhcp6ExtractUriInfo (
  IN     HTTP_BOOT_PRIVATE_DATA   *Private
  )
{
  HTTP_BOOT_DHCP6_PACKET_CACHE    *SelectOffer;
  HTTP_BOOT_DHCP6_PACKET_CACHE    *HttpOffer;
  UINT32                          SelectIndex;
.
.
.
Status = HttpBootCheckUriScheme (Private->BootFileUri);
  if (EFI_ERROR (Status)) {
    DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status));
+    if (Status == EFI_INVALID_PARAMETER) {
+        AsciiPrint ("\n  Error: Invalid URI address.\n");
+    } else if (Status == EFI_ACCESS_DENIED) {
+       AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");
+   }
    return Status;
  }
.
.
.
}

Please review the patch.

Thanks,
Karunakar


From: Karunakar P
Sent: Wednesday, January 17, 2018 2:44 PM
To: 'Wu, Jiaxin'; Ye, Ting; Fu, Siyuan; 'edk2-devel@lists.01.org'
Subject: RE: AsciiPrint() in HttpBootDxe Corrupting the Setup screen

Hi Jiaxin,

We'll send the formal patch for review and also could you please let me know if you want to fill a bug in Bugzilla if needed.

Thank You,
Karunakar

From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com]
Sent: Thursday, January 11, 2018 6:21 AM
To: Karunakar P; Ye, Ting; Fu, Siyuan
Subject: RE: AsciiPrint() in HttpBootDxe Corrupting the Setup screen

Hi Karunakar,

I agree the fix, can you send out the formal patch for the review or need us to follow that?

Thanks,
Jiaxin

From: Karunakar P [mailto:karunakarp@amiindia.co.in]
Sent: Wednesday, January 10, 2018 4:48 PM
To: Wu, Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>>; Ye, Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>>; Fu, Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>>
Subject: AsciiPrint() in HttpBootDxe Corrupting the Setup screen

Hello All,

[Issue]

1.       On giving Invalid URI in Boot URI field in "HTTP Boot Configuration" Page, doing AsciiPrint() in TSE corrupting the Screen.

AsciiPrint ("\n  Error: Invalid URI address.\n");



2.       When HTTP connection are disabled using "PcdAllowHttpConnections"

On giving http URI in Boot URI field in "HTTP Boot Configuration" Page, doing AsciiPrint() in TSE corrupting the Screen.

AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is allowed.\n");


[Fix]

1.       I guess We've added this AsciiPrint() because HttpBootCheckUriScheme() is common for both generic HTTP boot over IPv4/6 and "Http Boot Configuration" page

2.       In case of "Http Boot Configuration",  AsciiPrint() may not be needed in HttpBootCheckUriScheme because we're already using CreatePopUp() in case of Error Status

CreatePopUp (

          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

          &Key,

          L"ERROR: Unsupported URI!",

          L"Only supports HTTP and HTTPS",

          NULL

          );

   (Or)

CreatePopUp (

          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

          &Key,

          L"ERROR: Unsupported URI!",

          L"HTTP is disabled",

          NULL

          );

3.       When we do Http Boot over IPv4/6, from HttpBootCheckUriScheme() there is chance to get return status as EFI_INVALID_PARAMETER or EFI_ACCESS_DENIED

4.       In this case we can have AsciiPrint() based on return Status, instead of doing in HttpBootCheckUriScheme()

I've attached the suggested changes, could you please review and provide your comments/Suggestions.

Thanks,
Karunakar


  reply	other threads:[~2018-01-20  6:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A885E3F3F1F22B44AF7CC779C062228E012158A68A@Venus2.in.megatrends.com>
     [not found] ` <895558F6EA4E3B41AC93A00D163B72741635BF8D@SHSMSX103.ccr.corp.intel.com>
2018-01-17  9:13   ` AsciiPrint() in HttpBootDxe Corrupting the Setup screen Karunakar P
2018-01-17 10:28     ` Karunakar P
2018-01-20  6:37       ` Wu, Jiaxin [this message]
2018-01-22  0:53       ` Wu, Jiaxin
2018-01-22 10:01         ` Karunakar P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=895558F6EA4E3B41AC93A00D163B72741635E5C1@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox