diff options
author | Nan Zhou <nanzhoumails@gmail.com> | 2022-02-25 05:21:07 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-02-28 20:56:53 +0300 |
commit | 93c0202ad93c4bace9c8c79286a788300c86d08e (patch) | |
tree | 912200d8381e2caba84526da83c5e74eb3d1353d /http/routing.hpp | |
parent | 2b20ef6ee2a8ca656aaa49b181d9205e30ede451 (diff) | |
download | bmcweb-93c0202ad93c4bace9c8c79286a788300c86d08e.tar.xz |
websocket: fix authless
We should check if session is nullptr before referencing its data
member.
Tested:
1. build authless BMCWeb
```
meson -Drest=enabled -Dbmcweb-logging=enabled
-Dinsecure-disable-auth=enabled build && ninja -C build &&
./build/bmcweb
```
2. start websocket client without problems
```
python scripts/websocket_test.py --host localhost:18080
```
3. bmcweb log
```
[DEBUG "websocket.hpp":221] Websocket accepted connection
[DEBUG "dbus_monitor.hpp":114] Connection opened
[DEBUG "dbus_monitor.hpp":115] Connection 0x55b22d618670 opened
[DEBUG "http_response.hpp":134] 0x55b22d611040 calling completion
handler
[DEBUG "dbus_monitor.hpp":129] Connection 0x55b22d618670 received
{"paths": ["/xyz/openbmc_project/sensors"],
"interfaces": ["xyz.openbmc_project.Sensor.Value"]}
[DEBUG "dbus_monitor.hpp":231] Creating match
type='signal',interface='org.freedesktop.DBus.Properties',
path_namespace='/xyz/openbmc_project/sensors',member='PropertiesChanged',
arg0='xyz.openbmc_project.Sensor.Value'
[DEBUG "dbus_monitor.hpp":246] Creating match
type='signal',interface='org.freedesktop.DBus.ObjectManager',
path_namespace='/xyz/openbmc_project/sensors',member='InterfacesAdded'
```
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I56613a26c129736f0e6980bb24e83f22ef60eea0
Diffstat (limited to 'http/routing.hpp')
-rw-r--r-- | http/routing.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/http/routing.hpp b/http/routing.hpp index e39bfcc9eb..b39442bd3a 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -343,6 +343,7 @@ class WebSocketRule : public BaseRule void handleUpgrade(const Request& req, Response& /*res*/, boost::asio::ip::tcp::socket&& adaptor) override { + BMCWEB_LOG_DEBUG << "Websocket handles upgrade"; std::shared_ptr< crow::websocket::ConnectionImpl<boost::asio::ip::tcp::socket>> myConnection = std::make_shared< @@ -356,6 +357,7 @@ class WebSocketRule : public BaseRule boost::beast::ssl_stream<boost::asio::ip::tcp::socket>&& adaptor) override { + BMCWEB_LOG_DEBUG << "Websocket handles upgrade"; std::shared_ptr<crow::websocket::ConnectionImpl< boost::beast::ssl_stream<boost::asio::ip::tcp::socket>>> myConnection = std::make_shared<crow::websocket::ConnectionImpl< |