From b70ab318683300f1776f603e5126f00c36f746fc Mon Sep 17 00:00:00 2001 From: Dorian Eikenberg Date: Wed, 28 Feb 2024 11:12:58 +0100 Subject: [PATCH] Require yara 4.2 --- plugins/inmemoryscanner/src/lib/CMakeLists.txt | 6 +----- plugins/inmemoryscanner/src/lib/YaraInterface.cpp | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/plugins/inmemoryscanner/src/lib/CMakeLists.txt b/plugins/inmemoryscanner/src/lib/CMakeLists.txt index 390d21c1..b2d51202 100644 --- a/plugins/inmemoryscanner/src/lib/CMakeLists.txt +++ b/plugins/inmemoryscanner/src/lib/CMakeLists.txt @@ -14,13 +14,9 @@ target_include_directories(inmemoryscanner-obj INTERFACE $=4) +pkg_check_modules(YARA REQUIRED yara>=4.2) target_link_libraries(inmemoryscanner-obj PUBLIC ${YARA_LINK_LIBRARIES}) -if (${YARA_VERSION} VERSION_GREATER_EQUAL 4.1) - target_compile_definitions(inmemoryscanner-obj PRIVATE LIBYARA_4_1) -endif () - pkg_check_modules(TCLAP REQUIRED tclap>=1.2) include(FetchContent) diff --git a/plugins/inmemoryscanner/src/lib/YaraInterface.cpp b/plugins/inmemoryscanner/src/lib/YaraInterface.cpp index 05299e6c..70403eac 100644 --- a/plugins/inmemoryscanner/src/lib/YaraInterface.cpp +++ b/plugins/inmemoryscanner/src/lib/YaraInterface.cpp @@ -77,16 +77,12 @@ namespace InMemoryScanner mappedRegion.mappingBase, &fetch_block_data); } -#ifdef LIBYARA_4_1 + YR_MEMORY_BLOCK_ITERATOR iterator{.context = &iteratorContext, .first = &get_first_block, .next = &get_next_block, .file_size = nullptr, .last_error = ERROR_SUCCESS}; -#else - YR_MEMORY_BLOCK_ITERATOR iterator{ - .context = &iteratorContext, .first = &get_first_block, .next = &get_next_block}; -#endif if (auto err = yr_rules_scan_mem_blocks(rules, &iterator,