summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0009-virtual_media-Fix-for-bmcweb-crash.patch
blob: a2a120c22797f7df9df135f05379cf5de569a7e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 348186f045f23d59405ac0011e983aea8334598a Mon Sep 17 00:00:00 2001
From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Date: Thu, 4 May 2023 13:56:27 +0000
Subject: [PATCH] virtual_media: Fix for bmcweb crash

This is ported from main line.
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/62593

bmcweb crashes when user not providing userName or password while
posting ISO form Redfish.

This fix provides to avoid bmcweb crash when user try to post ISO images
from Redfish without providing username or password.

Tested:
Redfish validator passed with this change.
Verified by Posting ISO from Redfish.

Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
---
 redfish-core/lib/virtual_media.hpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 6dfc726b..838a08b1 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -1069,6 +1069,16 @@ inline void requestNBDVirtualMediaRoutes(App& app)
                             return true;
                         }
 
+                        if (!actionParams.userName)
+                        {
+                            actionParams.userName = "";
+                        }
+
+                        if (!actionParams.password)
+                        {
+                            actionParams.password = "";
+                        }
+
                         // manager is irrelevant for
                         // VirtualMedia dbus calls
                         doMountVmLegacy(asyncResp, service, resName,
-- 
2.17.1