decline master session if SAM version is less than 3.3
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions

This commit is contained in:
orignal 2025-08-14 15:58:42 -04:00
parent 7dd174d32c
commit 83f9e1098d
2 changed files with 20 additions and 1 deletions

View file

@ -373,7 +373,15 @@ namespace client
} }
} }
else if (style == SAM_VALUE_RAW) type = SAMSessionType::eSAMSessionTypeRaw; else if (style == SAM_VALUE_RAW) type = SAMSessionType::eSAMSessionTypeRaw;
else if (style == SAM_VALUE_MASTER) type = SAMSessionType::eSAMSessionTypeMaster; else if (style == SAM_VALUE_MASTER)
{
if (m_Version < SAM_VERSION_33) // < SAM 3.3
{
SendSessionI2PError("MASTER session is not supported");
return;
}
type = SAMSessionType::eSAMSessionTypeMaster;
}
if (type == SAMSessionType::eSAMSessionTypeUnknown) if (type == SAMSessionType::eSAMSessionTypeUnknown)
{ {
// unknown style // unknown style
@ -868,6 +876,11 @@ namespace client
void SAMSocket::ProcessSessionAdd (std::string_view buf) void SAMSocket::ProcessSessionAdd (std::string_view buf)
{ {
if (m_Version < SAM_VERSION_33) // < SAM 3.3
{
SendSessionI2PError("SESSION ADD is not supported");
return;
}
auto session = m_Owner.FindSession(m_ID); auto session = m_Owner.FindSession(m_ID);
if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster) if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster)
{ {
@ -918,6 +931,11 @@ namespace client
void SAMSocket::ProcessSessionRemove (std::string_view buf) void SAMSocket::ProcessSessionRemove (std::string_view buf)
{ {
if (m_Version < SAM_VERSION_33) // < SAM 3.3
{
SendSessionI2PError("SESSION REMOVE is not supported");
return;
}
auto session = m_Owner.FindSession(m_ID); auto session = m_Owner.FindSession(m_ID);
if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster) if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster)
{ {

View file

@ -94,6 +94,7 @@ namespace client
constexpr int MAKE_SAM_VERSION_NUMBER (int major, int minor) { return major*10 + minor; } constexpr int MAKE_SAM_VERSION_NUMBER (int major, int minor) { return major*10 + minor; }
constexpr int MIN_SAM_VERSION = MAKE_SAM_VERSION_NUMBER (3, 0); constexpr int MIN_SAM_VERSION = MAKE_SAM_VERSION_NUMBER (3, 0);
constexpr int MAX_SAM_VERSION = MAKE_SAM_VERSION_NUMBER (3, 3); constexpr int MAX_SAM_VERSION = MAKE_SAM_VERSION_NUMBER (3, 3);
constexpr int SAM_VERSION_33 = MAKE_SAM_VERSION_NUMBER (3, 3); // SAM 3.3
enum class SAMSocketType enum class SAMSocketType
{ {