summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlicja Rybak <alicja.rybak@intel.com>2021-04-13 19:30:50 +0300
committerAlicja Rybak <alicja.rybak@intel.com>2021-04-14 15:32:00 +0300
commit894132d3b0e7755907bbebba5c3425768ab1150f (patch)
treedbd15f1fe3bf6441e3868dcb16c5b97805fb17c8
parent2f40973e8168f4a7eba3d669560edb1ee61c3761 (diff)
downloadvirtual-media-894132d3b0e7755907bbebba5c3425768ab1150f.tar.xz
Invalid HTTP return codes in RemoteMedia in Legacy mode.
Invalid status code 500 when slot is inserted twice. Invalid status code 200 when slot is ejected twice. In both situation code 403 should be returned. Using [[noreturn]] attribute for handleEvent functions. Tested: Manually on hw and verified that status code is 403. Change-Id: I886c41048d6bcfcb3d47b46fd23a2de564d9dd3e Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
-rw-r--r--src/state/active_state.hpp6
-rw-r--r--src/state/ready_state.hpp6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/state/active_state.hpp b/src/state/active_state.hpp
index 766c105..a2a8653 100644
--- a/src/state/active_state.hpp
+++ b/src/state/active_state.hpp
@@ -83,6 +83,12 @@ struct ActiveState : public BasicStateT<ActiveState>
std::move(gadget));
}
+ [[noreturn]] std::unique_ptr<BasicState> handleEvent(MountEvent event)
+ {
+ LogMsg(Logger::Error, "InvalidĀ event: ", event.eventName);
+ throw sdbusplus::exception::SdBusError(EPERM, "Operation not permitted in active state");
+ }
+
template <class AnyEvent>
[[noreturn]] std::unique_ptr<BasicState> handleEvent(AnyEvent event)
{
diff --git a/src/state/ready_state.hpp b/src/state/ready_state.hpp
index 5edfa06..2243143 100644
--- a/src/state/ready_state.hpp
+++ b/src/state/ready_state.hpp
@@ -47,6 +47,12 @@ struct ReadyState : public BasicStateT<ReadyState>
return std::make_unique<ActivatingState>(machine);
}
+ [[noreturn]] std::unique_ptr<BasicState> handleEvent(UnmountEvent event)
+ {
+ LogMsg(Logger::Error, "InvalidĀ event: ", event.eventName);
+ throw sdbusplus::exception::SdBusError(EPERM, "Operation not permitted in ready state");
+ }
+
template <class AnyEvent>
std::unique_ptr<BasicState> handleEvent(AnyEvent event)
{