From f0759c90e869483dec7d99143b2196d507f01c80 Mon Sep 17 00:00:00 2001 From: Alessandro Gario Date: Sat, 23 Nov 2019 14:12:37 +0100 Subject: [PATCH 01/26] CMake: Add the system layer --- CMakeLists.txt | 1 - cmake/flags.cmake | 14 ++- cmake/options.cmake | 8 +- libraries/CMakeLists.txt | 2 +- .../cmake/system/modules/Findaugeas.cmake | 17 ++++ .../system/modules/Findaws-sdk-cpp.cmake | 7 ++ .../system/modules/Findberkeley-db.cmake | 15 ++++ .../cmake/system/modules/Findboost.cmake | 21 +++++ .../cmake/system/modules/Findbzip2.cmake | 15 ++++ .../cmake/system/modules/Findgflags.cmake | 15 ++++ .../cmake/system/modules/Findglibc.cmake | 10 +++ libraries/cmake/system/modules/Findglog.cmake | 15 ++++ .../cmake/system/modules/Findgoogletest.cmake | 17 ++++ .../cmake/system/modules/Findjinja2.cmake | 10 +++ .../cmake/system/modules/Findlibarchive.cmake | 15 ++++ .../cmake/system/modules/Findlibaudit.cmake | 15 ++++ .../system/modules/Findlibcryptsetup.cmake | 15 ++++ .../system/modules/Findlibdevmapper.cmake | 7 ++ .../cmake/system/modules/Findlibdpkg.cmake | 7 ++ .../cmake/system/modules/Findlibelfin.cmake | 7 ++ .../cmake/system/modules/Findlibgcrypt.cmake | 15 ++++ .../system/modules/Findlibgpg-error.cmake | 15 ++++ .../system/modules/Findlibiptables.cmake | 15 ++++ .../cmake/system/modules/Findlibmagic.cmake | 15 ++++ .../cmake/system/modules/Findlibrdkafka.cmake | 7 ++ .../cmake/system/modules/Findlibrpm.cmake | 15 ++++ .../cmake/system/modules/Findlibudev.cmake | 7 ++ .../cmake/system/modules/Findlibxml2.cmake | 16 ++++ .../system/modules/Findlinenoise-ng.cmake | 7 ++ .../cmake/system/modules/Findlldpd.cmake | 15 ++++ libraries/cmake/system/modules/Findlzma.cmake | 15 ++++ .../cmake/system/modules/Findmarkupsafe.cmake | 10 +++ .../cmake/system/modules/Findopenssl.cmake | 15 ++++ libraries/cmake/system/modules/Findpopt.cmake | 15 ++++ .../cmake/system/modules/Findrapidjson.cmake | 14 +++ .../cmake/system/modules/Findrocksdb.cmake | 7 ++ .../cmake/system/modules/Findsleuthkit.cmake | 15 ++++ .../system/modules/Findsmartmontools.cmake | 7 ++ .../cmake/system/modules/Findsqlite.cmake | 15 ++++ .../cmake/system/modules/Findssdeep-cpp.cmake | 7 ++ .../cmake/system/modules/Findssdeep.cmake | 15 ++++ .../cmake/system/modules/Findthrift.cmake.bak | 16 ++++ .../cmake/system/modules/Findutil-linux.cmake | 15 ++++ libraries/cmake/system/modules/Findyara.cmake | 15 ++++ libraries/cmake/system/modules/Findzlib.cmake | 15 ++++ libraries/cmake/system/modules/Findzstd.cmake | 15 ++++ libraries/cmake/system/modules/api.cmake | 89 +++++++++++++++++++ osquery/utils/system/linux/ebpf/program.cpp | 17 ++-- osquery/utils/system/linux/ebpf/program.h | 2 + 49 files changed, 658 insertions(+), 21 deletions(-) create mode 100644 libraries/cmake/system/modules/Findaugeas.cmake create mode 100644 libraries/cmake/system/modules/Findaws-sdk-cpp.cmake create mode 100644 libraries/cmake/system/modules/Findberkeley-db.cmake create mode 100644 libraries/cmake/system/modules/Findboost.cmake create mode 100644 libraries/cmake/system/modules/Findbzip2.cmake create mode 100644 libraries/cmake/system/modules/Findgflags.cmake create mode 100644 libraries/cmake/system/modules/Findglibc.cmake create mode 100644 libraries/cmake/system/modules/Findglog.cmake create mode 100644 libraries/cmake/system/modules/Findgoogletest.cmake create mode 100644 libraries/cmake/system/modules/Findjinja2.cmake create mode 100644 libraries/cmake/system/modules/Findlibarchive.cmake create mode 100644 libraries/cmake/system/modules/Findlibaudit.cmake create mode 100644 libraries/cmake/system/modules/Findlibcryptsetup.cmake create mode 100644 libraries/cmake/system/modules/Findlibdevmapper.cmake create mode 100644 libraries/cmake/system/modules/Findlibdpkg.cmake create mode 100644 libraries/cmake/system/modules/Findlibelfin.cmake create mode 100644 libraries/cmake/system/modules/Findlibgcrypt.cmake create mode 100644 libraries/cmake/system/modules/Findlibgpg-error.cmake create mode 100644 libraries/cmake/system/modules/Findlibiptables.cmake create mode 100644 libraries/cmake/system/modules/Findlibmagic.cmake create mode 100644 libraries/cmake/system/modules/Findlibrdkafka.cmake create mode 100644 libraries/cmake/system/modules/Findlibrpm.cmake create mode 100644 libraries/cmake/system/modules/Findlibudev.cmake create mode 100644 libraries/cmake/system/modules/Findlibxml2.cmake create mode 100644 libraries/cmake/system/modules/Findlinenoise-ng.cmake create mode 100644 libraries/cmake/system/modules/Findlldpd.cmake create mode 100644 libraries/cmake/system/modules/Findlzma.cmake create mode 100644 libraries/cmake/system/modules/Findmarkupsafe.cmake create mode 100644 libraries/cmake/system/modules/Findopenssl.cmake create mode 100644 libraries/cmake/system/modules/Findpopt.cmake create mode 100644 libraries/cmake/system/modules/Findrapidjson.cmake create mode 100644 libraries/cmake/system/modules/Findrocksdb.cmake create mode 100644 libraries/cmake/system/modules/Findsleuthkit.cmake create mode 100644 libraries/cmake/system/modules/Findsmartmontools.cmake create mode 100644 libraries/cmake/system/modules/Findsqlite.cmake create mode 100644 libraries/cmake/system/modules/Findssdeep-cpp.cmake create mode 100644 libraries/cmake/system/modules/Findssdeep.cmake create mode 100644 libraries/cmake/system/modules/Findthrift.cmake.bak create mode 100644 libraries/cmake/system/modules/Findutil-linux.cmake create mode 100644 libraries/cmake/system/modules/Findyara.cmake create mode 100644 libraries/cmake/system/modules/Findzlib.cmake create mode 100644 libraries/cmake/system/modules/Findzstd.cmake create mode 100644 libraries/cmake/system/modules/api.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8232062..1339c6f02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ include(cmake/utilities.cmake) include(cmake/toolchain.cmake) project(osquery) - if(OSQUERY_BUILD_TESTS) enable_testing() endif() diff --git a/cmake/flags.cmake b/cmake/flags.cmake index e28bdec81..ffc0e0539 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -33,10 +33,10 @@ function(setupBuildFlags) if(DEFINED PLATFORM_POSIX) set(posix_common_compile_options - -Qunused-arguments + #-Qunused-arguments -Wno-shadow-field - -Wall - -Wextra + #-Wall + #-Wextra -Wno-unused-local-typedef -Wno-deprecated-register -Wno-unknown-warning-option @@ -57,13 +57,13 @@ function(setupBuildFlags) -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden - -fno-limit-debug-info + #-fno-limit-debug-info -pipe -pedantic ) if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - list(APPEND posix_common_compile_options INTERFACE -Oz) + list(APPEND posix_common_compile_options INTERFACE -O2) endif() set(osquery_posix_common_defines @@ -122,13 +122,12 @@ function(setupBuildFlags) ) set(linux_cxx_link_options - --no-undefined + #--no-undefined -lresolv -pthread ) set(linux_cxx_link_libraries - c++abi rt dl ) @@ -163,7 +162,6 @@ function(setupBuildFlags) cups bsm xar - c++abi "-framework AppKit" "-framework Foundation" "-framework CoreServices" diff --git a/cmake/options.cmake b/cmake/options.cmake index ddf4a649d..3e6d4a32f 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -85,7 +85,13 @@ option(OSQUERY_IGNORE_CMAKE_MAX_VERSION_CHECK "Ignore the maximum cmake version # Unfortunately, due glog always enabling BUILD_TESTING, we have to force it off, so that tests won't be built overwrite_cache_variable("BUILD_TESTING" "BOOL" "OFF") -set(third_party_source_list "source;formula") +# Linux can use source and formula modules to link dependencies; this +# feature is not yet available on Windows and macOS +if(DEFINED PLATFORM_LINUX) + set(third_party_source_list "system;source") +else() + set(third_party_source_list "source_migration;facebook") +endif() set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" CACHE STRING "A list of paths containing CMake module files") set(OSQUERY_THIRD_PARTY_SOURCE "${third_party_source_list}" CACHE STRING "Sources used to acquire third-party dependencies") diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index e31f181c1..01b74d931 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -32,7 +32,7 @@ function(librariesMain) if(DEFINED PLATFORM_POSIX) set(compile_options - -Oz + -O2 -g0 ) endif() diff --git a/libraries/cmake/system/modules/Findaugeas.cmake b/libraries/cmake/system/modules/Findaugeas.cmake new file mode 100644 index 000000000..259df793c --- /dev/null +++ b/libraries/cmake/system/modules/Findaugeas.cmake @@ -0,0 +1,17 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME augeas + REQUIRED ${augeas_REQUIRED} + MAIN_HEADER "augeas.h" + LIBRARIES "augeas" "fa" +) + +target_link_libraries(augeas INTERFACE libxml2) \ No newline at end of file diff --git a/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake b/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake new file mode 100644 index 000000000..aa85e7fc4 --- /dev/null +++ b/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findaws-sdk-cpp.cmake") diff --git a/libraries/cmake/system/modules/Findberkeley-db.cmake b/libraries/cmake/system/modules/Findberkeley-db.cmake new file mode 100644 index 000000000..30b24f4fa --- /dev/null +++ b/libraries/cmake/system/modules/Findberkeley-db.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME berkeley-db + REQUIRED ${berkeley-db_REQUIRED} + MAIN_HEADER "db.h" + LIBRARIES "db" "db_cxx" "db_stl" +) diff --git a/libraries/cmake/system/modules/Findboost.cmake b/libraries/cmake/system/modules/Findboost.cmake new file mode 100644 index 000000000..501619897 --- /dev/null +++ b/libraries/cmake/system/modules/Findboost.cmake @@ -0,0 +1,21 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME boost + REQUIRED ${boost_REQUIRED} + MAIN_HEADER "boost/any.hpp" + LIBRARIES + "boost_system" + "boost_regex" + "boost_filesystem" + "boost_thread" + "boost_context" + "boost_chrono" +) diff --git a/libraries/cmake/system/modules/Findbzip2.cmake b/libraries/cmake/system/modules/Findbzip2.cmake new file mode 100644 index 000000000..22ee87d0c --- /dev/null +++ b/libraries/cmake/system/modules/Findbzip2.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME bzip2 + REQUIRED ${bzip2_REQUIRED} + MAIN_HEADER "bzlib.h" + LIBRARIES "bz2" +) diff --git a/libraries/cmake/system/modules/Findgflags.cmake b/libraries/cmake/system/modules/Findgflags.cmake new file mode 100644 index 000000000..b8985a84c --- /dev/null +++ b/libraries/cmake/system/modules/Findgflags.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME gflags + REQUIRED ${gflags_REQUIRED} + MAIN_HEADER "gflags/gflags.h" + LIBRARIES "gflags" +) diff --git a/libraries/cmake/system/modules/Findglibc.cmake b/libraries/cmake/system/modules/Findglibc.cmake new file mode 100644 index 000000000..9a9ba5300 --- /dev/null +++ b/libraries/cmake/system/modules/Findglibc.cmake @@ -0,0 +1,10 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/facebook/modules/api.cmake") +add_subdirectory("${CMAKE_SOURCE_DIR}/libraries/cmake/facebook/glibc") diff --git a/libraries/cmake/system/modules/Findglog.cmake b/libraries/cmake/system/modules/Findglog.cmake new file mode 100644 index 000000000..6904c845a --- /dev/null +++ b/libraries/cmake/system/modules/Findglog.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME glog + REQUIRED ${glog_REQUIRED} + MAIN_HEADER "glog/logging.h" + LIBRARIES "glog" +) diff --git a/libraries/cmake/system/modules/Findgoogletest.cmake b/libraries/cmake/system/modules/Findgoogletest.cmake new file mode 100644 index 000000000..2ce20e473 --- /dev/null +++ b/libraries/cmake/system/modules/Findgoogletest.cmake @@ -0,0 +1,17 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME googletest + REQUIRED ${gtest_REQUIRED} + MAIN_HEADER "gtest/gtest.h" + LIBRARIES "gtest" +) + +add_library(thirdparty_googletest_headers INTERFACE) diff --git a/libraries/cmake/system/modules/Findjinja2.cmake b/libraries/cmake/system/modules/Findjinja2.cmake new file mode 100644 index 000000000..bc6e196a5 --- /dev/null +++ b/libraries/cmake/system/modules/Findjinja2.cmake @@ -0,0 +1,10 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/facebook/modules/api.cmake") +add_subdirectory("${CMAKE_SOURCE_DIR}/libraries/cmake/facebook/jinja2") diff --git a/libraries/cmake/system/modules/Findlibarchive.cmake b/libraries/cmake/system/modules/Findlibarchive.cmake new file mode 100644 index 000000000..b3542cd4a --- /dev/null +++ b/libraries/cmake/system/modules/Findlibarchive.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libarchive + REQUIRED ${libarchive_REQUIRED} + MAIN_HEADER "archive.h" + LIBRARIES "archive" +) diff --git a/libraries/cmake/system/modules/Findlibaudit.cmake b/libraries/cmake/system/modules/Findlibaudit.cmake new file mode 100644 index 000000000..261f64033 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibaudit.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libaudit + REQUIRED ${libaudit_REQUIRED} + MAIN_HEADER "libaudit.h" + LIBRARIES "audit" "auparse" +) diff --git a/libraries/cmake/system/modules/Findlibcryptsetup.cmake b/libraries/cmake/system/modules/Findlibcryptsetup.cmake new file mode 100644 index 000000000..094df32ee --- /dev/null +++ b/libraries/cmake/system/modules/Findlibcryptsetup.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libcryptsetup + REQUIRED ${libcryptsetup_REQUIRED} + MAIN_HEADER "libcryptsetup.h" + LIBRARIES "cryptsetup" +) diff --git a/libraries/cmake/system/modules/Findlibdevmapper.cmake b/libraries/cmake/system/modules/Findlibdevmapper.cmake new file mode 100644 index 000000000..34eb11995 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibdevmapper.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibdevmapper.cmake") diff --git a/libraries/cmake/system/modules/Findlibdpkg.cmake b/libraries/cmake/system/modules/Findlibdpkg.cmake new file mode 100644 index 000000000..5d601b809 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibdpkg.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibdpkg.cmake") diff --git a/libraries/cmake/system/modules/Findlibelfin.cmake b/libraries/cmake/system/modules/Findlibelfin.cmake new file mode 100644 index 000000000..ce5da17f7 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibelfin.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibelfin.cmake") diff --git a/libraries/cmake/system/modules/Findlibgcrypt.cmake b/libraries/cmake/system/modules/Findlibgcrypt.cmake new file mode 100644 index 000000000..b11afb831 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibgcrypt.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libgcrypt + REQUIRED ${libgcrypt_REQUIRED} + MAIN_HEADER "gcrypt.h" + LIBRARIES "gcrypt" +) diff --git a/libraries/cmake/system/modules/Findlibgpg-error.cmake b/libraries/cmake/system/modules/Findlibgpg-error.cmake new file mode 100644 index 000000000..7ff498397 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibgpg-error.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libgpg-error + REQUIRED ${libgpg-error_REQUIRED} + MAIN_HEADER "gpg-error.h" + LIBRARIES "gpg-error" +) diff --git a/libraries/cmake/system/modules/Findlibiptables.cmake b/libraries/cmake/system/modules/Findlibiptables.cmake new file mode 100644 index 000000000..17cf4047d --- /dev/null +++ b/libraries/cmake/system/modules/Findlibiptables.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libiptables + REQUIRED ${libiptables_REQUIRED} + MAIN_HEADER "libipq.h" + LIBRARIES "ip4tc" "ip6tc" "ipq" "iptc" +) diff --git a/libraries/cmake/system/modules/Findlibmagic.cmake b/libraries/cmake/system/modules/Findlibmagic.cmake new file mode 100644 index 000000000..70a6af447 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibmagic.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libmagic + REQUIRED ${libmagic_REQUIRED} + MAIN_HEADER "magic.h" + LIBRARIES "magic" +) diff --git a/libraries/cmake/system/modules/Findlibrdkafka.cmake b/libraries/cmake/system/modules/Findlibrdkafka.cmake new file mode 100644 index 000000000..38ca0d9ee --- /dev/null +++ b/libraries/cmake/system/modules/Findlibrdkafka.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibrdkafka.cmake") diff --git a/libraries/cmake/system/modules/Findlibrpm.cmake b/libraries/cmake/system/modules/Findlibrpm.cmake new file mode 100644 index 000000000..a466800ee --- /dev/null +++ b/libraries/cmake/system/modules/Findlibrpm.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibrpm.cmake") + +target_compile_definitions(thirdparty_librpm PRIVATE + HAVE_RSA_SET0_KEY + HAVE_DSA_SET0_KEY + HAVE_DSA_SET0_PQG + HAVE_DSA_SIG_SET0 + HAVE_BN2BINPAD +) diff --git a/libraries/cmake/system/modules/Findlibudev.cmake b/libraries/cmake/system/modules/Findlibudev.cmake new file mode 100644 index 000000000..29809f41f --- /dev/null +++ b/libraries/cmake/system/modules/Findlibudev.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibudev.cmake") diff --git a/libraries/cmake/system/modules/Findlibxml2.cmake b/libraries/cmake/system/modules/Findlibxml2.cmake new file mode 100644 index 000000000..4e4b82ebd --- /dev/null +++ b/libraries/cmake/system/modules/Findlibxml2.cmake @@ -0,0 +1,16 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libxml2 + REQUIRED ${libxml2_REQUIRED} + MAIN_HEADER "libxml/xpath.h" + LIBRARIES "xml2" + HEADER_PATH_SUFFIX_LIST "libxml2" +) diff --git a/libraries/cmake/system/modules/Findlinenoise-ng.cmake b/libraries/cmake/system/modules/Findlinenoise-ng.cmake new file mode 100644 index 000000000..87753421e --- /dev/null +++ b/libraries/cmake/system/modules/Findlinenoise-ng.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlinenoise-ng.cmake") diff --git a/libraries/cmake/system/modules/Findlldpd.cmake b/libraries/cmake/system/modules/Findlldpd.cmake new file mode 100644 index 000000000..edcb1a206 --- /dev/null +++ b/libraries/cmake/system/modules/Findlldpd.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME lldpd + REQUIRED ${lldpd_REQUIRED} + MAIN_HEADER "lldpctl.h" + LIBRARIES "lldpctl" +) diff --git a/libraries/cmake/system/modules/Findlzma.cmake b/libraries/cmake/system/modules/Findlzma.cmake new file mode 100644 index 000000000..69c0cb15c --- /dev/null +++ b/libraries/cmake/system/modules/Findlzma.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME lzma + REQUIRED ${lzma_REQUIRED} + MAIN_HEADER "lzma.h" + LIBRARIES "lzma" +) diff --git a/libraries/cmake/system/modules/Findmarkupsafe.cmake b/libraries/cmake/system/modules/Findmarkupsafe.cmake new file mode 100644 index 000000000..c3f0ed757 --- /dev/null +++ b/libraries/cmake/system/modules/Findmarkupsafe.cmake @@ -0,0 +1,10 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/facebook/modules/api.cmake") +add_subdirectory("${CMAKE_SOURCE_DIR}/libraries/cmake/facebook/markupsafe") diff --git a/libraries/cmake/system/modules/Findopenssl.cmake b/libraries/cmake/system/modules/Findopenssl.cmake new file mode 100644 index 000000000..97518d81c --- /dev/null +++ b/libraries/cmake/system/modules/Findopenssl.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME thirdparty_openssl + REQUIRED ${openssl_REQUIRED} + MAIN_HEADER "openssl/crypto.h" + LIBRARIES "ssl" "crypto" +) diff --git a/libraries/cmake/system/modules/Findpopt.cmake b/libraries/cmake/system/modules/Findpopt.cmake new file mode 100644 index 000000000..8468800c1 --- /dev/null +++ b/libraries/cmake/system/modules/Findpopt.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME popt + REQUIRED ${popt_REQUIRED} + MAIN_HEADER "popt.h" + LIBRARIES "popt" +) diff --git a/libraries/cmake/system/modules/Findrapidjson.cmake b/libraries/cmake/system/modules/Findrapidjson.cmake new file mode 100644 index 000000000..ad691461f --- /dev/null +++ b/libraries/cmake/system/modules/Findrapidjson.cmake @@ -0,0 +1,14 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME rapidjson + REQUIRED ${rapidjson_REQUIRED} + MAIN_HEADER "rapidjson/document.h" +) diff --git a/libraries/cmake/system/modules/Findrocksdb.cmake b/libraries/cmake/system/modules/Findrocksdb.cmake new file mode 100644 index 000000000..caadb1ada --- /dev/null +++ b/libraries/cmake/system/modules/Findrocksdb.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findrocksdb.cmake") diff --git a/libraries/cmake/system/modules/Findsleuthkit.cmake b/libraries/cmake/system/modules/Findsleuthkit.cmake new file mode 100644 index 000000000..6250f66e9 --- /dev/null +++ b/libraries/cmake/system/modules/Findsleuthkit.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME sleuthkit + REQUIRED ${sleuthkit_REQUIRED} + MAIN_HEADER "tsk/base/tsk_os.h" + LIBRARIES "tsk" +) diff --git a/libraries/cmake/system/modules/Findsmartmontools.cmake b/libraries/cmake/system/modules/Findsmartmontools.cmake new file mode 100644 index 000000000..156e23bd0 --- /dev/null +++ b/libraries/cmake/system/modules/Findsmartmontools.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findsmartmontools.cmake") diff --git a/libraries/cmake/system/modules/Findsqlite.cmake b/libraries/cmake/system/modules/Findsqlite.cmake new file mode 100644 index 000000000..3a214efb3 --- /dev/null +++ b/libraries/cmake/system/modules/Findsqlite.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME sqlite + REQUIRED ${sqlite_REQUIRED} + MAIN_HEADER "sqlite3.h" + LIBRARIES "sqlite3" +) diff --git a/libraries/cmake/system/modules/Findssdeep-cpp.cmake b/libraries/cmake/system/modules/Findssdeep-cpp.cmake new file mode 100644 index 000000000..b68b03f32 --- /dev/null +++ b/libraries/cmake/system/modules/Findssdeep-cpp.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findssdeep-cpp.cmake") diff --git a/libraries/cmake/system/modules/Findssdeep.cmake b/libraries/cmake/system/modules/Findssdeep.cmake new file mode 100644 index 000000000..8f566f2be --- /dev/null +++ b/libraries/cmake/system/modules/Findssdeep.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME ssdeep + REQUIRED ${ssdeep_REQUIRED} + MAIN_HEADER "fuzzy.h" + LIBRARIES "fuzzy" +) diff --git a/libraries/cmake/system/modules/Findthrift.cmake.bak b/libraries/cmake/system/modules/Findthrift.cmake.bak new file mode 100644 index 000000000..f0dd2d458 --- /dev/null +++ b/libraries/cmake/system/modules/Findthrift.cmake.bak @@ -0,0 +1,16 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME thrift + REQUIRED ${thrift_REQUIRED} + MAIN_HEADER "thrift/version.h" + LIBRARIES "thrift" "thrift_c_glib" "thriftc" "thriftnb" "thriftz" +) + diff --git a/libraries/cmake/system/modules/Findutil-linux.cmake b/libraries/cmake/system/modules/Findutil-linux.cmake new file mode 100644 index 000000000..2858fae0e --- /dev/null +++ b/libraries/cmake/system/modules/Findutil-linux.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME util-linux + REQUIRED ${util-linux_REQUIRED} + MAIN_HEADER "blkid/blkid.h" + LIBRARIES "blkid" "fdisk" "mount" "smartcols" +) diff --git a/libraries/cmake/system/modules/Findyara.cmake b/libraries/cmake/system/modules/Findyara.cmake new file mode 100644 index 000000000..8c27dc5d1 --- /dev/null +++ b/libraries/cmake/system/modules/Findyara.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME yara + REQUIRED ${yara_REQUIRED} + MAIN_HEADER "yara.h" + LIBRARIES "yara" +) diff --git a/libraries/cmake/system/modules/Findzlib.cmake b/libraries/cmake/system/modules/Findzlib.cmake new file mode 100644 index 000000000..14d2807fd --- /dev/null +++ b/libraries/cmake/system/modules/Findzlib.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME zlib + REQUIRED ${zlib_REQUIRED} + MAIN_HEADER "zlib.h" + LIBRARIES "z" +) diff --git a/libraries/cmake/system/modules/Findzstd.cmake b/libraries/cmake/system/modules/Findzstd.cmake new file mode 100644 index 000000000..39285d35b --- /dev/null +++ b/libraries/cmake/system/modules/Findzstd.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME zstd + REQUIRED ${zstd_REQUIRED} + MAIN_HEADER "zstd.h" + LIBRARIES "zstd" +) diff --git a/libraries/cmake/system/modules/api.cmake b/libraries/cmake/system/modules/api.cmake new file mode 100644 index 000000000..ca948a43c --- /dev/null +++ b/libraries/cmake/system/modules/api.cmake @@ -0,0 +1,89 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) + +function(locateSystemLibrary) + cmake_parse_arguments( + PARSE_ARGV 0 + "ARGS" + "REQUIRED" + "NAME;MAIN_HEADER" + "LIBRARIES;HEADER_PATH_SUFFIX_LIST" + ) + + set(find_path_hints + "${CMAKE_INSTALL_PREFIX}/include" + "/usr/local/include" + "/usr/include" + "/include" + ) + + set(find_library_hints + "${CMAKE_INSTALL_PREFIX}/lib64" + "/usr/local/lib64" + "/usr/lib64" + "/lib64" + + "${CMAKE_INSTALL_PREFIX}/lib" + "/usr/local/lib" + "/usr/lib" + "/lib" + ) + + if(ARGS_REQUIRED) + set(error_type "FATAL_ERROR") + else() + set(error_type "WARNING") + endif() + + if(NOT "${ARGS_HEADER_PATH_SUFFIX_LIST}" STREQUAL "") + set(optional_path_suffixes_parameter PATH_SUFFIXES ${ARGS_HEADER_PATH_SUFFIX_LIST}) + endif() + + unset(main_header_path CACHE) + find_path(main_header_path + NAME "${ARGS_MAIN_HEADER}" + PATHS ${find_path_hints} + ${optional_path_suffixes_parameter} + ) + + if("${main_header_path}" STREQUAL "main_header_path-NOTFOUND") + message("${error_type}" "Failed to import library ${ARGS_NAME}. The following header file was not found: ${ARGS_MAIN_HEADER}") + return() + endif() + + foreach(current_library_name ${ARGS_LIBRARIES}) + unset(current_library_path CACHE) + find_library(current_library_path + NAME "${current_library_name}" + PATHS ${find_library_hints} + ) + + if("${current_library_path}" STREQUAL "current_library_path-NOTFOUND") + message("${error_type}" "Failed to import library ${ARGS_NAME}. The following library was not found: ${current_library_name}") + return() + endif() + + set(imported_library_name "${ARGS_NAME}_${current_library_name}") + + add_library("${imported_library_name}" UNKNOWN IMPORTED GLOBAL) + set_target_properties("${imported_library_name}" PROPERTIES + IMPORTED_LOCATION "${current_library_path}" + ) + + list(APPEND imported_library_list "${imported_library_name}") + + unset(current_library_path CACHE) + unset(current_library_path) + endforeach() + + add_library("${ARGS_NAME}" INTERFACE) + target_link_libraries("${ARGS_NAME}" INTERFACE ${imported_library_list}) + target_include_directories("${ARGS_NAME}" INTERFACE "${main_header_path}") + + set("${ARGS_NAME}_FOUND" true PARENT_SCOPE) +endfunction() diff --git a/osquery/utils/system/linux/ebpf/program.cpp b/osquery/utils/system/linux/ebpf/program.cpp index 58c5a021a..c0e7db672 100644 --- a/osquery/utils/system/linux/ebpf/program.cpp +++ b/osquery/utils/system/linux/ebpf/program.cpp @@ -41,16 +41,13 @@ Expected Program::load( constexpr auto kLogBufSize = std::uint32_t{1 << 16}; auto bpf_log_buf = std::array{}; - union bpf_attr attr = { - .prog_type = program_type, - .insns = reinterpret_cast<__aligned_u64>(prog.data()), - .insn_cnt = static_cast(prog.size()), - .license = reinterpret_cast<__aligned_u64>(kLicense), - .log_buf = 0u, - .log_size = 0u, - .log_level = 0u, - .kern_version = LINUX_VERSION_CODE, - }; + union bpf_attr attr{}; + attr.prog_type = program_type; + attr.insns = reinterpret_cast<__aligned_u64>(prog.data()); + attr.insn_cnt = static_cast(prog.size()); + attr.license = reinterpret_cast<__aligned_u64>(kLicense); + attr.kern_version = LINUX_VERSION_CODE; + if (debug) { bpf_log_buf.fill('\0'); attr.log_buf = reinterpret_cast(bpf_log_buf.data()); diff --git a/osquery/utils/system/linux/ebpf/program.h b/osquery/utils/system/linux/ebpf/program.h index 0dd0b499a..32299c2eb 100644 --- a/osquery/utils/system/linux/ebpf/program.h +++ b/osquery/utils/system/linux/ebpf/program.h @@ -9,6 +9,8 @@ #pragma once +#include + #include #include -- 2.29.2 From a92378c156a71ff7b28b2c75299d0da60f0993e2 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Sun, 24 Nov 2019 09:38:32 -0800 Subject: [PATCH 02/26] Use system libraries --- .../cmake/system/modules/Findaws-sdk-cpp.cmake | 10 +++++++++- .../cmake/system/modules/Findlibdevmapper.cmake | 10 +++++++++- libraries/cmake/system/modules/Findlibdpkg.cmake | 10 +++++++++- .../cmake/system/modules/Findlibelfin.cmake | 7 ++++++- .../cmake/system/modules/Findlibrdkafka.cmake | 10 +++++++++- libraries/cmake/system/modules/Findlibrpm.cmake | 16 ++++++++-------- libraries/cmake/system/modules/Findlibudev.cmake | 10 +++++++++- .../cmake/system/modules/Findlinenoise-ng.cmake | 10 +++++++++- libraries/cmake/system/modules/Findrocksdb.cmake | 10 +++++++++- .../cmake/system/modules/Findssdeep-cpp.cmake | 10 +++++++++- libraries/cmake/system/modules/Findssdeep.cmake | 15 --------------- .../{Findthrift.cmake.bak => Findthrift.cmake} | 4 ++-- 12 files changed, 88 insertions(+), 34 deletions(-) delete mode 100644 libraries/cmake/system/modules/Findssdeep.cmake rename libraries/cmake/system/modules/{Findthrift.cmake.bak => Findthrift.cmake} (78%) diff --git a/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake b/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake index aa85e7fc4..64344a58d 100644 --- a/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake +++ b/libraries/cmake/system/modules/Findaws-sdk-cpp.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findaws-sdk-cpp.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME aws-sdk-cpp + REQUIRED ${aws-sdk-cpp_REQUIRED} + MAIN_HEADER "aws/core/Version.h" "aws/ec2/EC2Client.h" "aws/firehose/FirehoseClient.h" "aws/kinesis/KinesisClient.h " + LIBRARIES "aws-cpp-sdk-core" "aws-cpp-sdk-ec2" "aws-cpp-sdk-firehose" "aws-cpp-sdk-kinesis" "aws-cpp-sdk-sts" +) diff --git a/libraries/cmake/system/modules/Findlibdevmapper.cmake b/libraries/cmake/system/modules/Findlibdevmapper.cmake index 34eb11995..47b5f566a 100644 --- a/libraries/cmake/system/modules/Findlibdevmapper.cmake +++ b/libraries/cmake/system/modules/Findlibdevmapper.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibdevmapper.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libdevmapper + REQUIRED ${libdevmapper_REQUIRED} + MAIN_HEADER "libdevmapper.h" + LIBRARIES "devmapper" "lvm2app" +) diff --git a/libraries/cmake/system/modules/Findlibdpkg.cmake b/libraries/cmake/system/modules/Findlibdpkg.cmake index 5d601b809..92d94a944 100644 --- a/libraries/cmake/system/modules/Findlibdpkg.cmake +++ b/libraries/cmake/system/modules/Findlibdpkg.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibdpkg.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libdpkg + REQUIRED ${libdpkg_REQUIRED} + MAIN_HEADER "dpkg/dpkg.h" + LIBRARIES "dpkg" +) diff --git a/libraries/cmake/system/modules/Findlibelfin.cmake b/libraries/cmake/system/modules/Findlibelfin.cmake index ce5da17f7..b231a74e5 100644 --- a/libraries/cmake/system/modules/Findlibelfin.cmake +++ b/libraries/cmake/system/modules/Findlibelfin.cmake @@ -4,4 +4,9 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibelfin.cmake") +locateSystemLibrary( + NAME libelfin + REQUIRED ${libelfin_REQUIRED} + MAIN_HEADER "libelfin/elf/elf++.hh" "libelfin/dwarf/dwarf++.hh" + LIBRARIES "dwarf++" "elf++" +) \ No newline at end of file diff --git a/libraries/cmake/system/modules/Findlibrdkafka.cmake b/libraries/cmake/system/modules/Findlibrdkafka.cmake index 38ca0d9ee..657bd568c 100644 --- a/libraries/cmake/system/modules/Findlibrdkafka.cmake +++ b/libraries/cmake/system/modules/Findlibrdkafka.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibrdkafka.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME librdkafka + REQUIRED ${librdkafka_REQUIRED} + MAIN_HEADER "librdkafka/rdkafka.h" + LIBRARIES "rdkafka" "rdkafka++" +) \ No newline at end of file diff --git a/libraries/cmake/system/modules/Findlibrpm.cmake b/libraries/cmake/system/modules/Findlibrpm.cmake index a466800ee..2f48f3b0a 100644 --- a/libraries/cmake/system/modules/Findlibrpm.cmake +++ b/libraries/cmake/system/modules/Findlibrpm.cmake @@ -4,12 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibrpm.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") -target_compile_definitions(thirdparty_librpm PRIVATE - HAVE_RSA_SET0_KEY - HAVE_DSA_SET0_KEY - HAVE_DSA_SET0_PQG - HAVE_DSA_SIG_SET0 - HAVE_BN2BINPAD -) +locateSystemLibrary( + NAME librpm + REQUIRED ${librpm_REQUIRED} + MAIN_HEADER "rpm/header.h" + LIBRARIES "rpm" "rpmio" +) \ No newline at end of file diff --git a/libraries/cmake/system/modules/Findlibudev.cmake b/libraries/cmake/system/modules/Findlibudev.cmake index 29809f41f..255db383a 100644 --- a/libraries/cmake/system/modules/Findlibudev.cmake +++ b/libraries/cmake/system/modules/Findlibudev.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlibudev.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libudev + REQUIRED ${libudev_REQUIRED} + MAIN_HEADER "libudev.h" + LIBRARIES "udev" +) \ No newline at end of file diff --git a/libraries/cmake/system/modules/Findlinenoise-ng.cmake b/libraries/cmake/system/modules/Findlinenoise-ng.cmake index 87753421e..ddb6e6814 100644 --- a/libraries/cmake/system/modules/Findlinenoise-ng.cmake +++ b/libraries/cmake/system/modules/Findlinenoise-ng.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findlinenoise-ng.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME linenoise-ng + REQUIRED ${linenoise-ng_REQUIRED} + MAIN_HEADER "linenoise.h" + LIBRARIES "linenoise" +) diff --git a/libraries/cmake/system/modules/Findrocksdb.cmake b/libraries/cmake/system/modules/Findrocksdb.cmake index caadb1ada..bce6e9180 100644 --- a/libraries/cmake/system/modules/Findrocksdb.cmake +++ b/libraries/cmake/system/modules/Findrocksdb.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findrocksdb.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME rocksdb + REQUIRED ${rocksdb_REQUIRED} + MAIN_HEADER "rocksdb/db.h" + LIBRARIES "rocksdb" +) diff --git a/libraries/cmake/system/modules/Findssdeep-cpp.cmake b/libraries/cmake/system/modules/Findssdeep-cpp.cmake index b68b03f32..b6e4da836 100644 --- a/libraries/cmake/system/modules/Findssdeep-cpp.cmake +++ b/libraries/cmake/system/modules/Findssdeep-cpp.cmake @@ -4,4 +4,12 @@ # This source code is licensed in accordance with the terms specified in # the LICENSE file found in the root directory of this source tree. -include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findssdeep-cpp.cmake") +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME ssdeep-cpp + REQUIRED ${ssdeep_REQUIRED} + MAIN_HEADER "fuzzy.h" + LIBRARIES "fuzzy" +) diff --git a/libraries/cmake/system/modules/Findssdeep.cmake b/libraries/cmake/system/modules/Findssdeep.cmake deleted file mode 100644 index 8f566f2be..000000000 --- a/libraries/cmake/system/modules/Findssdeep.cmake +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2014-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed in accordance with the terms specified in -# the LICENSE file found in the root directory of this source tree. - -cmake_minimum_required(VERSION 3.15) -include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") - -locateSystemLibrary( - NAME ssdeep - REQUIRED ${ssdeep_REQUIRED} - MAIN_HEADER "fuzzy.h" - LIBRARIES "fuzzy" -) diff --git a/libraries/cmake/system/modules/Findthrift.cmake.bak b/libraries/cmake/system/modules/Findthrift.cmake similarity index 78% rename from libraries/cmake/system/modules/Findthrift.cmake.bak rename to libraries/cmake/system/modules/Findthrift.cmake index f0dd2d458..1e5d5d937 100644 --- a/libraries/cmake/system/modules/Findthrift.cmake.bak +++ b/libraries/cmake/system/modules/Findthrift.cmake @@ -10,7 +10,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") locateSystemLibrary( NAME thrift REQUIRED ${thrift_REQUIRED} - MAIN_HEADER "thrift/version.h" - LIBRARIES "thrift" "thrift_c_glib" "thriftc" "thriftnb" "thriftz" + MAIN_HEADER "thrift/config.h" + LIBRARIES "thrift" "thrift_c_glib" "thriftnb" "thriftz" "event" ) -- 2.29.2 From 4819884184b7a6c6308d0f3138ee400df4023b24 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Mon, 25 Nov 2019 00:43:39 -0800 Subject: [PATCH 03/26] Regenerate Thrift with version 0.13.0 --- osquery/extensions/thrift/gen/Extension.cpp | 68 +++++----- osquery/extensions/thrift/gen/Extension.h | 83 ++++++------ .../thrift/gen/ExtensionManager.cpp | 128 +++++++++--------- .../extensions/thrift/gen/ExtensionManager.h | 91 +++++++------ .../gen/ExtensionManager_server.skeleton.cpp | 10 +- .../thrift/gen/Extension_server.skeleton.cpp | 10 +- .../thrift/gen/osquery_constants.cpp | 2 +- .../extensions/thrift/gen/osquery_constants.h | 2 +- .../extensions/thrift/gen/osquery_types.cpp | 23 +++- osquery/extensions/thrift/gen/osquery_types.h | 19 +-- 10 files changed, 226 insertions(+), 210 deletions(-) diff --git a/osquery/extensions/thrift/gen/Extension.cpp b/osquery/extensions/thrift/gen/Extension.cpp index 9f01870a4..cdd53dc3e 100644 --- a/osquery/extensions/thrift/gen/Extension.cpp +++ b/osquery/extensions/thrift/gen/Extension.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -9,7 +9,7 @@ namespace osquery { namespace extensions { -Extension_ping_args::~Extension_ping_args() throw() { +Extension_ping_args::~Extension_ping_args() noexcept { } @@ -52,7 +52,7 @@ uint32_t Extension_ping_args::write(::apache::thrift::protocol::TProtocol* oprot } -Extension_ping_pargs::~Extension_ping_pargs() throw() { +Extension_ping_pargs::~Extension_ping_pargs() noexcept { } @@ -67,7 +67,7 @@ uint32_t Extension_ping_pargs::write(::apache::thrift::protocol::TProtocol* opro } -Extension_ping_result::~Extension_ping_result() throw() { +Extension_ping_result::~Extension_ping_result() noexcept { } @@ -129,7 +129,7 @@ uint32_t Extension_ping_result::write(::apache::thrift::protocol::TProtocol* opr } -Extension_ping_presult::~Extension_ping_presult() throw() { +Extension_ping_presult::~Extension_ping_presult() noexcept { } @@ -175,7 +175,7 @@ uint32_t Extension_ping_presult::read(::apache::thrift::protocol::TProtocol* ipr } -Extension_call_args::~Extension_call_args() throw() { +Extension_call_args::~Extension_call_args() noexcept { } @@ -283,7 +283,7 @@ uint32_t Extension_call_args::write(::apache::thrift::protocol::TProtocol* oprot } -Extension_call_pargs::~Extension_call_pargs() throw() { +Extension_call_pargs::~Extension_call_pargs() noexcept { } @@ -319,7 +319,7 @@ uint32_t Extension_call_pargs::write(::apache::thrift::protocol::TProtocol* opro } -Extension_call_result::~Extension_call_result() throw() { +Extension_call_result::~Extension_call_result() noexcept { } @@ -381,7 +381,7 @@ uint32_t Extension_call_result::write(::apache::thrift::protocol::TProtocol* opr } -Extension_call_presult::~Extension_call_presult() throw() { +Extension_call_presult::~Extension_call_presult() noexcept { } @@ -427,7 +427,7 @@ uint32_t Extension_call_presult::read(::apache::thrift::protocol::TProtocol* ipr } -Extension_shutdown_args::~Extension_shutdown_args() throw() { +Extension_shutdown_args::~Extension_shutdown_args() noexcept { } @@ -470,7 +470,7 @@ uint32_t Extension_shutdown_args::write(::apache::thrift::protocol::TProtocol* o } -Extension_shutdown_pargs::~Extension_shutdown_pargs() throw() { +Extension_shutdown_pargs::~Extension_shutdown_pargs() noexcept { } @@ -485,7 +485,7 @@ uint32_t Extension_shutdown_pargs::write(::apache::thrift::protocol::TProtocol* } -Extension_shutdown_result::~Extension_shutdown_result() throw() { +Extension_shutdown_result::~Extension_shutdown_result() noexcept { } @@ -529,7 +529,7 @@ uint32_t Extension_shutdown_result::write(::apache::thrift::protocol::TProtocol* } -Extension_shutdown_presult::~Extension_shutdown_presult() throw() { +Extension_shutdown_presult::~Extension_shutdown_presult() noexcept { } @@ -910,10 +910,10 @@ void ExtensionProcessor::process_shutdown(int32_t seqid, ::apache::thrift::proto } } -::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > ExtensionProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::std::shared_ptr< ::apache::thrift::TProcessor > ExtensionProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< ExtensionIfFactory > cleanup(handlerFactory_); - ::apache::thrift::stdcxx::shared_ptr< ExtensionIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new ExtensionProcessor(handler)); + ::std::shared_ptr< ExtensionIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new ExtensionProcessor(handler)); return processor; } @@ -925,8 +925,8 @@ void ExtensionConcurrentClient::ping(ExtensionStatus& _return) int32_t ExtensionConcurrentClient::send_ping() { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("ping", ::apache::thrift::protocol::T_CALL, cseqid); Extension_ping_pargs args; @@ -949,10 +949,10 @@ void ExtensionConcurrentClient::recv_ping(ExtensionStatus& _return, const int32_ // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -993,10 +993,10 @@ void ExtensionConcurrentClient::recv_ping(ExtensionStatus& _return, const int32_ throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "ping failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -1008,8 +1008,8 @@ void ExtensionConcurrentClient::call(ExtensionResponse& _return, const std::stri int32_t ExtensionConcurrentClient::send_call(const std::string& registry, const std::string& item, const ExtensionPluginRequest& request) { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("call", ::apache::thrift::protocol::T_CALL, cseqid); Extension_call_pargs args; @@ -1035,10 +1035,10 @@ void ExtensionConcurrentClient::recv_call(ExtensionResponse& _return, const int3 // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -1079,10 +1079,10 @@ void ExtensionConcurrentClient::recv_call(ExtensionResponse& _return, const int3 throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "call failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -1094,8 +1094,8 @@ void ExtensionConcurrentClient::shutdown() int32_t ExtensionConcurrentClient::send_shutdown() { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("shutdown", ::apache::thrift::protocol::T_CALL, cseqid); Extension_shutdown_pargs args; @@ -1118,10 +1118,10 @@ void ExtensionConcurrentClient::recv_shutdown(const int32_t seqid) // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -1156,10 +1156,10 @@ void ExtensionConcurrentClient::recv_shutdown(const int32_t seqid) return; } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } diff --git a/osquery/extensions/thrift/gen/Extension.h b/osquery/extensions/thrift/gen/Extension.h index df1df1125..d0e33bb8f 100644 --- a/osquery/extensions/thrift/gen/Extension.h +++ b/osquery/extensions/thrift/gen/Extension.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -9,6 +9,7 @@ #include #include +#include #include "osquery_types.h" namespace osquery { namespace extensions { @@ -38,7 +39,7 @@ class ExtensionIfFactory { class ExtensionIfSingletonFactory : virtual public ExtensionIfFactory { public: - ExtensionIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} + ExtensionIfSingletonFactory(const ::std::shared_ptr& iface) : iface_(iface) {} virtual ~ExtensionIfSingletonFactory() {} virtual ExtensionIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -47,7 +48,7 @@ class ExtensionIfSingletonFactory : virtual public ExtensionIfFactory { virtual void releaseHandler(ExtensionIf* /* handler */) {} protected: - ::apache::thrift::stdcxx::shared_ptr iface_; + ::std::shared_ptr iface_; }; class ExtensionNull : virtual public ExtensionIf { @@ -73,7 +74,7 @@ class Extension_ping_args { Extension_ping_args() { } - virtual ~Extension_ping_args() throw(); + virtual ~Extension_ping_args() noexcept; bool operator == (const Extension_ping_args & /* rhs */) const { @@ -95,7 +96,7 @@ class Extension_ping_pargs { public: - virtual ~Extension_ping_pargs() throw(); + virtual ~Extension_ping_pargs() noexcept; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -114,7 +115,7 @@ class Extension_ping_result { Extension_ping_result() { } - virtual ~Extension_ping_result() throw(); + virtual ~Extension_ping_result() noexcept; ExtensionStatus success; _Extension_ping_result__isset __isset; @@ -147,7 +148,7 @@ class Extension_ping_presult { public: - virtual ~Extension_ping_presult() throw(); + virtual ~Extension_ping_presult() noexcept; ExtensionStatus* success; _Extension_ping_presult__isset __isset; @@ -171,7 +172,7 @@ class Extension_call_args { Extension_call_args() : registry(), item() { } - virtual ~Extension_call_args() throw(); + virtual ~Extension_call_args() noexcept; std::string registry; std::string item; ExtensionPluginRequest request; @@ -210,7 +211,7 @@ class Extension_call_pargs { public: - virtual ~Extension_call_pargs() throw(); + virtual ~Extension_call_pargs() noexcept; const std::string* registry; const std::string* item; const ExtensionPluginRequest* request; @@ -232,7 +233,7 @@ class Extension_call_result { Extension_call_result() { } - virtual ~Extension_call_result() throw(); + virtual ~Extension_call_result() noexcept; ExtensionResponse success; _Extension_call_result__isset __isset; @@ -265,7 +266,7 @@ class Extension_call_presult { public: - virtual ~Extension_call_presult() throw(); + virtual ~Extension_call_presult() noexcept; ExtensionResponse* success; _Extension_call_presult__isset __isset; @@ -283,7 +284,7 @@ class Extension_shutdown_args { Extension_shutdown_args() { } - virtual ~Extension_shutdown_args() throw(); + virtual ~Extension_shutdown_args() noexcept; bool operator == (const Extension_shutdown_args & /* rhs */) const { @@ -305,7 +306,7 @@ class Extension_shutdown_pargs { public: - virtual ~Extension_shutdown_pargs() throw(); + virtual ~Extension_shutdown_pargs() noexcept; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -320,7 +321,7 @@ class Extension_shutdown_result { Extension_shutdown_result() { } - virtual ~Extension_shutdown_result() throw(); + virtual ~Extension_shutdown_result() noexcept; bool operator == (const Extension_shutdown_result & /* rhs */) const { @@ -342,7 +343,7 @@ class Extension_shutdown_presult { public: - virtual ~Extension_shutdown_presult() throw(); + virtual ~Extension_shutdown_presult() noexcept; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); @@ -350,27 +351,27 @@ class Extension_shutdown_presult { class ExtensionClient : virtual public ExtensionIf { public: - ExtensionClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + ExtensionClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - ExtensionClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + ExtensionClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void ping(ExtensionStatus& _return); @@ -383,15 +384,15 @@ class ExtensionClient : virtual public ExtensionIf { void send_shutdown(); void recv_shutdown(); protected: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class ExtensionProcessor : public ::apache::thrift::TDispatchProcessor { protected: - ::apache::thrift::stdcxx::shared_ptr iface_; + ::std::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (ExtensionProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -401,7 +402,7 @@ class ExtensionProcessor : public ::apache::thrift::TDispatchProcessor { void process_call(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_shutdown(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - ExtensionProcessor(::apache::thrift::stdcxx::shared_ptr iface) : + ExtensionProcessor(::std::shared_ptr iface) : iface_(iface) { processMap_["ping"] = &ExtensionProcessor::process_ping; processMap_["call"] = &ExtensionProcessor::process_call; @@ -413,24 +414,24 @@ class ExtensionProcessor : public ::apache::thrift::TDispatchProcessor { class ExtensionProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - ExtensionProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< ExtensionIfFactory >& handlerFactory) : + ExtensionProcessorFactory(const ::std::shared_ptr< ExtensionIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::std::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::apache::thrift::stdcxx::shared_ptr< ExtensionIfFactory > handlerFactory_; + ::std::shared_ptr< ExtensionIfFactory > handlerFactory_; }; class ExtensionMultiface : virtual public ExtensionIf { public: - ExtensionMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + ExtensionMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~ExtensionMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; ExtensionMultiface() {} - void add(::apache::thrift::stdcxx::shared_ptr iface) { + void add(::std::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -470,27 +471,29 @@ class ExtensionMultiface : virtual public ExtensionIf { // only be used when you need to share a connection among multiple threads class ExtensionConcurrentClient : virtual public ExtensionIf { public: - ExtensionConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + ExtensionConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync) +{ setProtocol(prot); } - ExtensionConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + ExtensionConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync) +{ setProtocol(iprot,oprot); } private: - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void ping(ExtensionStatus& _return); @@ -503,11 +506,11 @@ class ExtensionConcurrentClient : virtual public ExtensionIf { int32_t send_shutdown(); void recv_shutdown(const int32_t seqid); protected: - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; - ::apache::thrift::async::TConcurrentClientSyncInfo sync_; + std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync_; }; #ifdef _MSC_VER diff --git a/osquery/extensions/thrift/gen/ExtensionManager.cpp b/osquery/extensions/thrift/gen/ExtensionManager.cpp index 9ca1ff5b5..4f3b163f0 100644 --- a/osquery/extensions/thrift/gen/ExtensionManager.cpp +++ b/osquery/extensions/thrift/gen/ExtensionManager.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -9,7 +9,7 @@ namespace osquery { namespace extensions { -ExtensionManager_extensions_args::~ExtensionManager_extensions_args() throw() { +ExtensionManager_extensions_args::~ExtensionManager_extensions_args() noexcept { } @@ -52,7 +52,7 @@ uint32_t ExtensionManager_extensions_args::write(::apache::thrift::protocol::TPr } -ExtensionManager_extensions_pargs::~ExtensionManager_extensions_pargs() throw() { +ExtensionManager_extensions_pargs::~ExtensionManager_extensions_pargs() noexcept { } @@ -67,7 +67,7 @@ uint32_t ExtensionManager_extensions_pargs::write(::apache::thrift::protocol::TP } -ExtensionManager_extensions_result::~ExtensionManager_extensions_result() throw() { +ExtensionManager_extensions_result::~ExtensionManager_extensions_result() noexcept { } @@ -153,7 +153,7 @@ uint32_t ExtensionManager_extensions_result::write(::apache::thrift::protocol::T } -ExtensionManager_extensions_presult::~ExtensionManager_extensions_presult() throw() { +ExtensionManager_extensions_presult::~ExtensionManager_extensions_presult() noexcept { } @@ -214,7 +214,7 @@ uint32_t ExtensionManager_extensions_presult::read(::apache::thrift::protocol::T } -ExtensionManager_options_args::~ExtensionManager_options_args() throw() { +ExtensionManager_options_args::~ExtensionManager_options_args() noexcept { } @@ -257,7 +257,7 @@ uint32_t ExtensionManager_options_args::write(::apache::thrift::protocol::TProto } -ExtensionManager_options_pargs::~ExtensionManager_options_pargs() throw() { +ExtensionManager_options_pargs::~ExtensionManager_options_pargs() noexcept { } @@ -272,7 +272,7 @@ uint32_t ExtensionManager_options_pargs::write(::apache::thrift::protocol::TProt } -ExtensionManager_options_result::~ExtensionManager_options_result() throw() { +ExtensionManager_options_result::~ExtensionManager_options_result() noexcept { } @@ -358,7 +358,7 @@ uint32_t ExtensionManager_options_result::write(::apache::thrift::protocol::TPro } -ExtensionManager_options_presult::~ExtensionManager_options_presult() throw() { +ExtensionManager_options_presult::~ExtensionManager_options_presult() noexcept { } @@ -419,7 +419,7 @@ uint32_t ExtensionManager_options_presult::read(::apache::thrift::protocol::TPro } -ExtensionManager_registerExtension_args::~ExtensionManager_registerExtension_args() throw() { +ExtensionManager_registerExtension_args::~ExtensionManager_registerExtension_args() noexcept { } @@ -583,7 +583,7 @@ uint32_t ExtensionManager_registerExtension_args::write(::apache::thrift::protoc } -ExtensionManager_registerExtension_pargs::~ExtensionManager_registerExtension_pargs() throw() { +ExtensionManager_registerExtension_pargs::~ExtensionManager_registerExtension_pargs() noexcept { } @@ -641,7 +641,7 @@ uint32_t ExtensionManager_registerExtension_pargs::write(::apache::thrift::proto } -ExtensionManager_registerExtension_result::~ExtensionManager_registerExtension_result() throw() { +ExtensionManager_registerExtension_result::~ExtensionManager_registerExtension_result() noexcept { } @@ -703,7 +703,7 @@ uint32_t ExtensionManager_registerExtension_result::write(::apache::thrift::prot } -ExtensionManager_registerExtension_presult::~ExtensionManager_registerExtension_presult() throw() { +ExtensionManager_registerExtension_presult::~ExtensionManager_registerExtension_presult() noexcept { } @@ -749,7 +749,7 @@ uint32_t ExtensionManager_registerExtension_presult::read(::apache::thrift::prot } -ExtensionManager_deregisterExtension_args::~ExtensionManager_deregisterExtension_args() throw() { +ExtensionManager_deregisterExtension_args::~ExtensionManager_deregisterExtension_args() noexcept { } @@ -809,7 +809,7 @@ uint32_t ExtensionManager_deregisterExtension_args::write(::apache::thrift::prot } -ExtensionManager_deregisterExtension_pargs::~ExtensionManager_deregisterExtension_pargs() throw() { +ExtensionManager_deregisterExtension_pargs::~ExtensionManager_deregisterExtension_pargs() noexcept { } @@ -828,7 +828,7 @@ uint32_t ExtensionManager_deregisterExtension_pargs::write(::apache::thrift::pro } -ExtensionManager_deregisterExtension_result::~ExtensionManager_deregisterExtension_result() throw() { +ExtensionManager_deregisterExtension_result::~ExtensionManager_deregisterExtension_result() noexcept { } @@ -890,7 +890,7 @@ uint32_t ExtensionManager_deregisterExtension_result::write(::apache::thrift::pr } -ExtensionManager_deregisterExtension_presult::~ExtensionManager_deregisterExtension_presult() throw() { +ExtensionManager_deregisterExtension_presult::~ExtensionManager_deregisterExtension_presult() noexcept { } @@ -936,7 +936,7 @@ uint32_t ExtensionManager_deregisterExtension_presult::read(::apache::thrift::pr } -ExtensionManager_query_args::~ExtensionManager_query_args() throw() { +ExtensionManager_query_args::~ExtensionManager_query_args() noexcept { } @@ -996,7 +996,7 @@ uint32_t ExtensionManager_query_args::write(::apache::thrift::protocol::TProtoco } -ExtensionManager_query_pargs::~ExtensionManager_query_pargs() throw() { +ExtensionManager_query_pargs::~ExtensionManager_query_pargs() noexcept { } @@ -1015,7 +1015,7 @@ uint32_t ExtensionManager_query_pargs::write(::apache::thrift::protocol::TProtoc } -ExtensionManager_query_result::~ExtensionManager_query_result() throw() { +ExtensionManager_query_result::~ExtensionManager_query_result() noexcept { } @@ -1077,7 +1077,7 @@ uint32_t ExtensionManager_query_result::write(::apache::thrift::protocol::TProto } -ExtensionManager_query_presult::~ExtensionManager_query_presult() throw() { +ExtensionManager_query_presult::~ExtensionManager_query_presult() noexcept { } @@ -1123,7 +1123,7 @@ uint32_t ExtensionManager_query_presult::read(::apache::thrift::protocol::TProto } -ExtensionManager_getQueryColumns_args::~ExtensionManager_getQueryColumns_args() throw() { +ExtensionManager_getQueryColumns_args::~ExtensionManager_getQueryColumns_args() noexcept { } @@ -1183,7 +1183,7 @@ uint32_t ExtensionManager_getQueryColumns_args::write(::apache::thrift::protocol } -ExtensionManager_getQueryColumns_pargs::~ExtensionManager_getQueryColumns_pargs() throw() { +ExtensionManager_getQueryColumns_pargs::~ExtensionManager_getQueryColumns_pargs() noexcept { } @@ -1202,7 +1202,7 @@ uint32_t ExtensionManager_getQueryColumns_pargs::write(::apache::thrift::protoco } -ExtensionManager_getQueryColumns_result::~ExtensionManager_getQueryColumns_result() throw() { +ExtensionManager_getQueryColumns_result::~ExtensionManager_getQueryColumns_result() noexcept { } @@ -1264,7 +1264,7 @@ uint32_t ExtensionManager_getQueryColumns_result::write(::apache::thrift::protoc } -ExtensionManager_getQueryColumns_presult::~ExtensionManager_getQueryColumns_presult() throw() { +ExtensionManager_getQueryColumns_presult::~ExtensionManager_getQueryColumns_presult() noexcept { } @@ -1990,10 +1990,10 @@ void ExtensionManagerProcessor::process_getQueryColumns(int32_t seqid, ::apache: } } -::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > ExtensionManagerProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::std::shared_ptr< ::apache::thrift::TProcessor > ExtensionManagerProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< ExtensionManagerIfFactory > cleanup(handlerFactory_); - ::apache::thrift::stdcxx::shared_ptr< ExtensionManagerIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new ExtensionManagerProcessor(handler)); + ::std::shared_ptr< ExtensionManagerIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new ExtensionManagerProcessor(handler)); return processor; } @@ -2005,8 +2005,8 @@ void ExtensionManagerConcurrentClient::extensions(InternalExtensionList& _return int32_t ExtensionManagerConcurrentClient::send_extensions() { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("extensions", ::apache::thrift::protocol::T_CALL, cseqid); ExtensionManager_extensions_pargs args; @@ -2029,10 +2029,10 @@ void ExtensionManagerConcurrentClient::recv_extensions(InternalExtensionList& _r // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -2073,10 +2073,10 @@ void ExtensionManagerConcurrentClient::recv_extensions(InternalExtensionList& _r throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "extensions failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -2088,8 +2088,8 @@ void ExtensionManagerConcurrentClient::options(InternalOptionList& _return) int32_t ExtensionManagerConcurrentClient::send_options() { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("options", ::apache::thrift::protocol::T_CALL, cseqid); ExtensionManager_options_pargs args; @@ -2112,10 +2112,10 @@ void ExtensionManagerConcurrentClient::recv_options(InternalOptionList& _return, // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -2156,10 +2156,10 @@ void ExtensionManagerConcurrentClient::recv_options(InternalOptionList& _return, throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "options failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -2171,8 +2171,8 @@ void ExtensionManagerConcurrentClient::registerExtension(ExtensionStatus& _retur int32_t ExtensionManagerConcurrentClient::send_registerExtension(const InternalExtensionInfo& info, const ExtensionRegistry& registry) { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("registerExtension", ::apache::thrift::protocol::T_CALL, cseqid); ExtensionManager_registerExtension_pargs args; @@ -2197,10 +2197,10 @@ void ExtensionManagerConcurrentClient::recv_registerExtension(ExtensionStatus& _ // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -2241,10 +2241,10 @@ void ExtensionManagerConcurrentClient::recv_registerExtension(ExtensionStatus& _ throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "registerExtension failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -2256,8 +2256,8 @@ void ExtensionManagerConcurrentClient::deregisterExtension(ExtensionStatus& _ret int32_t ExtensionManagerConcurrentClient::send_deregisterExtension(const ExtensionRouteUUID uuid) { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("deregisterExtension", ::apache::thrift::protocol::T_CALL, cseqid); ExtensionManager_deregisterExtension_pargs args; @@ -2281,10 +2281,10 @@ void ExtensionManagerConcurrentClient::recv_deregisterExtension(ExtensionStatus& // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -2325,10 +2325,10 @@ void ExtensionManagerConcurrentClient::recv_deregisterExtension(ExtensionStatus& throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "deregisterExtension failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -2340,8 +2340,8 @@ void ExtensionManagerConcurrentClient::query(ExtensionResponse& _return, const s int32_t ExtensionManagerConcurrentClient::send_query(const std::string& sql) { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("query", ::apache::thrift::protocol::T_CALL, cseqid); ExtensionManager_query_pargs args; @@ -2365,10 +2365,10 @@ void ExtensionManagerConcurrentClient::recv_query(ExtensionResponse& _return, co // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -2409,10 +2409,10 @@ void ExtensionManagerConcurrentClient::recv_query(ExtensionResponse& _return, co throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "query failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } @@ -2424,8 +2424,8 @@ void ExtensionManagerConcurrentClient::getQueryColumns(ExtensionResponse& _retur int32_t ExtensionManagerConcurrentClient::send_getQueryColumns(const std::string& sql) { - int32_t cseqid = this->sync_.generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + int32_t cseqid = this->sync_->generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get()); oprot_->writeMessageBegin("getQueryColumns", ::apache::thrift::protocol::T_CALL, cseqid); ExtensionManager_getQueryColumns_pargs args; @@ -2449,10 +2449,10 @@ void ExtensionManagerConcurrentClient::recv_getQueryColumns(ExtensionResponse& _ // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients - ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid); while(true) { - if(!this->sync_.getPending(fname, mtype, rseqid)) { + if(!this->sync_->getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { @@ -2493,10 +2493,10 @@ void ExtensionManagerConcurrentClient::recv_getQueryColumns(ExtensionResponse& _ throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getQueryColumns failed: unknown result"); } // seqid != rseqid - this->sync_.updatePending(fname, mtype, rseqid); + this->sync_->updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done - this->sync_.waitForWork(seqid); + this->sync_->waitForWork(seqid); } // end while(true) } diff --git a/osquery/extensions/thrift/gen/ExtensionManager.h b/osquery/extensions/thrift/gen/ExtensionManager.h index 0e4b15b2f..5d64a5932 100644 --- a/osquery/extensions/thrift/gen/ExtensionManager.h +++ b/osquery/extensions/thrift/gen/ExtensionManager.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -9,6 +9,7 @@ #include #include +#include #include "osquery_types.h" #include "Extension.h" @@ -42,7 +43,7 @@ class ExtensionManagerIfFactory : virtual public ExtensionIfFactory { class ExtensionManagerIfSingletonFactory : virtual public ExtensionManagerIfFactory { public: - ExtensionManagerIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} + ExtensionManagerIfSingletonFactory(const ::std::shared_ptr& iface) : iface_(iface) {} virtual ~ExtensionManagerIfSingletonFactory() {} virtual ExtensionManagerIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -51,7 +52,7 @@ class ExtensionManagerIfSingletonFactory : virtual public ExtensionManagerIfFact virtual void releaseHandler(ExtensionIf* /* handler */) {} protected: - ::apache::thrift::stdcxx::shared_ptr iface_; + ::std::shared_ptr iface_; }; class ExtensionManagerNull : virtual public ExtensionManagerIf , virtual public ExtensionNull { @@ -86,7 +87,7 @@ class ExtensionManager_extensions_args { ExtensionManager_extensions_args() { } - virtual ~ExtensionManager_extensions_args() throw(); + virtual ~ExtensionManager_extensions_args() noexcept; bool operator == (const ExtensionManager_extensions_args & /* rhs */) const { @@ -108,7 +109,7 @@ class ExtensionManager_extensions_pargs { public: - virtual ~ExtensionManager_extensions_pargs() throw(); + virtual ~ExtensionManager_extensions_pargs() noexcept; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -127,7 +128,7 @@ class ExtensionManager_extensions_result { ExtensionManager_extensions_result() { } - virtual ~ExtensionManager_extensions_result() throw(); + virtual ~ExtensionManager_extensions_result() noexcept; InternalExtensionList success; _ExtensionManager_extensions_result__isset __isset; @@ -160,7 +161,7 @@ class ExtensionManager_extensions_presult { public: - virtual ~ExtensionManager_extensions_presult() throw(); + virtual ~ExtensionManager_extensions_presult() noexcept; InternalExtensionList* success; _ExtensionManager_extensions_presult__isset __isset; @@ -178,7 +179,7 @@ class ExtensionManager_options_args { ExtensionManager_options_args() { } - virtual ~ExtensionManager_options_args() throw(); + virtual ~ExtensionManager_options_args() noexcept; bool operator == (const ExtensionManager_options_args & /* rhs */) const { @@ -200,7 +201,7 @@ class ExtensionManager_options_pargs { public: - virtual ~ExtensionManager_options_pargs() throw(); + virtual ~ExtensionManager_options_pargs() noexcept; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -219,7 +220,7 @@ class ExtensionManager_options_result { ExtensionManager_options_result() { } - virtual ~ExtensionManager_options_result() throw(); + virtual ~ExtensionManager_options_result() noexcept; InternalOptionList success; _ExtensionManager_options_result__isset __isset; @@ -252,7 +253,7 @@ class ExtensionManager_options_presult { public: - virtual ~ExtensionManager_options_presult() throw(); + virtual ~ExtensionManager_options_presult() noexcept; InternalOptionList* success; _ExtensionManager_options_presult__isset __isset; @@ -275,7 +276,7 @@ class ExtensionManager_registerExtension_args { ExtensionManager_registerExtension_args() { } - virtual ~ExtensionManager_registerExtension_args() throw(); + virtual ~ExtensionManager_registerExtension_args() noexcept; InternalExtensionInfo info; ExtensionRegistry registry; @@ -309,7 +310,7 @@ class ExtensionManager_registerExtension_pargs { public: - virtual ~ExtensionManager_registerExtension_pargs() throw(); + virtual ~ExtensionManager_registerExtension_pargs() noexcept; const InternalExtensionInfo* info; const ExtensionRegistry* registry; @@ -330,7 +331,7 @@ class ExtensionManager_registerExtension_result { ExtensionManager_registerExtension_result() { } - virtual ~ExtensionManager_registerExtension_result() throw(); + virtual ~ExtensionManager_registerExtension_result() noexcept; ExtensionStatus success; _ExtensionManager_registerExtension_result__isset __isset; @@ -363,7 +364,7 @@ class ExtensionManager_registerExtension_presult { public: - virtual ~ExtensionManager_registerExtension_presult() throw(); + virtual ~ExtensionManager_registerExtension_presult() noexcept; ExtensionStatus* success; _ExtensionManager_registerExtension_presult__isset __isset; @@ -385,7 +386,7 @@ class ExtensionManager_deregisterExtension_args { ExtensionManager_deregisterExtension_args() : uuid(0) { } - virtual ~ExtensionManager_deregisterExtension_args() throw(); + virtual ~ExtensionManager_deregisterExtension_args() noexcept; ExtensionRouteUUID uuid; _ExtensionManager_deregisterExtension_args__isset __isset; @@ -414,7 +415,7 @@ class ExtensionManager_deregisterExtension_pargs { public: - virtual ~ExtensionManager_deregisterExtension_pargs() throw(); + virtual ~ExtensionManager_deregisterExtension_pargs() noexcept; const ExtensionRouteUUID* uuid; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -434,7 +435,7 @@ class ExtensionManager_deregisterExtension_result { ExtensionManager_deregisterExtension_result() { } - virtual ~ExtensionManager_deregisterExtension_result() throw(); + virtual ~ExtensionManager_deregisterExtension_result() noexcept; ExtensionStatus success; _ExtensionManager_deregisterExtension_result__isset __isset; @@ -467,7 +468,7 @@ class ExtensionManager_deregisterExtension_presult { public: - virtual ~ExtensionManager_deregisterExtension_presult() throw(); + virtual ~ExtensionManager_deregisterExtension_presult() noexcept; ExtensionStatus* success; _ExtensionManager_deregisterExtension_presult__isset __isset; @@ -489,7 +490,7 @@ class ExtensionManager_query_args { ExtensionManager_query_args() : sql() { } - virtual ~ExtensionManager_query_args() throw(); + virtual ~ExtensionManager_query_args() noexcept; std::string sql; _ExtensionManager_query_args__isset __isset; @@ -518,7 +519,7 @@ class ExtensionManager_query_pargs { public: - virtual ~ExtensionManager_query_pargs() throw(); + virtual ~ExtensionManager_query_pargs() noexcept; const std::string* sql; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -538,7 +539,7 @@ class ExtensionManager_query_result { ExtensionManager_query_result() { } - virtual ~ExtensionManager_query_result() throw(); + virtual ~ExtensionManager_query_result() noexcept; ExtensionResponse success; _ExtensionManager_query_result__isset __isset; @@ -571,7 +572,7 @@ class ExtensionManager_query_presult { public: - virtual ~ExtensionManager_query_presult() throw(); + virtual ~ExtensionManager_query_presult() noexcept; ExtensionResponse* success; _ExtensionManager_query_presult__isset __isset; @@ -593,7 +594,7 @@ class ExtensionManager_getQueryColumns_args { ExtensionManager_getQueryColumns_args() : sql() { } - virtual ~ExtensionManager_getQueryColumns_args() throw(); + virtual ~ExtensionManager_getQueryColumns_args() noexcept; std::string sql; _ExtensionManager_getQueryColumns_args__isset __isset; @@ -622,7 +623,7 @@ class ExtensionManager_getQueryColumns_pargs { public: - virtual ~ExtensionManager_getQueryColumns_pargs() throw(); + virtual ~ExtensionManager_getQueryColumns_pargs() noexcept; const std::string* sql; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; @@ -642,7 +643,7 @@ class ExtensionManager_getQueryColumns_result { ExtensionManager_getQueryColumns_result() { } - virtual ~ExtensionManager_getQueryColumns_result() throw(); + virtual ~ExtensionManager_getQueryColumns_result() noexcept; ExtensionResponse success; _ExtensionManager_getQueryColumns_result__isset __isset; @@ -675,7 +676,7 @@ class ExtensionManager_getQueryColumns_presult { public: - virtual ~ExtensionManager_getQueryColumns_presult() throw(); + virtual ~ExtensionManager_getQueryColumns_presult() noexcept; ExtensionResponse* success; _ExtensionManager_getQueryColumns_presult__isset __isset; @@ -686,13 +687,13 @@ class ExtensionManager_getQueryColumns_presult { class ExtensionManagerClient : virtual public ExtensionManagerIf, public ExtensionClient { public: - ExtensionManagerClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : + ExtensionManagerClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : ExtensionClient(prot, prot) {} - ExtensionManagerClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : ExtensionClient(iprot, oprot) {} - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + ExtensionManagerClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : ExtensionClient(iprot, oprot) {} + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void extensions(InternalExtensionList& _return); @@ -717,7 +718,7 @@ class ExtensionManagerClient : virtual public ExtensionManagerIf, public Extensi class ExtensionManagerProcessor : public ExtensionProcessor { protected: - ::apache::thrift::stdcxx::shared_ptr iface_; + ::std::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (ExtensionManagerProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -730,7 +731,7 @@ class ExtensionManagerProcessor : public ExtensionProcessor { void process_query(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_getQueryColumns(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - ExtensionManagerProcessor(::apache::thrift::stdcxx::shared_ptr iface) : + ExtensionManagerProcessor(::std::shared_ptr iface) : ExtensionProcessor(iface), iface_(iface) { processMap_["extensions"] = &ExtensionManagerProcessor::process_extensions; @@ -746,28 +747,28 @@ class ExtensionManagerProcessor : public ExtensionProcessor { class ExtensionManagerProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - ExtensionManagerProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< ExtensionManagerIfFactory >& handlerFactory) : + ExtensionManagerProcessorFactory(const ::std::shared_ptr< ExtensionManagerIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::std::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::apache::thrift::stdcxx::shared_ptr< ExtensionManagerIfFactory > handlerFactory_; + ::std::shared_ptr< ExtensionManagerIfFactory > handlerFactory_; }; class ExtensionManagerMultiface : virtual public ExtensionManagerIf, public ExtensionMultiface { public: - ExtensionManagerMultiface(std::vector >& ifaces) : ifaces_(ifaces) { - std::vector >::iterator iter; + ExtensionManagerMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + std::vector >::iterator iter; for (iter = ifaces.begin(); iter != ifaces.end(); ++iter) { ExtensionMultiface::add(*iter); } } virtual ~ExtensionManagerMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; ExtensionManagerMultiface() {} - void add(::apache::thrift::stdcxx::shared_ptr iface) { + void add(::std::shared_ptr iface) { ExtensionMultiface::add(iface); ifaces_.push_back(iface); } @@ -839,13 +840,13 @@ class ExtensionManagerMultiface : virtual public ExtensionManagerIf, public Exte // only be used when you need to share a connection among multiple threads class ExtensionManagerConcurrentClient : virtual public ExtensionManagerIf, public ExtensionConcurrentClient { public: - ExtensionManagerConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : - ExtensionConcurrentClient(prot, prot) {} - ExtensionManagerConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : ExtensionConcurrentClient(iprot, oprot) {} - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + ExtensionManagerConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : + ExtensionConcurrentClient(prot, prot, sync) {} + ExtensionManagerConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : ExtensionConcurrentClient(iprot, oprot, sync) {} + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void extensions(InternalExtensionList& _return); diff --git a/osquery/extensions/thrift/gen/ExtensionManager_server.skeleton.cpp b/osquery/extensions/thrift/gen/ExtensionManager_server.skeleton.cpp index 4257e40eb..dbcb11710 100644 --- a/osquery/extensions/thrift/gen/ExtensionManager_server.skeleton.cpp +++ b/osquery/extensions/thrift/gen/ExtensionManager_server.skeleton.cpp @@ -54,11 +54,11 @@ class ExtensionManagerHandler : virtual public ExtensionManagerIf { int main(int argc, char **argv) { int port = 9090; - ::apache::thrift::stdcxx::shared_ptr handler(new ExtensionManagerHandler()); - ::apache::thrift::stdcxx::shared_ptr processor(new ExtensionManagerProcessor(handler)); - ::apache::thrift::stdcxx::shared_ptr serverTransport(new TServerSocket(port)); - ::apache::thrift::stdcxx::shared_ptr transportFactory(new TBufferedTransportFactory()); - ::apache::thrift::stdcxx::shared_ptr protocolFactory(new TBinaryProtocolFactory()); + ::std::shared_ptr handler(new ExtensionManagerHandler()); + ::std::shared_ptr processor(new ExtensionManagerProcessor(handler)); + ::std::shared_ptr serverTransport(new TServerSocket(port)); + ::std::shared_ptr transportFactory(new TBufferedTransportFactory()); + ::std::shared_ptr protocolFactory(new TBinaryProtocolFactory()); TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); server.serve(); diff --git a/osquery/extensions/thrift/gen/Extension_server.skeleton.cpp b/osquery/extensions/thrift/gen/Extension_server.skeleton.cpp index 31eab1efc..6b1bfe2b8 100644 --- a/osquery/extensions/thrift/gen/Extension_server.skeleton.cpp +++ b/osquery/extensions/thrift/gen/Extension_server.skeleton.cpp @@ -39,11 +39,11 @@ class ExtensionHandler : virtual public ExtensionIf { int main(int argc, char **argv) { int port = 9090; - ::apache::thrift::stdcxx::shared_ptr handler(new ExtensionHandler()); - ::apache::thrift::stdcxx::shared_ptr processor(new ExtensionProcessor(handler)); - ::apache::thrift::stdcxx::shared_ptr serverTransport(new TServerSocket(port)); - ::apache::thrift::stdcxx::shared_ptr transportFactory(new TBufferedTransportFactory()); - ::apache::thrift::stdcxx::shared_ptr protocolFactory(new TBinaryProtocolFactory()); + ::std::shared_ptr handler(new ExtensionHandler()); + ::std::shared_ptr processor(new ExtensionProcessor(handler)); + ::std::shared_ptr serverTransport(new TServerSocket(port)); + ::std::shared_ptr transportFactory(new TBufferedTransportFactory()); + ::std::shared_ptr protocolFactory(new TBinaryProtocolFactory()); TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); server.serve(); diff --git a/osquery/extensions/thrift/gen/osquery_constants.cpp b/osquery/extensions/thrift/gen/osquery_constants.cpp index 0c8e9e90c..7f0405851 100644 --- a/osquery/extensions/thrift/gen/osquery_constants.cpp +++ b/osquery/extensions/thrift/gen/osquery_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/osquery/extensions/thrift/gen/osquery_constants.h b/osquery/extensions/thrift/gen/osquery_constants.h index a2dc20ed0..2b85ca597 100644 --- a/osquery/extensions/thrift/gen/osquery_constants.h +++ b/osquery/extensions/thrift/gen/osquery_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/osquery/extensions/thrift/gen/osquery_types.cpp b/osquery/extensions/thrift/gen/osquery_types.cpp index e1bec899e..a0a71fc11 100644 --- a/osquery/extensions/thrift/gen/osquery_types.cpp +++ b/osquery/extensions/thrift/gen/osquery_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -35,8 +35,17 @@ std::ostream& operator<<(std::ostream& out, const ExtensionCode::type& val) { return out; } +std::string to_string(const ExtensionCode::type& val) { + std::map::const_iterator it = _ExtensionCode_VALUES_TO_NAMES.find(val); + if (it != _ExtensionCode_VALUES_TO_NAMES.end()) { + return std::string(it->second); + } else { + return std::to_string(static_cast(val)); + } +} + -InternalOptionInfo::~InternalOptionInfo() throw() { +InternalOptionInfo::~InternalOptionInfo() noexcept { } @@ -168,7 +177,7 @@ void InternalOptionInfo::printTo(std::ostream& out) const { } -InternalExtensionInfo::~InternalExtensionInfo() throw() { +InternalExtensionInfo::~InternalExtensionInfo() noexcept { } @@ -320,7 +329,7 @@ void InternalExtensionInfo::printTo(std::ostream& out) const { } -ExtensionStatus::~ExtensionStatus() throw() { +ExtensionStatus::~ExtensionStatus() noexcept { } @@ -452,7 +461,7 @@ void ExtensionStatus::printTo(std::ostream& out) const { } -ExtensionResponse::~ExtensionResponse() throw() { +ExtensionResponse::~ExtensionResponse() noexcept { } @@ -608,7 +617,7 @@ void ExtensionResponse::printTo(std::ostream& out) const { } -ExtensionException::~ExtensionException() throw() { +ExtensionException::~ExtensionException() noexcept { } @@ -739,7 +748,7 @@ void ExtensionException::printTo(std::ostream& out) const { out << ")"; } -const char* ExtensionException::what() const throw() { +const char* ExtensionException::what() const noexcept { try { std::stringstream ss; ss << "TException - service has thrown: " << *this; diff --git a/osquery/extensions/thrift/gen/osquery_types.h b/osquery/extensions/thrift/gen/osquery_types.h index 818ca3db0..83efb27cc 100644 --- a/osquery/extensions/thrift/gen/osquery_types.h +++ b/osquery/extensions/thrift/gen/osquery_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.11.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,7 +15,8 @@ #include #include -#include +#include +#include namespace osquery { namespace extensions { @@ -32,6 +33,8 @@ extern const std::map _ExtensionCode_VALUES_TO_NAMES; std::ostream& operator<<(std::ostream& out, const ExtensionCode::type& val); +std::string to_string(const ExtensionCode::type& val); + typedef std::map ExtensionPluginRequest; typedef std::vector > ExtensionPluginResponse; @@ -71,7 +74,7 @@ class InternalOptionInfo : public virtual ::apache::thrift::TBase { InternalOptionInfo() : value(), default_value(), type() { } - virtual ~InternalOptionInfo() throw(); + virtual ~InternalOptionInfo() noexcept; std::string value; std::string default_value; std::string type; @@ -126,7 +129,7 @@ class InternalExtensionInfo : public virtual ::apache::thrift::TBase { InternalExtensionInfo() : name(), version(), sdk_version(), min_sdk_version() { } - virtual ~InternalExtensionInfo() throw(); + virtual ~InternalExtensionInfo() noexcept; std::string name; std::string version; std::string sdk_version; @@ -185,7 +188,7 @@ class ExtensionStatus : public virtual ::apache::thrift::TBase { ExtensionStatus() : code(0), message(), uuid(0) { } - virtual ~ExtensionStatus() throw(); + virtual ~ExtensionStatus() noexcept; int32_t code; std::string message; ExtensionRouteUUID uuid; @@ -238,7 +241,7 @@ class ExtensionResponse : public virtual ::apache::thrift::TBase { ExtensionResponse() { } - virtual ~ExtensionResponse() throw(); + virtual ~ExtensionResponse() noexcept; ExtensionStatus status; ExtensionPluginResponse response; @@ -287,7 +290,7 @@ class ExtensionException : public ::apache::thrift::TException { ExtensionException() : code(0), message(), uuid(0) { } - virtual ~ExtensionException() throw(); + virtual ~ExtensionException() noexcept; int32_t code; std::string message; ExtensionRouteUUID uuid; @@ -321,7 +324,7 @@ class ExtensionException : public ::apache::thrift::TException { virtual void printTo(std::ostream& out) const; mutable std::string thriftTExceptionMessageHolder_; - const char* what() const throw(); + const char* what() const noexcept; }; void swap(ExtensionException &a, ExtensionException &b); -- 2.29.2 From 2604949be2b67b0b12d21174be7151111e49faad Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Mon, 25 Nov 2019 11:00:56 -0800 Subject: [PATCH 04/26] Adopt code for the upstream dpkg API changes dpkg changed naming from pkg_db to pkg_hash in the upstream commit 31eb544919a46c6170ac39f5eebd17ba6d48d508 --- osquery/tables/system/linux/deb_packages.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osquery/tables/system/linux/deb_packages.cpp b/osquery/tables/system/linux/deb_packages.cpp index a4b2aca2f..f8835e8d8 100644 --- a/osquery/tables/system/linux/deb_packages.cpp +++ b/osquery/tables/system/linux/deb_packages.cpp @@ -81,7 +81,7 @@ void dpkg_setup(struct pkg_array* packages) { modstatdb_init(); modstatdb_open(msdbrw_readonly); - pkg_array_init_from_db(packages); + pkg_array_init_from_hash(packages); pkg_array_sort(packages, pkg_sorter); } @@ -91,7 +91,7 @@ void dpkg_setup(struct pkg_array* packages) { void dpkg_teardown(struct pkg_array* packages) { pkg_array_destroy(packages); - pkg_db_reset(); + pkg_hash_reset(); modstatdb_done(); pop_error_context(ehflag_normaltidy); -- 2.29.2 From 0b63da8f548ef99a4f90fa65f6456effc29f8429 Mon Sep 17 00:00:00 2001 From: Alessandro Gario Date: Wed, 27 Nov 2019 01:54:35 +0100 Subject: [PATCH 05/26] CMake: Fix AWS library name inconsistency --- libraries/cmake/system/modules/api.cmake | 14 ++++++++++++++ osquery/tables/cloud/CMakeLists.txt | 4 ++-- osquery/utils/aws/CMakeLists.txt | 4 ++-- plugins/logger/CMakeLists.txt | 8 ++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/libraries/cmake/system/modules/api.cmake b/libraries/cmake/system/modules/api.cmake index ca948a43c..498490506 100644 --- a/libraries/cmake/system/modules/api.cmake +++ b/libraries/cmake/system/modules/api.cmake @@ -56,6 +56,16 @@ function(locateSystemLibrary) return() endif() + # Some targets may prefer to link against each specific library. If we have + # multiple dependencies, let's also create a interface target for each + # one of them + list(LENGTH ARGS_LIBRARIES child_library_count) + if(${child_library_count} GREATER 1) + set(generate_library_aliases true) + else() + set(generate_library_aliases false) + endif() + foreach(current_library_name ${ARGS_LIBRARIES}) unset(current_library_path CACHE) find_library(current_library_path @@ -75,6 +85,10 @@ function(locateSystemLibrary) IMPORTED_LOCATION "${current_library_path}" ) + if(generate_library_aliases) + add_library("thirdparty_${current_library_name}" ALIAS "${imported_library_name}") + endif() + list(APPEND imported_library_list "${imported_library_name}") unset(current_library_path CACHE) diff --git a/osquery/tables/cloud/CMakeLists.txt b/osquery/tables/cloud/CMakeLists.txt index 64009cf8a..40e03cd2f 100644 --- a/osquery/tables/cloud/CMakeLists.txt +++ b/osquery/tables/cloud/CMakeLists.txt @@ -24,8 +24,8 @@ function(generateOsqueryTablesCloudAws) osquery_logger osquery_utils_aws thirdparty_boost - thirdparty_aws_core - thirdparty_aws_ec2 + thirdparty_aws-cpp-sdk-core + thirdparty_aws-cpp-sdk-ec2 ) endfunction() diff --git a/osquery/utils/aws/CMakeLists.txt b/osquery/utils/aws/CMakeLists.txt index 7859f251b..94ab0f965 100644 --- a/osquery/utils/aws/CMakeLists.txt +++ b/osquery/utils/aws/CMakeLists.txt @@ -25,8 +25,8 @@ function(generateOsqueryUtilsAws) osquery_remote_transports_transportstls osquery_utils_json osquery_utils_status - thirdparty_aws_core - thirdparty_aws_sts + thirdparty_aws-cpp-sdk-core + thirdparty_aws-cpp-sdk-sts ) set(public_header_files diff --git a/plugins/logger/CMakeLists.txt b/plugins/logger/CMakeLists.txt index 758b684d6..1a1372e61 100644 --- a/plugins/logger/CMakeLists.txt +++ b/plugins/logger/CMakeLists.txt @@ -45,8 +45,8 @@ function(generatePluginsLoggerAwsfirehose) osquery_cxx_settings osquery_dispatcher plugins_logger_awslogforwarder - thirdparty_aws_core - thirdparty_aws_firehose + thirdparty_aws-cpp-sdk-core + thirdparty_aws-cpp-sdk-firehose ) set(public_header_files @@ -69,8 +69,8 @@ function(generatePluginsLoggerAwskinesis) osquery_process osquery_registry plugins_logger_awslogforwarder - thirdparty_aws_core - thirdparty_aws_kinesis + thirdparty_aws-cpp-sdk-core + thirdparty_aws-cpp-sdk-kinesis ) set(public_header_files -- 2.29.2 From c00a4f750137afb76703f93c8d9b0379ff82c8df Mon Sep 17 00:00:00 2001 From: Alessandro Gario Date: Wed, 27 Nov 2019 02:15:51 +0100 Subject: [PATCH 06/26] CMake: Remove -Weffc++ --- cmake/flags.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index ffc0e0539..446be3740 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -75,7 +75,6 @@ function(setupBuildFlags) -Wno-c++11-extensions -Woverloaded-virtual -Wnon-virtual-dtor - -Weffc++ -stdlib=libc++ ) -- 2.29.2 From 6f30baca88eb6b0fc1b7a20341ce8d1c4939195f Mon Sep 17 00:00:00 2001 From: Alessandro Gario Date: Wed, 27 Nov 2019 02:16:01 +0100 Subject: [PATCH 07/26] CMake: librpm should depend on liblmdb --- CMakeLists.txt | 1 + libraries/cmake/system/modules/Findlibrpm.cmake | 7 ++++++- libraries/cmake/system/modules/Findlmdb.cmake | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 libraries/cmake/system/modules/Findlmdb.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 1339c6f02..e3a6a376b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,7 @@ function(importLibraries) "Linux:expat" "Linux:dbus" "Linux:libcap" + "Linux:lmdb" ) if(OSQUERY_BUILD_BPF) diff --git a/libraries/cmake/system/modules/Findlibrpm.cmake b/libraries/cmake/system/modules/Findlibrpm.cmake index 2f48f3b0a..425cb2e82 100644 --- a/libraries/cmake/system/modules/Findlibrpm.cmake +++ b/libraries/cmake/system/modules/Findlibrpm.cmake @@ -12,4 +12,9 @@ locateSystemLibrary( REQUIRED ${librpm_REQUIRED} MAIN_HEADER "rpm/header.h" LIBRARIES "rpm" "rpmio" -) \ No newline at end of file +) + +target_link_libraries(librpm INTERFACE + lmdb +) + diff --git a/libraries/cmake/system/modules/Findlmdb.cmake b/libraries/cmake/system/modules/Findlmdb.cmake new file mode 100644 index 000000000..11e428a75 --- /dev/null +++ b/libraries/cmake/system/modules/Findlmdb.cmake @@ -0,0 +1,15 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME lmdb + REQUIRED ${bzip2_REQUIRED} + MAIN_HEADER "lmdb.h" + LIBRARIES "lmdb" +) -- 2.29.2 From c1b0131637ac3cbb1b3528c7191e71499e4c7364 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Tue, 26 Nov 2019 18:59:52 -0800 Subject: [PATCH 08/26] Add 'resolv' library as a dependency of posix/dns_resolvers.cpp -lresolv parameter is a part of linker command line. However we still have a linking problem: /usr/bin/ld: osquery/tables/networking/libosquery_tables_networking.a(dns_resolvers.cpp.o): undefined reference to symbol '__res_close@@GLIBC_2.2.5' /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libresolv.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status The linker expects *.so that provides the required symbol appended *after* the static library that needs it. To fix the issue we explicitly add 'resolv' as a dependency of networking library. It forces CMake to add all this dependency after the *.a. --- osquery/tables/networking/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osquery/tables/networking/CMakeLists.txt b/osquery/tables/networking/CMakeLists.txt index 70b7079ee..d14f7c430 100644 --- a/osquery/tables/networking/CMakeLists.txt +++ b/osquery/tables/networking/CMakeLists.txt @@ -84,6 +84,12 @@ function(generateOsqueryTablesNetworking) thirdparty_boost ) + if(DEFINED PLATFORM_POSIX) + list(APPEND platform_deps + resolv + ) + endif() + if(DEFINED PLATFORM_LINUX) list(APPEND platform_deps thirdparty_libiptables -- 2.29.2 From 763fc9d81b3ea27949aae76d1284ac1303e88ec8 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Tue, 26 Nov 2019 19:06:42 -0800 Subject: [PATCH 09/26] Do not install augeas lenses if we use system libraries If we do not build in-tree version of augeas then nothing to install here. --- cmake/packaging.cmake | 14 ++++++++------ osquery/tables/system/tests/CMakeLists.txt | 12 +++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cmake/packaging.cmake b/cmake/packaging.cmake index 7d3319c09..1b5ac0e2d 100644 --- a/cmake/packaging.cmake +++ b/cmake/packaging.cmake @@ -171,12 +171,14 @@ function(generateInstallTargets) file(COPY "${CMAKE_SOURCE_DIR}/tools/deployment/osquery.example.conf" DESTINATION "${CMAKE_BINARY_DIR}/package/linux") install(FILES "${CMAKE_BINARY_DIR}/package/linux/osquery.example.conf" DESTINATION share/osquery COMPONENT osquery) - install(DIRECTORY "${augeas_lenses_path}/" - DESTINATION share/osquery/lenses - COMPONENT osquery - FILES_MATCHING PATTERN "*.aug" - PATTERN "tests" EXCLUDE) - install(FILES "${augeas_lenses_path}/../COPYING" DESTINATION share/osquery/lenses COMPONENT osquery) + if(NOT "${augeas_lenses_path}" STREQUAL "") + install(DIRECTORY "${augeas_lenses_path}/" + DESTINATION share/osquery/lenses + COMPONENT osquery + FILES_MATCHING PATTERN "*.aug" + PATTERN "tests" EXCLUDE) + install(FILES "${augeas_lenses_path}/../COPYING" DESTINATION share/osquery/lenses COMPONENT osquery) + endif() if("${PACKAGING_SYSTEM}" STREQUAL "DEB") file(COPY "${CMAKE_SOURCE_DIR}/tools/deployment/copyright.debian" DESTINATION "${CMAKE_BINARY_DIR}/package/deb") diff --git a/osquery/tables/system/tests/CMakeLists.txt b/osquery/tables/system/tests/CMakeLists.txt index 8b4349651..712bffad6 100644 --- a/osquery/tables/system/tests/CMakeLists.txt +++ b/osquery/tables/system/tests/CMakeLists.txt @@ -176,12 +176,14 @@ function(generateOsqueryTablesSystemTestsAugeasTestsTest) get_property(augeas_lenses_path GLOBAL PROPERTY AUGEAS_LENSES_FOLDER_PATH) - add_custom_target(osquery_tables_system_tests_augeaslenses - COMMAND "${CMAKE_COMMAND}" -E make_directory "${TEST_CONFIGS_DIR}/augeas/lenses" - COMMAND "${CMAKE_COMMAND}" -E copy "${augeas_lenses_path}/*.aug" "${TEST_CONFIGS_DIR}/augeas/lenses") + if(NOT "${augeas_lenses_path}" STREQUAL "") + add_custom_target(osquery_tables_system_tests_augeaslenses + COMMAND "${CMAKE_COMMAND}" -E make_directory "${TEST_CONFIGS_DIR}/augeas/lenses" + COMMAND "${CMAKE_COMMAND}" -E copy "${augeas_lenses_path}/*.aug" "${TEST_CONFIGS_DIR}/augeas/lenses") - add_dependencies(osquery_tables_system_tests_augeastests-test osquery_tables_system_tests_augeaslenses) - add_dependencies(osquery_tables_system_tests_augeaslenses thirdparty_augeas) + add_dependencies(osquery_tables_system_tests_augeastests-test osquery_tables_system_tests_augeaslenses) + add_dependencies(osquery_tables_system_tests_augeaslenses thirdparty_augeas) + endif() endfunction() -- 2.29.2 From e1ef9bb01faf3e8af129daaf1f5c5393d42d39db Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Wed, 27 Nov 2019 17:37:21 -0800 Subject: [PATCH 10/26] Add gtest library that contains 'main' function definition It is needed to create binaries with tests and void following linking error: $ /usr/bin/c++ -O2 -g -DNDEBUG -Wno-sign-compare -Wl,-z,relro,-z,now -Wl,--build-id=sha1 -lresolv -pthread osquery/utils/caches/tests/CMakeFiles/osquery_utils_caches_tests_lrutests-test.dir/lru.cpp.o -o osquery/utils/caches/tests/osquery_utils_caches_tests_lrutests-test /usr/lib/libgtest.so -lrt -ldl /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/Scrt1.o: in function `_start': (.text+0x24): undefined reference to `main' --- libraries/cmake/system/modules/Findgoogletest.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/cmake/system/modules/Findgoogletest.cmake b/libraries/cmake/system/modules/Findgoogletest.cmake index 2ce20e473..b0bd4296b 100644 --- a/libraries/cmake/system/modules/Findgoogletest.cmake +++ b/libraries/cmake/system/modules/Findgoogletest.cmake @@ -11,7 +11,7 @@ locateSystemLibrary( NAME googletest REQUIRED ${gtest_REQUIRED} MAIN_HEADER "gtest/gtest.h" - LIBRARIES "gtest" + LIBRARIES "gtest" "gtest_main" ) add_library(thirdparty_googletest_headers INTERFACE) -- 2.29.2 From 8a5c9eefc96999cc9a93500a248fea17ac8518a3 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 28 Feb 2020 12:18:16 -0800 Subject: [PATCH 11/26] Recent versions of iptables dropped iptc library. It is expected users depend on ip4tc or ip6tc explicitly if needed. --- libraries/cmake/system/modules/Findlibiptables.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/cmake/system/modules/Findlibiptables.cmake b/libraries/cmake/system/modules/Findlibiptables.cmake index 17cf4047d..462db8907 100644 --- a/libraries/cmake/system/modules/Findlibiptables.cmake +++ b/libraries/cmake/system/modules/Findlibiptables.cmake @@ -11,5 +11,5 @@ locateSystemLibrary( NAME libiptables REQUIRED ${libiptables_REQUIRED} MAIN_HEADER "libipq.h" - LIBRARIES "ip4tc" "ip6tc" "ipq" "iptc" + LIBRARIES "ip4tc" "ip6tc" "ipq" ) -- 2.29.2 From 995781dc4d545c8e62144830f91dce3649b665fe Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 28 Feb 2020 12:21:41 -0800 Subject: [PATCH 12/26] Drop references to libc++ added in 4.2.0 --- cmake/flags.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 446be3740..da582892b 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -75,11 +75,9 @@ function(setupBuildFlags) -Wno-c++11-extensions -Woverloaded-virtual -Wnon-virtual-dtor - -stdlib=libc++ ) set(posix_cxx_link_options - -stdlib=libc++ -ldl ) -- 2.29.2 From 6be21a81be9996a7487a8b45cfdeb1febc68097f Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Mon, 3 Aug 2020 14:06:00 -0700 Subject: [PATCH 13/26] Fix include path for smarttools config dir Signed-off-by: Anatol Pomozov --- osquery/tables/smart/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osquery/tables/smart/CMakeLists.txt b/osquery/tables/smart/CMakeLists.txt index 844cf56c5..1be44fe2d 100644 --- a/osquery/tables/smart/CMakeLists.txt +++ b/osquery/tables/smart/CMakeLists.txt @@ -43,6 +43,8 @@ function(generateOsqueryTablesSmart) generateIncludeNamespace(osquery_tables_smart "osquery/tables/smart" "FILE_ONLY" ${public_header_files}) endif() + include_directories("${PROJECT_SOURCE_DIR}/libraries/cmake/source/smartmontools/config/linux") + if(DEFINED PLATFORM_POSIX) add_test(NAME osquery_tables_smart_tests_smartdrivestests-test COMMAND osquery_tables_smart_tests_smartdrivestests-test) endif() -- 2.29.2 From f3293a4b5c593f47f2e593b73a1fec42b12ad3c2 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 24 Apr 2020 10:52:11 -0700 Subject: [PATCH 14/26] Add CMake module for system icu library Signed-off-by: Anatol Pomozov --- libraries/cmake/system/modules/Findicu.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 libraries/cmake/system/modules/Findicu.cmake diff --git a/libraries/cmake/system/modules/Findicu.cmake b/libraries/cmake/system/modules/Findicu.cmake new file mode 100644 index 000000000..5e9eb2b41 --- /dev/null +++ b/libraries/cmake/system/modules/Findicu.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME icu + REQUIRED ${icu_REQUIRED} + MAIN_HEADER "unicode/utypes.h" + LIBRARIES "icui18n" +) -- 2.29.2 From 9060d53478a75c1e0eaec1b2d6d16d64c4eff361 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Tue, 2 Jun 2020 11:26:51 -0700 Subject: [PATCH 15/26] Add Arch Linux package manager integration Signed-off-by: Anatol Pomozov --- CMakeLists.txt | 1 + libraries/cmake/system/modules/Findalpm.cmake | 19 ++++ osquery/tables/system/CMakeLists.txt | 2 + .../tables/system/linux/pacman_packages.cpp | 94 +++++++++++++++++++ specs/CMakeLists.txt | 1 + specs/linux/pacman_packages.table | 18 ++++ tests/integration/tables/CMakeLists.txt | 1 + tests/integration/tables/pacman_packages.cpp | 59 ++++++++++++ 8 files changed, 195 insertions(+) create mode 100644 libraries/cmake/system/modules/Findalpm.cmake create mode 100644 osquery/tables/system/linux/pacman_packages.cpp create mode 100644 specs/linux/pacman_packages.table create mode 100644 tests/integration/tables/pacman_packages.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e3a6a376b..98d6572f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,7 @@ function(importLibraries) "Linux:libcryptsetup" "Linux:libdevmapper" "Linux:libdpkg" + "Linux:alpm" "Linux:libelfin" "Linux:libgcrypt" "Linux:libgpg-error" diff --git a/libraries/cmake/system/modules/Findalpm.cmake b/libraries/cmake/system/modules/Findalpm.cmake new file mode 100644 index 000000000..dd5947e73 --- /dev/null +++ b/libraries/cmake/system/modules/Findalpm.cmake @@ -0,0 +1,19 @@ +# Copyright (c) 2020-present, Anatol Pomazau. +# All rights reserved. +# +# This source code is licensed in accordance with the terms specified in +# the LICENSE file found in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME alpm + REQUIRED ${alpm_REQUIRED} + MAIN_HEADER "alpm.h" + LIBRARIES "alpm" +) + +target_link_libraries(alpm INTERFACE +) + diff --git a/osquery/tables/system/CMakeLists.txt b/osquery/tables/system/CMakeLists.txt index a6e1aae2c..5b4123460 100644 --- a/osquery/tables/system/CMakeLists.txt +++ b/osquery/tables/system/CMakeLists.txt @@ -73,6 +73,7 @@ function(generateOsqueryTablesSystemSystemtable) linux/mounts.cpp linux/npm_packages.cpp linux/os_version.cpp + linux/pacman_packages.cpp linux/pci_devices.cpp linux/portage.cpp linux/process_open_files.cpp @@ -268,6 +269,7 @@ function(generateOsqueryTablesSystemSystemtable) thirdparty_libelfin thirdparty_libcryptsetup thirdparty_librpm + thirdparty_alpm thirdparty_popt thirdparty_dbus thirdparty_libcap diff --git a/osquery/tables/system/linux/pacman_packages.cpp b/osquery/tables/system/linux/pacman_packages.cpp new file mode 100644 index 000000000..5590046c4 --- /dev/null +++ b/osquery/tables/system/linux/pacman_packages.cpp @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2020-present, Anatol Pomazau. + * All rights reserved. + * + * This source code is licensed in accordance with the terms specified in + * the LICENSE file found in the root directory of this source tree. + */ + +#include + +#include +#include +#include +#include + +namespace osquery { +namespace tables { + +static const std::string kPacmanRoot{"/"}; +static const std::string kPacmanDbPath{"/var/lib/pacman"}; + +const char* pacmanPackageOrigin(alpm_pkgfrom_t origin) { + switch(origin) { + case ALPM_PKG_FROM_FILE: + return "file"; + case ALPM_PKG_FROM_LOCALDB: + return "localdb"; + case ALPM_PKG_FROM_SYNCDB: + return "syncdb"; + default: + return ""; + } +} + +std::string extractText(const char *val) { + std::string ret; + if (val != nullptr) { + ret = TEXT(val); + } + + return ret; +} + +void extractPacmanPackageInfo(alpm_pkg_t* pkg, QueryData& results) { + Row r; + + r["name"] = TEXT(alpm_pkg_get_name(pkg)); + r["version"] = TEXT(alpm_pkg_get_version(pkg)); + r["origin"] = TEXT(pacmanPackageOrigin(alpm_pkg_get_origin(pkg))); + r["url"] = TEXT(alpm_pkg_get_url(pkg)); + r["md5sum"] = extractText(alpm_pkg_get_md5sum(pkg)); + r["sha256sum"] = extractText(alpm_pkg_get_sha256sum(pkg)); + r["arch"] = TEXT(alpm_pkg_get_arch(pkg)); + r["packager"] = TEXT(alpm_pkg_get_packager(pkg)); + r["build_date"] = INTEGER(alpm_pkg_get_builddate(pkg)); + r["install_date"] = INTEGER(alpm_pkg_get_installdate(pkg)); + r["package_size"] = BIGINT(alpm_pkg_get_size(pkg)); + r["install_size"] = BIGINT(alpm_pkg_get_isize(pkg)); + + results.push_back(r); +} + +QueryData genPacmanPackages(QueryContext& context) { + QueryData results; + + if (!osquery::isDirectory(kPacmanDbPath)) { + TLOG << "Cannot find Pacman database: " << kPacmanDbPath; + return results; + } + + auto dropper = DropPrivileges::get(); + dropper->dropTo("nobody"); + + alpm_errno_t err; + alpm_handle_t *handle = alpm_initialize(kPacmanRoot.c_str(), kPacmanDbPath.c_str(), &err); + if (!handle) { + TLOG << "Cannot initialize Pacman ALPM library: " << alpm_strerror(err); + return results; + } + alpm_db_t *db_local = alpm_get_localdb(handle); + if (!db_local) { + TLOG << "Cannot read Pacman local database: " << alpm_strerror(alpm_errno(handle)); + return results; + } + + for (alpm_list_t *j = alpm_db_get_pkgcache(db_local); j; j = alpm_list_next(j)) { + alpm_pkg_t *pkg = (alpm_pkg_t *)j->data; + extractPacmanPackageInfo(pkg, results); + } + + return results; +} +} // namespace tables +} // namespace osquery diff --git a/specs/CMakeLists.txt b/specs/CMakeLists.txt index 2e5cc8d77..18ee7045f 100644 --- a/specs/CMakeLists.txt +++ b/specs/CMakeLists.txt @@ -157,6 +157,7 @@ function(generateNativeTables) "linux/md_devices.table:linux" "linux/process_namespaces.table:linux" "linux/syslog_events.table:linux" + "linux/pacman_packages.table:linux" "linux/rpm_packages.table:linux" "linux/portage_packages.table:linux" "linux/process_file_events.table:linux" diff --git a/specs/linux/pacman_packages.table b/specs/linux/pacman_packages.table new file mode 100644 index 000000000..26677a654 --- /dev/null +++ b/specs/linux/pacman_packages.table @@ -0,0 +1,18 @@ +table_name("pacman_packages") +description("Pacman packages that are currently installed on the host system.") +schema([ + Column("name", TEXT, "Pacman package name", index=True), + Column("version", TEXT, "Package version" ,index=True), + Column("origin", TEXT, "Origin of the package"), + Column("url", TEXT, "URL of the package upstream"), + Column("md5sum", TEXT, "MD5 hash of the package contents"), + Column("sha256sum", TEXT, "SHA256 hash of the package contents"), + Column("arch", TEXT, "Architecture the package built for", index=True), + Column("packager", TEXT, "Packager of the package"), + Column("build_date", INTEGER, "When the package was built"), + Column("install_date", INTEGER, "When the package was installed"), + Column("package_size", BIGINT, "Package size in bytes"), + Column("install_size", BIGINT, "Installed package size in bytes"), +]) +attributes(cacheable=True) +implementation("@genPacmanPackages") diff --git a/tests/integration/tables/CMakeLists.txt b/tests/integration/tables/CMakeLists.txt index 4ff651928..506fbcf1d 100644 --- a/tests/integration/tables/CMakeLists.txt +++ b/tests/integration/tables/CMakeLists.txt @@ -163,6 +163,7 @@ function(generateTestsIntegrationTablesTestsTest) memory_map.cpp msr.cpp npm_packages.cpp + pacman_packages.cpp portage_keywords.cpp portage_packages.cpp portage_use.cpp diff --git a/tests/integration/tables/pacman_packages.cpp b/tests/integration/tables/pacman_packages.cpp new file mode 100644 index 000000000..93eee486f --- /dev/null +++ b/tests/integration/tables/pacman_packages.cpp @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2020-present, Anatol Pomazau. + * All rights reserved. + * + * This source code is licensed in accordance with the terms specified in + * the LICENSE file found in the root directory of this source tree. + */ + +// Sanity check integration test for pacman_packages +// Spec file: specs/linux/pacman_packages.table + +#include + +#include + +namespace osquery { +namespace table_tests { + +class PacmanPackages : public testing::Test { + protected: + void SetUp() override { + setUpEnvironment(); + } +}; + +TEST_F(PacmanPackages, test_sanity) { + QueryData rows = execute_query("select * from pacman_packages"); + if (rows.size() > 0) { + ValidationMap row_map = {{"name", NonEmptyString}, + {"version", NonEmptyString}, + {"origin", NormalType}, + {"url", NormalType}, + {"md5sum", MD5}, + {"sha256sum", SHA256}, + {"arch", NonEmptyString}, + {"packager", NonEmptyString}, + {"build_date", IntType}, + {"install_date", IntType}, + {"package_size", IntType}, + {"install_size", IntType}, + }; + validate_rows(rows, row_map); + + auto all_packages = std::unordered_set{}; + for (const auto& row : rows) { + auto pckg_name = row.at("name"); + all_packages.insert(pckg_name); + } + + ASSERT_EQ(all_packages.count("linux"), 1u); + + } else { + LOG(WARNING) << "Empty results of query from 'pacman_packages', assume there " + "is no linux in the system"; + } +} + +} // namespace table_tests +} // namespace osquery -- 2.29.2 From 65b73014ee41639708bfd1e55560f9a6cf6192e1 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Wed, 16 Sep 2020 10:22:12 -0700 Subject: [PATCH 16/26] Fix compile error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ 22%] Building CXX object osquery/core/CMakeFiles/osquery_core.dir/shutdown.cpp.o /home/anatol/sources/osquery/osquery/core/shutdown.cpp:23:8: error: ‘condition_variable’ in namespace ‘std’ does not name a type 23 | std::condition_variable request_signal; | ^~~~~~~~~~~~~~~~~~ /home/anatol/sources/osquery/osquery/core/shutdown.cpp:14:1: note: ‘std::condition_variable’ is defined in header ‘’; did you forget to ‘#include ’? --- osquery/core/shutdown.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/osquery/core/shutdown.cpp b/osquery/core/shutdown.cpp index f790ac63e..e54ac6d73 100644 --- a/osquery/core/shutdown.cpp +++ b/osquery/core/shutdown.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include -- 2.29.2 From 655ec145cd2f8178e4571c3e6013dd44ba918613 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 16 Oct 2020 18:32:59 -0700 Subject: [PATCH 17/26] Port to the newer AWS SDK API Provided by loqs https://bugs.archlinux.org/task/68275 --- osquery/utils/aws/aws_util.cpp | 25 +++++++++---------------- osquery/utils/aws/aws_util.h | 5 ----- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/osquery/utils/aws/aws_util.cpp b/osquery/utils/aws/aws_util.cpp index 79fe63bde..bd94e414c 100644 --- a/osquery/utils/aws/aws_util.cpp +++ b/osquery/utils/aws/aws_util.cpp @@ -127,7 +127,7 @@ OsqueryHttpClientFactory::CreateHttpRequest( } std::shared_ptr OsqueryHttpClient::MakeRequest( - Aws::Http::HttpRequest& request, + const std::shared_ptr& request, Aws::Utils::RateLimits::RateLimiterInterface* readLimiter, Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter) const { // AWS allows rate limiters to be passed around, but we are doing rate @@ -136,21 +136,21 @@ std::shared_ptr OsqueryHttpClient::MakeRequest( LOG(WARNING) << "Read/write limiters are unsupported"; } - Aws::Http::URI uri = request.GetUri(); + Aws::Http::URI uri = request->GetUri(); uri.SetPath(Aws::Http::URI::URLEncodePath(uri.GetPath())); Aws::String url = uri.GetURIString(); http::Client client(TLSTransport().getInternalOptions()); http::Request req(url); - for (const auto& requestHeader : request.GetHeaders()) { + for (const auto& requestHeader : request->GetHeaders()) { req << http::Request::Header(requestHeader.first, requestHeader.second); } std::string body; - if (request.GetContentBody()) { + if (request->GetContentBody()) { std::stringstream ss; - ss << request.GetContentBody()->rdbuf(); + ss << request->GetContentBody()->rdbuf(); body = ss.str(); } @@ -158,15 +158,15 @@ std::shared_ptr OsqueryHttpClient::MakeRequest( try { http::Response resp; - switch (request.GetMethod()) { + switch (request->GetMethod()) { case Aws::Http::HttpMethod::HTTP_GET: resp = client.get(req); break; case Aws::Http::HttpMethod::HTTP_POST: - resp = client.post(req, body, request.GetContentType()); + resp = client.post(req, body, request->GetContentType()); break; case Aws::Http::HttpMethod::HTTP_PUT: - resp = client.put(req, body, request.GetContentType()); + resp = client.put(req, body, request->GetContentType()); break; case Aws::Http::HttpMethod::HTTP_HEAD: resp = client.head(req); @@ -180,7 +180,7 @@ std::shared_ptr OsqueryHttpClient::MakeRequest( break; default: LOG(ERROR) << "Unrecognized HTTP Method used: " - << static_cast(request.GetMethod()); + << static_cast(request->GetMethod()); return nullptr; break; } @@ -207,13 +207,6 @@ std::shared_ptr OsqueryHttpClient::MakeRequest( return response; } -std::shared_ptr OsqueryHttpClient::MakeRequest( - const std::shared_ptr& request, - Aws::Utils::RateLimits::RateLimiterInterface* readLimiter, - Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter) const { - return MakeRequest(*request, readLimiter, writeLimiter); -} - Aws::Auth::AWSCredentials OsqueryFlagsAWSCredentialsProvider::GetAWSCredentials() { // Note that returning empty credentials means the provider chain will just diff --git a/osquery/utils/aws/aws_util.h b/osquery/utils/aws/aws_util.h index 260bd7de6..7314085af 100644 --- a/osquery/utils/aws/aws_util.h +++ b/osquery/utils/aws/aws_util.h @@ -74,11 +74,6 @@ class OsqueryHttpClient : public Aws::Http::HttpClient { public: OsqueryHttpClient() : HttpClient() {} - std::shared_ptr MakeRequest( - Aws::Http::HttpRequest& request, - Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr, - Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = - nullptr) const override; std::shared_ptr MakeRequest( const std::shared_ptr& request, Aws::Utils::RateLimits::RateLimiterInterface* readLimiter, -- 2.29.2 From 1aadf7c0a7e9aeb91486262388734e0a627949e3 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 16 Oct 2020 18:34:12 -0700 Subject: [PATCH 18/26] Port to boost 1.74 Provided by loqs https://bugs.archlinux.org/task/68275 --- osquery/config/tests/test_utils.cpp | 5 +++++ osquery/database/database.cpp | 5 +++++ osquery/dispatcher/scheduler.cpp | 5 +++++ osquery/experimental/events_stream/events_stream.cpp | 5 +++++ .../experimental/events_stream/events_stream_registry.cpp | 5 +++++ osquery/experimental/tracing/linux/ebpf_tracepoint.cpp | 5 +++++ osquery/numeric_monitoring/numeric_monitoring.cpp | 5 +++++ osquery/numeric_monitoring/pre_aggregation_cache.cpp | 5 +++++ osquery/profiler/posix/code_profiler.cpp | 5 +++++ osquery/sdk/tests/registry_tests.cpp | 5 +++++ osquery/utils/conversions/tryto.cpp | 5 +++++ osquery/utils/error/tests/error.cpp | 5 +++++ osquery/utils/system/linux/cpu.cpp | 5 +++++ osquery/utils/system/linux/ebpf/ebpf.cpp | 5 +++++ osquery/utils/system/linux/ebpf/map.cpp | 5 +++++ osquery/utils/system/linux/ebpf/perf_output_impl.h | 5 +++++ osquery/utils/system/linux/ebpf/program.cpp | 5 +++++ osquery/utils/system/linux/perf_event/perf_event.cpp | 5 +++++ osquery/utils/system/linux/tracing/native_event.cpp | 5 +++++ osquery/utils/versioning/semantic.cpp | 5 +++++ tests/integration/tables/helper.cpp | 5 +++++ tests/integration/tables/process_envs.cpp | 5 +++++ 22 files changed, 110 insertions(+) diff --git a/osquery/config/tests/test_utils.cpp b/osquery/config/tests/test_utils.cpp index ed180dd6a..43fbc588e 100644 --- a/osquery/config/tests/test_utils.cpp +++ b/osquery/config/tests/test_utils.cpp @@ -15,7 +15,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include diff --git a/osquery/database/database.cpp b/osquery/database/database.cpp index 40662b863..945719095 100644 --- a/osquery/database/database.cpp +++ b/osquery/database/database.cpp @@ -8,7 +8,12 @@ */ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/dispatcher/scheduler.cpp b/osquery/dispatcher/scheduler.cpp index 6a7a891cc..eb9b1e3ac 100644 --- a/osquery/dispatcher/scheduler.cpp +++ b/osquery/dispatcher/scheduler.cpp @@ -11,7 +11,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/experimental/events_stream/events_stream.cpp b/osquery/experimental/events_stream/events_stream.cpp index c9c1924ef..c9c936c37 100644 --- a/osquery/experimental/events_stream/events_stream.cpp +++ b/osquery/experimental/events_stream/events_stream.cpp @@ -14,7 +14,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif namespace osquery { diff --git a/osquery/experimental/events_stream/events_stream_registry.cpp b/osquery/experimental/events_stream/events_stream_registry.cpp index 8658953d2..7f4deb634 100644 --- a/osquery/experimental/events_stream/events_stream_registry.cpp +++ b/osquery/experimental/events_stream/events_stream_registry.cpp @@ -9,7 +9,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include diff --git a/osquery/experimental/tracing/linux/ebpf_tracepoint.cpp b/osquery/experimental/tracing/linux/ebpf_tracepoint.cpp index 802a72e5f..1824c27ba 100644 --- a/osquery/experimental/tracing/linux/ebpf_tracepoint.cpp +++ b/osquery/experimental/tracing/linux/ebpf_tracepoint.cpp @@ -14,7 +14,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include diff --git a/osquery/numeric_monitoring/numeric_monitoring.cpp b/osquery/numeric_monitoring/numeric_monitoring.cpp index 735dfd46e..206e1b88c 100644 --- a/osquery/numeric_monitoring/numeric_monitoring.cpp +++ b/osquery/numeric_monitoring/numeric_monitoring.cpp @@ -9,7 +9,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/numeric_monitoring/pre_aggregation_cache.cpp b/osquery/numeric_monitoring/pre_aggregation_cache.cpp index 475b5eaec..06213621a 100644 --- a/osquery/numeric_monitoring/pre_aggregation_cache.cpp +++ b/osquery/numeric_monitoring/pre_aggregation_cache.cpp @@ -7,7 +7,12 @@ * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) */ +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include "osquery/numeric_monitoring/pre_aggregation_cache.h" #include diff --git a/osquery/profiler/posix/code_profiler.cpp b/osquery/profiler/posix/code_profiler.cpp index ea9fe74cd..fb1b306ce 100644 --- a/osquery/profiler/posix/code_profiler.cpp +++ b/osquery/profiler/posix/code_profiler.cpp @@ -22,7 +22,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/sdk/tests/registry_tests.cpp b/osquery/sdk/tests/registry_tests.cpp index bb82a3fff..2b641b73d 100644 --- a/osquery/sdk/tests/registry_tests.cpp +++ b/osquery/sdk/tests/registry_tests.cpp @@ -11,7 +11,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/utils/conversions/tryto.cpp b/osquery/utils/conversions/tryto.cpp index 9b47a3741..6a174b8e9 100644 --- a/osquery/utils/conversions/tryto.cpp +++ b/osquery/utils/conversions/tryto.cpp @@ -11,7 +11,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif namespace osquery { diff --git a/osquery/utils/error/tests/error.cpp b/osquery/utils/error/tests/error.cpp index a94e5d5ae..90aad221a 100644 --- a/osquery/utils/error/tests/error.cpp +++ b/osquery/utils/error/tests/error.cpp @@ -10,7 +10,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include diff --git a/osquery/utils/system/linux/cpu.cpp b/osquery/utils/system/linux/cpu.cpp index 8c0dc2ca5..f43270413 100644 --- a/osquery/utils/system/linux/cpu.cpp +++ b/osquery/utils/system/linux/cpu.cpp @@ -8,7 +8,12 @@ */ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/utils/system/linux/ebpf/ebpf.cpp b/osquery/utils/system/linux/ebpf/ebpf.cpp index ef1598d16..72fbab057 100644 --- a/osquery/utils/system/linux/ebpf/ebpf.cpp +++ b/osquery/utils/system/linux/ebpf/ebpf.cpp @@ -10,7 +10,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/utils/system/linux/ebpf/map.cpp b/osquery/utils/system/linux/ebpf/map.cpp index 5d67f8f45..4397ba816 100644 --- a/osquery/utils/system/linux/ebpf/map.cpp +++ b/osquery/utils/system/linux/ebpf/map.cpp @@ -10,7 +10,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/utils/system/linux/ebpf/perf_output_impl.h b/osquery/utils/system/linux/ebpf/perf_output_impl.h index 4dad8de36..350081945 100644 --- a/osquery/utils/system/linux/ebpf/perf_output_impl.h +++ b/osquery/utils/system/linux/ebpf/perf_output_impl.h @@ -14,7 +14,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/utils/system/linux/ebpf/program.cpp b/osquery/utils/system/linux/ebpf/program.cpp index c0e7db672..b093098d6 100644 --- a/osquery/utils/system/linux/ebpf/program.cpp +++ b/osquery/utils/system/linux/ebpf/program.cpp @@ -10,7 +10,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include diff --git a/osquery/utils/system/linux/perf_event/perf_event.cpp b/osquery/utils/system/linux/perf_event/perf_event.cpp index 26709badf..6c72f3ef3 100644 --- a/osquery/utils/system/linux/perf_event/perf_event.cpp +++ b/osquery/utils/system/linux/perf_event/perf_event.cpp @@ -9,7 +9,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/osquery/utils/system/linux/tracing/native_event.cpp b/osquery/utils/system/linux/tracing/native_event.cpp index 84bff7297..31dc498a0 100644 --- a/osquery/utils/system/linux/tracing/native_event.cpp +++ b/osquery/utils/system/linux/tracing/native_event.cpp @@ -14,7 +14,12 @@ #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include diff --git a/osquery/utils/versioning/semantic.cpp b/osquery/utils/versioning/semantic.cpp index f8daa252c..f3b73161a 100644 --- a/osquery/utils/versioning/semantic.cpp +++ b/osquery/utils/versioning/semantic.cpp @@ -9,7 +9,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif namespace osquery { diff --git a/tests/integration/tables/helper.cpp b/tests/integration/tables/helper.cpp index ecb60b527..f4f9b8697 100644 --- a/tests/integration/tables/helper.cpp +++ b/tests/integration/tables/helper.cpp @@ -20,7 +20,12 @@ #include #include #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include diff --git a/tests/integration/tables/process_envs.cpp b/tests/integration/tables/process_envs.cpp index 4c4eebb7f..b2ea825a3 100644 --- a/tests/integration/tables/process_envs.cpp +++ b/tests/integration/tables/process_envs.cpp @@ -14,7 +14,12 @@ #include +#include +#if BOOST_VERSION >= 107400 +#include +#else #include +#endif #include #include -- 2.29.2 From ab1bf1de789367f09dd7494f4bf15301c43b77e9 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 16 Oct 2020 18:34:35 -0700 Subject: [PATCH 19/26] Port to the newer libc++ Provided by loqs https://bugs.archlinux.org/task/68275 --- osquery/core/shutdown.cpp | 1 + osquery/numeric_monitoring/numeric_monitoring.h | 1 + 2 files changed, 2 insertions(+) diff --git a/osquery/core/shutdown.cpp b/osquery/core/shutdown.cpp index e54ac6d73..78fa5b343 100644 --- a/osquery/core/shutdown.cpp +++ b/osquery/core/shutdown.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace osquery { diff --git a/osquery/numeric_monitoring/numeric_monitoring.h b/osquery/numeric_monitoring/numeric_monitoring.h index e7adf1f14..57d90af75 100644 --- a/osquery/numeric_monitoring/numeric_monitoring.h +++ b/osquery/numeric_monitoring/numeric_monitoring.h @@ -11,6 +11,7 @@ #include #include +#include #include "osquery/utils/conversions/tryto.h" #include -- 2.29.2 From 3d06879c35c5027ab9d56ab8cfc8144964ac5522 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 16 Oct 2020 18:35:03 -0700 Subject: [PATCH 20/26] Port to the newer libc Provided by loqs https://bugs.archlinux.org/task/68275 --- osquery/tables/system/linux/sysctl_utils.cpp | 16 +--------------- osquery/tables/system/posix/sysctl_utils.h | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/osquery/tables/system/linux/sysctl_utils.cpp b/osquery/tables/system/linux/sysctl_utils.cpp index 1ff3e0b00..a0102e75e 100644 --- a/osquery/tables/system/linux/sysctl_utils.cpp +++ b/osquery/tables/system/linux/sysctl_utils.cpp @@ -7,8 +7,6 @@ * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) */ -#include - #include #include @@ -70,20 +68,8 @@ void genControlInfo(int* oid, size_t oid_size, QueryData& results, const std::map& config) { - // Get control size - size_t response_size = CTL_MAX_VALUE; - char response[CTL_MAX_VALUE + 1] = {0}; - if (sysctl(oid, oid_size, response, &response_size, 0, 0) != 0) { - // Cannot request MIB data. - return; - } - // Data is output, but no way to determine type (long, int, string, struct). - Row r; - r["oid"] = stringFromMIB(oid, oid_size); - r["current_value"] = std::string(response); - r["type"] = "string"; - results.push_back(r); + return; } void genAllControls(QueryData& results, diff --git a/osquery/tables/system/posix/sysctl_utils.h b/osquery/tables/system/posix/sysctl_utils.h index e119f8a9e..f2f776307 100644 --- a/osquery/tables/system/posix/sysctl_utils.h +++ b/osquery/tables/system/posix/sysctl_utils.h @@ -9,7 +9,7 @@ #pragma once -#include +#include #include -- 2.29.2 From fb0028766d8e26851ffe7556a01ff7d36fc2516b Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 16 Oct 2020 18:36:54 -0700 Subject: [PATCH 21/26] Revert "libs/smartmontools: Add aarch64 support" This reverts commit ea70cde29d9095f35ad4c97bb013bce6af0681c9. See https://bugs.archlinux.org/task/68275 for more context --- .../cmake/source/smartmontools/CMakeLists.txt | 4 +- .../config/aarch64/linux/config.h | 191 ------------------ .../config/{x86_64 => }/linux/config.h | 0 .../config/{aarch64 => }/linux/svnversion.h | 0 .../config/{x86_64 => }/macos/config.h | 0 .../{x86_64/linux => macos}/svnversion.h | 0 .../config/x86_64/macos/svnversion.h | 1 - 7 files changed, 2 insertions(+), 194 deletions(-) delete mode 100644 libraries/cmake/source/smartmontools/config/aarch64/linux/config.h rename libraries/cmake/source/smartmontools/config/{x86_64 => }/linux/config.h (100%) rename libraries/cmake/source/smartmontools/config/{aarch64 => }/linux/svnversion.h (100%) rename libraries/cmake/source/smartmontools/config/{x86_64 => }/macos/config.h (100%) rename libraries/cmake/source/smartmontools/config/{x86_64/linux => macos}/svnversion.h (100%) delete mode 100644 libraries/cmake/source/smartmontools/config/x86_64/macos/svnversion.h diff --git a/libraries/cmake/source/smartmontools/CMakeLists.txt b/libraries/cmake/source/smartmontools/CMakeLists.txt index 564bec075..ff62f90c0 100644 --- a/libraries/cmake/source/smartmontools/CMakeLists.txt +++ b/libraries/cmake/source/smartmontools/CMakeLists.txt @@ -75,11 +75,11 @@ function(smartmontoolsMain) if(DEFINED PLATFORM_LINUX) target_include_directories(thirdparty_smartmontools PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/config/${TARGET_PROCESSOR}/linux" + "${CMAKE_CURRENT_SOURCE_DIR}/config/linux" ) elseif(DEFINED PLATFORM_MACOS) target_include_directories(thirdparty_smartmontools PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/config/${TARGET_PROCESSOR}/macos" + "${CMAKE_CURRENT_SOURCE_DIR}/config/macos" ) endif() diff --git a/libraries/cmake/source/smartmontools/config/aarch64/linux/config.h b/libraries/cmake/source/smartmontools/config/aarch64/linux/config.h deleted file mode 100644 index 8006823a7..000000000 --- a/libraries/cmake/source/smartmontools/config/aarch64/linux/config.h +++ /dev/null @@ -1,191 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* freebsd ciss header location */ -#define CISS_LOCATION "cissio_freebsd.h" - -/* smartmontools CVS Tag */ -#define CONFIG_H_CVSID "$Id$" - -/* Define to 1 if C++ compiler supports __attribute__((packed)) */ -#define HAVE_ATTR_PACKED 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -#define HAVE_CLOCK_GETTIME 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DDK_NTDDDISK_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DEV_ATA_ATAVAR_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DEV_CISS_CISSIO_H */ - -/* Define to 1 if you have the `ftime' function. */ -#define HAVE_FTIME 1 - -/* Define to 1 if you have the `getopt_long' function. */ -#define HAVE_GETOPT_LONG 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if the system has the type `int64_t'. */ -#define HAVE_INT64_T 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `cap-ng' library (-lcap-ng). */ -/* #undef HAVE_LIBCAP_NG */ - -/* Define to 1 if you have the `selinux' library (-lselinux). */ -/* #undef HAVE_LIBSELINUX */ - -/* Define to 1 if you have the `usb' library (-lusb). */ -/* #undef HAVE_LIBUSB */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_CCISS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_COMPILER_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NTDDDISK_H */ - -/* Define to 1 if you have the `regcomp' function. */ -#define HAVE_REGCOMP 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SELINUX_SELINUX_H */ - -/* Define to 1 if you have the `sigset' function. */ -#define HAVE_SIGSET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strtoull' function. */ -#define HAVE_STRTOULL 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_INTTYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_INT_TYPES_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TWEIO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TWEREG_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TW_OSL_IOCTL_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if the system has the type `uint64_t'. */ -#define HAVE_UINT64_T 1 - -/* Define to 1 if you have the `uname' function. */ -#define HAVE_UNAME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WBEMCLI_H */ - -/* Define to 1 if the `snprintf' function is sane. */ -#define HAVE_WORKING_SNPRINTF 1 - -/* Define to 1 if os_*.cpp still uses the old interface */ -/* #undef OLD_INTERFACE */ - -/* Name of package */ -#define PACKAGE "smartmontools" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "smartmontools-support@listi.jpberlin.de" - -/* smartmontools Home Page */ -#define PACKAGE_HOMEPAGE "http://www.smartmontools.org/" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "smartmontools" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "smartmontools 6.6" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "smartmontools" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "6.6" - -/* smartmontools Build Host */ -#define SMARTMONTOOLS_BUILD_HOST "aarch64-unknown-linux-gnu" - -/* smartmontools Configure Arguments */ -#define SMARTMONTOOLS_CONFIGURE_ARGS "" - -/* smartmontools Release Date */ -#define SMARTMONTOOLS_RELEASE_DATE "2017-11-05" - -/* smartmontools Release Time */ -#define SMARTMONTOOLS_RELEASE_TIME "15:20:58 UTC" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "6.6" - -/* Define to 1 to include NVMe devices in smartd DEVICESCAN. */ -/* #undef WITH_NVME_DEVICESCAN */ - -/* Define to 1 if SELinux support is enabled */ -/* #undef WITH_SELINUX */ - -/* Define to 1 to enable legacy ATA support on Solaris SPARC. */ -/* #undef WITH_SOLARIS_SPARC_ATA */ - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif diff --git a/libraries/cmake/source/smartmontools/config/x86_64/linux/config.h b/libraries/cmake/source/smartmontools/config/linux/config.h similarity index 100% rename from libraries/cmake/source/smartmontools/config/x86_64/linux/config.h rename to libraries/cmake/source/smartmontools/config/linux/config.h diff --git a/libraries/cmake/source/smartmontools/config/aarch64/linux/svnversion.h b/libraries/cmake/source/smartmontools/config/linux/svnversion.h similarity index 100% rename from libraries/cmake/source/smartmontools/config/aarch64/linux/svnversion.h rename to libraries/cmake/source/smartmontools/config/linux/svnversion.h diff --git a/libraries/cmake/source/smartmontools/config/x86_64/macos/config.h b/libraries/cmake/source/smartmontools/config/macos/config.h similarity index 100% rename from libraries/cmake/source/smartmontools/config/x86_64/macos/config.h rename to libraries/cmake/source/smartmontools/config/macos/config.h diff --git a/libraries/cmake/source/smartmontools/config/x86_64/linux/svnversion.h b/libraries/cmake/source/smartmontools/config/macos/svnversion.h similarity index 100% rename from libraries/cmake/source/smartmontools/config/x86_64/linux/svnversion.h rename to libraries/cmake/source/smartmontools/config/macos/svnversion.h diff --git a/libraries/cmake/source/smartmontools/config/x86_64/macos/svnversion.h b/libraries/cmake/source/smartmontools/config/x86_64/macos/svnversion.h deleted file mode 100644 index 7990d054a..000000000 --- a/libraries/cmake/source/smartmontools/config/x86_64/macos/svnversion.h +++ /dev/null @@ -1 +0,0 @@ -/* svnversion.h. Generated by Makefile from Id strings. */ -- 2.29.2 From 71c6a0cc401325695f1303f4f6628b66c8fced8c Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 16 Oct 2020 19:10:31 -0700 Subject: [PATCH 22/26] Add a header needed for YARA flags --- osquery/tables/yara/yara_utils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/osquery/tables/yara/yara_utils.cpp b/osquery/tables/yara/yara_utils.cpp index fe60a9ef2..039cd64f3 100644 --- a/osquery/tables/yara/yara_utils.cpp +++ b/osquery/tables/yara/yara_utils.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include -- 2.29.2 From c7eb11c044bb39bde766e195aaaf8c68365342ec Mon Sep 17 00:00:00 2001 From: loqs Date: Sun, 7 Mar 2021 15:47:02 +0000 Subject: [PATCH 23/26] Add CMake module for system expat library --- libraries/cmake/system/modules/Findexpat.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 libraries/cmake/system/modules/Findexpat.cmake diff --git a/libraries/cmake/system/modules/Findexpat.cmake b/libraries/cmake/system/modules/Findexpat.cmake new file mode 100644 index 000000000..fd5985ef5 --- /dev/null +++ b/libraries/cmake/system/modules/Findexpat.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME expat + REQUIRED ${expat_REQUIRED} + MAIN_HEADER "expat.h" + LIBRARIES "expat" +) -- 2.29.2 From 90f86f7ef7a09a70d742cfc71293effa817d88a5 Mon Sep 17 00:00:00 2001 From: loqs Date: Sun, 7 Mar 2021 15:53:19 +0000 Subject: [PATCH 24/26] Add CMake module for system dbus library Note support should be added to the API for extra include directory. --- libraries/cmake/system/modules/Finddbus.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 libraries/cmake/system/modules/Finddbus.cmake diff --git a/libraries/cmake/system/modules/Finddbus.cmake b/libraries/cmake/system/modules/Finddbus.cmake new file mode 100644 index 000000000..caf701789 --- /dev/null +++ b/libraries/cmake/system/modules/Finddbus.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME dbus + REQUIRED ${dbus_REQUIRED} + MAIN_HEADER "dbus/dbus.h" + LIBRARIES "dbus-1" + HEADER_PATH_SUFFIX_LIST "dbus-1.0" +) +include_directories("/usr/lib/dbus-1.0/include") #TODO add support for this to the API -- 2.29.2 From 522e1e6545053425f0bc4a261968fd2596516d6b Mon Sep 17 00:00:00 2001 From: loqs Date: Sun, 7 Mar 2021 16:23:27 +0000 Subject: [PATCH 25/26] Add CMake module for system libcap library --- libraries/cmake/system/modules/Findlibcap.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 libraries/cmake/system/modules/Findlibcap.cmake diff --git a/libraries/cmake/system/modules/Findlibcap.cmake b/libraries/cmake/system/modules/Findlibcap.cmake new file mode 100644 index 000000000..910ddd8b5 --- /dev/null +++ b/libraries/cmake/system/modules/Findlibcap.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +include("${CMAKE_CURRENT_LIST_DIR}/api.cmake") + +locateSystemLibrary( + NAME libcap + REQUIRED ${cap_REQUIRED} + MAIN_HEADER "sys/capability.h" + LIBRARIES "cap" +) -- 2.29.2 From 31d5656d55256b27db08af40d3efa680470fa844 Mon Sep 17 00:00:00 2001 From: loqs Date: Mon, 8 Mar 2021 23:51:33 +0000 Subject: [PATCH 26/26] Disable lvm2app support lvm 2.03 does not supprt lvm2app. --- libraries/cmake/system/modules/Findlibdevmapper.cmake | 2 +- osquery/tables/system/linux/block_devices.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/cmake/system/modules/Findlibdevmapper.cmake b/libraries/cmake/system/modules/Findlibdevmapper.cmake index 47b5f566a..c464f5c01 100644 --- a/libraries/cmake/system/modules/Findlibdevmapper.cmake +++ b/libraries/cmake/system/modules/Findlibdevmapper.cmake @@ -11,5 +11,5 @@ locateSystemLibrary( NAME libdevmapper REQUIRED ${libdevmapper_REQUIRED} MAIN_HEADER "libdevmapper.h" - LIBRARIES "devmapper" "lvm2app" + LIBRARIES "devmapper" ) diff --git a/osquery/tables/system/linux/block_devices.cpp b/osquery/tables/system/linux/block_devices.cpp index 2eab2902e..ebbc2cf60 100644 --- a/osquery/tables/system/linux/block_devices.cpp +++ b/osquery/tables/system/linux/block_devices.cpp @@ -20,13 +20,13 @@ #include extern "C" { -#include #include } namespace osquery { namespace tables { +#if 0 void populatePVChildren(lvm_t lvm, const std::string& devname, const std::string& pvid, @@ -61,6 +61,7 @@ void populatePVChildren(lvm_t lvm, } lvm_vg_close(vg); } +#endif static void getBlockDevice(struct udev_device* dev, QueryData& results, @@ -124,6 +125,7 @@ static void getBlockDevice(struct udev_device* dev, if (!blkid_probe_lookup_value(pr, "LABEL", &blk_value, nullptr)) { r["label"] = blk_value; } +#if 0 if (boost::algorithm::starts_with(r["type"], "LVM")) { lvm_t lvm = lvm_init(nullptr); if (lvm != nullptr) { @@ -131,6 +133,7 @@ static void getBlockDevice(struct udev_device* dev, lvm_quit(lvm); } } +#endif } blkid_free_probe(pr); } -- 2.29.2