0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 01:59:33 +02:00

ircd::mods: Add conf item to bypass mapi check on load.

This commit is contained in:
Jason Volk 2022-07-26 20:09:03 -07:00
parent 60c00dba29
commit 9f22edf3a4

View file

@ -19,6 +19,8 @@ namespace ircd::mods
static void handle_ebadf(const string_view &what);
static void handle_stuck(mod &);
static bool unload(mod &) noexcept;
extern conf::item<bool> mapi_check;
}
ircd::log::log
@ -43,6 +45,13 @@ ircd::mods::autoload
{ "persist", false },
};
decltype(ircd::mods::mapi_check)
ircd::mods::mapi_check
{
{ "name", "ircd.mods.mapi.check" },
{ "default", true },
};
decltype(ircd::mods::mod::loading)
ircd::mods::mod::loading;
@ -298,19 +307,19 @@ try
"Unexpected null header"
};
if(header->magic != IRCD_MAPI_MAGIC)
if(mapi_check && header->magic != IRCD_MAPI_MAGIC)
throw error
{
"Bad magic [%04X] need: [%04X]", header->magic, IRCD_MAPI_MAGIC
};
if(header->version != IRCD_MAPI_VERSION)
if(mapi_check && header->version != IRCD_MAPI_VERSION)
throw error
{
"Unknown MAPI version [%u] expecting: [%u]", header->version, IRCD_MAPI_VERSION
};
if(header->serial < IRCD_MAPI_SERIAL)
if(mapi_check && header->serial < IRCD_MAPI_SERIAL)
throw error
{
"Module '%s' serial=%u is expired; expecting serial >= %u. This module was probably removed"