Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1From: Jack Baldry <jack.baldry@grafana.com> 2Date: Wed, 16 Nov 2022 22:00:06 -0400 3Subject: [PATCH] Remove system controls table 4 5Relies on <sys/sysctl.h> which is not present in glibc since 2.32. 6 7Signed-off-by: Jack Baldry <jack.baldry@grafana.com> 8--- 9 osquery/tables/system/CMakeLists.txt | 4 -- 10 specs/CMakeLists.txt | 1 - 11 specs/posix/system_controls.table | 21 ------- 12 tests/integration/tables/system_controls.cpp | 61 -------------------- 13 4 files changed, 87 deletions(-) 14 delete mode 100644 specs/posix/system_controls.table 15 delete mode 100644 tests/integration/tables/system_controls.cpp 16 17diff --git a/osquery/tables/system/CMakeLists.txt b/osquery/tables/system/CMakeLists.txt 18--- a/osquery/tables/system/CMakeLists.txt 19+++ b/osquery/tables/system/CMakeLists.txt 20@@ -43,7 +43,6 @@ function(generateOsqueryTablesSystemSystemtable) 21 posix/smbios_utils.cpp 22 posix/sudoers.cpp 23 posix/suid_bin.cpp 24- posix/system_controls.cpp 25 posix/ulimit_info.cpp 26 ) 27 endif() 28@@ -82,7 +81,6 @@ function(generateOsqueryTablesSystemSystemtable) 29 linux/shared_memory.cpp 30 linux/smbios_tables.cpp 31 linux/startup_items.cpp 32- linux/sysctl_utils.cpp 33 linux/system_info.cpp 34 linux/usb_devices.cpp 35 linux/user_groups.cpp 36@@ -156,7 +154,6 @@ function(generateOsqueryTablesSystemSystemtable) 37 darwin/smbios_tables.cpp 38 darwin/smc_keys.cpp 39 darwin/startup_items.cpp 40- darwin/sysctl_utils.cpp 41 darwin/system_extensions.mm 42 darwin/system_info.cpp 43 darwin/time_machine.cpp 44@@ -326,7 +323,6 @@ function(generateOsqueryTablesSystemSystemtable) 45 posix/shell_history.h 46 posix/ssh_keys.h 47 posix/sudoers.h 48- posix/sysctl_utils.h 49 posix/last.h 50 posix/openssl_utils.h 51 posix/authorized_keys.h 52diff --git a/specs/CMakeLists.txt b/specs/CMakeLists.txt 53--- a/specs/CMakeLists.txt 54+++ b/specs/CMakeLists.txt 55@@ -246,7 +246,6 @@ function(generateNativeTables) 56 "posix/socket_events.table:linux,macos" 57 "posix/sudoers.table:linux,macos,freebsd" 58 "posix/suid_bin.table:linux,macos,freebsd" 59- "posix/system_controls.table:linux,macos,freebsd" 60 "posix/ulimit_info.table:linux,macos,freebsd" 61 "posix/usb_devices.table:linux,macos" 62 "posix/user_events.table:linux,macos,freebsd" 63diff --git a/specs/posix/system_controls.table b/specs/posix/system_controls.table 64deleted file mode 100644 65--- a/specs/posix/system_controls.table 66+++ /dev/null 67@@ -1,21 +0,0 @@ 68-table_name("system_controls") 69-description("sysctl names, values, and settings information.") 70-schema([ 71- Column("name", TEXT, "Full sysctl MIB name", index=True), 72- Column("oid", TEXT, "Control MIB", additional=True), 73- Column("subsystem", TEXT, "Subsystem ID, control type", additional=True), 74- Column("current_value", TEXT, "Value of setting"), 75- Column("config_value", TEXT, "The MIB value set in /etc/sysctl.conf"), 76- Column("type", TEXT, "Data type"), 77-]) 78-extended_schema(DARWIN, [ 79- Column("field_name", TEXT, "Specific attribute of opaque type"), 80-]) 81- 82-implementation("system_controls@genSystemControls") 83-fuzz_paths([ 84- "/run/sysctl.d/", 85- "/usr/lib/sysctl.d/", 86- "/lib/sysctl.d/", 87- "/sys" 88-]) 89diff --git a/tests/integration/tables/system_controls.cpp b/tests/integration/tables/system_controls.cpp 90deleted file mode 100644 91--- a/tests/integration/tables/system_controls.cpp 92+++ /dev/null 93@@ -1,61 +0,0 @@ 94-/** 95- * Copyright (c) 2014-present, The osquery authors 96- * 97- * This source code is licensed as defined by the LICENSE file found in the 98- * root directory of this source tree. 99- * 100- * SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) 101- */ 102- 103-// Sanity check integration test for system_controls 104-// Spec file: specs/posix/system_controls.table 105- 106-#include <osquery/tests/integration/tables/helper.h> 107- 108-namespace osquery { 109-namespace table_tests { 110-namespace { 111- 112-class SystemControlsTest : public testing::Test { 113- protected: 114- void SetUp() override { 115- setUpEnvironment(); 116- } 117-}; 118- 119-TEST_F(SystemControlsTest, test_sanity) { 120- auto const rows = execute_query("select * from system_controls"); 121- auto const row_map = ValidationMap{ 122- {"name", NonEmptyString}, 123- {"oid", NormalType}, 124- {"subsystem", 125- SpecificValuesCheck{"", 126- "abi", 127- "debug", 128- "dev", 129- "fs", 130- "fscache", 131- "hw", 132- "kern", 133- "kernel", 134- "machdep", 135- "net", 136- "sunrpc", 137- "user", 138- "vfs", 139- "vm"}}, 140- {"current_value", NormalType}, 141- {"config_value", NormalType}, 142- {"type", 143- SpecificValuesCheck{ 144- "", "node", "int", "string", "quad", "opaque", "struct"}}, 145-#ifdef __APPLE__ 146- {"field_name", NormalType}, 147-#endif 148- }; 149- validate_rows(rows, row_map); 150-} 151- 152-} // namespace 153-} // namespace table_tests 154-} // namespace osquery 155-- 1562.38.1 157