From 75c6cfb4146812b78fc8b02a920b9a42b85c851f Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Fri, 28 Jan 2022 14:28:54 +0100 Subject: [PATCH] update(userpace/engine): properly implement semver check for required plugin versions. Signed-off-by: Federico Di Pierro --- userspace/engine/falco_engine.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index db021675..5ff90fa5 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -432,7 +432,7 @@ bool falco_engine::is_plugin_compatible(const std::string &name, const std::string &version, std::string &required_version) { - sinsp_plugin::version plugin_version(version.c_str()); + sinsp_plugin::version plugin_version(version); if(!plugin_version.m_valid) { @@ -447,13 +447,11 @@ bool falco_engine::is_plugin_compatible(const std::string &name, for(auto &rversion : m_required_plugin_versions[name]) { - sinsp_plugin::version req_version(rversion.c_str()); - if(req_version.m_version_major > plugin_version.m_version_major) + sinsp_plugin::version req_version(rversion); + if (!plugin_version.check(req_version)) { - required_version = rversion; return false; } - } return true;