diff options
-rw-r--r-- | include/vm_websocket.hpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp index 4d86c3e231..284b5d2e1c 100644 --- a/include/vm_websocket.hpp +++ b/include/vm_websocket.hpp @@ -421,6 +421,7 @@ inline void { if (ec) { + BMCWEB_LOG_ERROR("DBus getAllProperties error: {}", ec.message()); conn.close("Internal Error"); return; } @@ -433,6 +434,7 @@ inline void if (!success) { + BMCWEB_LOG_ERROR("Failed to unpack properties"); conn.close("Internal Error"); return; } @@ -462,14 +464,20 @@ inline void onOpen(crow::websocket::Connection& conn) { BMCWEB_LOG_DEBUG("nbd-proxy.onopen({})", logPtr(&conn)); - sdbusplus::message::object_path path( - "/xyz/openbmc_project/VirtualMedia/nbd"); + if (conn.url().segments().size() < 2) + { + BMCWEB_LOG_ERROR("Invalid path - \"{}\"", conn.url().path()); + conn.close("Internal error"); + return; + } - path /= std::to_string(0); + std::string index = conn.url().segments().back(); + std::string path = + std::format("/xyz/openbmc_project/VirtualMedia/Proxy/Slot_{}", index); sdbusplus::asio::getAllProperties( *crow::connections::systemBus, "xyz.openbmc_project.VirtualMedia", path, - "xyz.openbmc_project.VirtualMedia", + "xyz.openbmc_project.VirtualMedia.MountPoint", [&conn, path](const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& propertiesList) { afterGetSocket(conn, path, ec, propertiesList); |