diff --git a/userspace/engine/banned.h b/userspace/engine/banned.h deleted file mode 100644 index 31ee57a8..00000000 --- a/userspace/engine/banned.h +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -/* -Copyright (C) 2023 The Falco Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#pragma once - -// BAN macro defines `function` as an invalid token that says using -// the function is banned. This throws a compile time error when the -// function is used. -#define BAN(function) using_##function##_is_banned - -// BAN_ALTERNATIVE is same as BAN but the message also provides an alternative -// function that the user could use instead of the banned function. -#define BAN_ALTERNATIVE(function, alternative) using_##function##_is_banned__use_##alternative##_instead - -#undef strcpy -#define strcpy(a, b) BAN(strcpy) - -#undef vsprintf -#define vsprintf(a, b, c) BAN_ALTERNATIVE(vsprintf, vsnprintf) - -#undef sprintf -#define sprintf(a, b, ...) BAN_ALTERNATIVE(sprintf, snprintf) - -#undef strcat -#define strcat(a, b) BAN(strcat) - -#undef strncpy -#define strncpy(a, b, c) BAN(strncpy) - -#undef swprintf -#define swprintf(a, b, c, ...) BAN_ALTERNATIVE(swprintf, snprintf) - -#undef vswprintf -#define vswprintf(a, b, c, d) BAN_ALTERNATIVE(vswprintf, vsnprintf) diff --git a/userspace/engine/evttype_index_ruleset.cpp b/userspace/engine/evttype_index_ruleset.cpp index 4a431197..c67ea08e 100644 --- a/userspace/engine/evttype_index_ruleset.cpp +++ b/userspace/engine/evttype_index_ruleset.cpp @@ -16,7 +16,6 @@ limitations under the License. */ #include "evttype_index_ruleset.h" -#include "banned.h" // This raises a compilation error when certain functions are used #include diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index 422d8664..2c5e5df7 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -44,7 +44,6 @@ limitations under the License. #include "formats.h" #include "utils.h" -#include "banned.h" // This raises a compilation error when certain functions are used #include "evttype_index_ruleset.h" const std::string falco_engine::s_default_ruleset = "falco-default-ruleset"; diff --git a/userspace/engine/falco_utils.cpp b/userspace/engine/falco_utils.cpp index 90effe14..a52cf591 100644 --- a/userspace/engine/falco_utils.cpp +++ b/userspace/engine/falco_utils.cpp @@ -22,7 +22,6 @@ limitations under the License. #include "falco_utils.h" #include "utils.h" -#include "banned.h" // This raises a compilation error when certain functions are used #include diff --git a/userspace/engine/formats.cpp b/userspace/engine/formats.cpp index 90877f60..106a58b7 100644 --- a/userspace/engine/formats.cpp +++ b/userspace/engine/formats.cpp @@ -19,7 +19,6 @@ limitations under the License. #include "formats.h" #include "falco_engine.h" -#include "banned.h" // This raises a compilation error when certain functions are used falco_formats::falco_formats(std::shared_ptr engine, bool json_include_output_property, diff --git a/userspace/engine/json_evt.cpp b/userspace/engine/json_evt.cpp index 9a5b8433..4a48b80c 100644 --- a/userspace/engine/json_evt.cpp +++ b/userspace/engine/json_evt.cpp @@ -22,7 +22,6 @@ limitations under the License. #include "falco_common.h" #include "json_evt.h" -#include "banned.h" // This raises a compilation error when certain functions are used using json = nlohmann::json; using namespace std; diff --git a/userspace/falco/configuration.cpp b/userspace/falco/configuration.cpp index 62c8084f..365ebf78 100644 --- a/userspace/falco/configuration.cpp +++ b/userspace/falco/configuration.cpp @@ -30,7 +30,6 @@ limitations under the License. #include "configuration.h" #include "logger.h" -#include "banned.h" // This raises a compilation error when certain functions are used falco_configuration::falco_configuration(): m_json_output(false), diff --git a/userspace/falco/event_drops.cpp b/userspace/falco/event_drops.cpp index 07509050..7d66156f 100644 --- a/userspace/falco/event_drops.cpp +++ b/userspace/falco/event_drops.cpp @@ -17,7 +17,6 @@ limitations under the License. #include "event_drops.h" #include "falco_common.h" -#include "banned.h" // This raises a compilation error when certain functions are used syscall_evt_drop_mgr::syscall_evt_drop_mgr(): m_num_syscall_evt_drops(0), diff --git a/userspace/falco/falco.cpp b/userspace/falco/falco.cpp index c12040ee..f966c0f1 100644 --- a/userspace/falco/falco.cpp +++ b/userspace/falco/falco.cpp @@ -22,7 +22,6 @@ limitations under the License. #include "app/app.h" #include "logger.h" -#include "banned.h" // This raises a compilation error when certain functions are used static void display_fatal_err(const std::string &&msg) { diff --git a/userspace/falco/falco_outputs.cpp b/userspace/falco/falco_outputs.cpp index c14efcc6..f50f06b4 100644 --- a/userspace/falco/falco_outputs.cpp +++ b/userspace/falco/falco_outputs.cpp @@ -35,8 +35,6 @@ limitations under the License. #include "outputs_grpc.h" #endif -#include "banned.h" // This raises a compilation error when certain functions are used - static const char* s_internal_source = "internal"; falco_outputs::falco_outputs( diff --git a/userspace/falco/grpc_context.cpp b/userspace/falco/grpc_context.cpp index 0709274a..dc098916 100644 --- a/userspace/falco/grpc_context.cpp +++ b/userspace/falco/grpc_context.cpp @@ -18,7 +18,6 @@ limitations under the License. #include #include "grpc_context.h" -#include "banned.h" // This raises a compilation error when certain functions are used falco::grpc::context::context(::grpc::ServerContext* ctx): m_ctx(ctx) diff --git a/userspace/falco/grpc_server.cpp b/userspace/falco/grpc_server.cpp index a62dc487..8e511b46 100644 --- a/userspace/falco/grpc_server.cpp +++ b/userspace/falco/grpc_server.cpp @@ -25,7 +25,6 @@ limitations under the License. #include "grpc_server.h" #include "grpc_request_context.h" #include "falco_utils.h" -#include "banned.h" // This raises a compilation error when certain functions are used #define REGISTER_STREAM(req, res, svc, rpc, impl, num) \ std::vector> rpc##_contexts(num); \ diff --git a/userspace/falco/grpc_server_impl.cpp b/userspace/falco/grpc_server_impl.cpp index ee03e95f..8f03be28 100644 --- a/userspace/falco/grpc_server_impl.cpp +++ b/userspace/falco/grpc_server_impl.cpp @@ -21,7 +21,6 @@ limitations under the License. #include "grpc_server_impl.h" #include "grpc_queue.h" #include "logger.h" -#include "banned.h" // This raises a compilation error when certain functions are used bool falco::grpc::server_impl::is_running() { diff --git a/userspace/falco/logger.cpp b/userspace/falco/logger.cpp index 48ffd601..1b99f6e0 100644 --- a/userspace/falco/logger.cpp +++ b/userspace/falco/logger.cpp @@ -19,7 +19,6 @@ limitations under the License. #include "logger.h" #include "falco_common.h" -#include "banned.h" // This raises a compilation error when certain functions are used int falco_logger::level = LOG_INFO; bool falco_logger::time_format_iso_8601 = false; diff --git a/userspace/falco/outputs_file.cpp b/userspace/falco/outputs_file.cpp index c6131a33..40a043d5 100644 --- a/userspace/falco/outputs_file.cpp +++ b/userspace/falco/outputs_file.cpp @@ -18,7 +18,6 @@ limitations under the License. #include "outputs_file.h" #include #include -#include "banned.h" // This raises a compilation error when certain functions are used void falco::outputs::output_file::open_file() { diff --git a/userspace/falco/outputs_grpc.cpp b/userspace/falco/outputs_grpc.cpp index 5ffb80b1..13da0d3f 100644 --- a/userspace/falco/outputs_grpc.cpp +++ b/userspace/falco/outputs_grpc.cpp @@ -20,7 +20,6 @@ limitations under the License. #include "grpc_queue.h" #include "falco_common.h" #include "formats.h" -#include "banned.h" // This raises a compilation error when certain functions are used #if __has_attribute(deprecated) #define DISABLE_WARNING_PUSH _Pragma("GCC diagnostic push") diff --git a/userspace/falco/outputs_http.cpp b/userspace/falco/outputs_http.cpp index e735b235..e038008b 100644 --- a/userspace/falco/outputs_http.cpp +++ b/userspace/falco/outputs_http.cpp @@ -17,7 +17,6 @@ limitations under the License. #include "outputs_http.h" #include "logger.h" -#include "banned.h" // This raises a compilation error when certain functions are used #define CHECK_RES(fn) res = res == CURLE_OK ? fn : res diff --git a/userspace/falco/outputs_program.cpp b/userspace/falco/outputs_program.cpp index cc7f44c9..e87bac11 100644 --- a/userspace/falco/outputs_program.cpp +++ b/userspace/falco/outputs_program.cpp @@ -17,7 +17,6 @@ limitations under the License. #include "outputs_program.h" #include -#include "banned.h" // This raises a compilation error when certain functions are used void falco::outputs::output_program::open_pfile() { diff --git a/userspace/falco/outputs_stdout.cpp b/userspace/falco/outputs_stdout.cpp index 9eb8e957..e63610b8 100644 --- a/userspace/falco/outputs_stdout.cpp +++ b/userspace/falco/outputs_stdout.cpp @@ -17,7 +17,6 @@ limitations under the License. #include "outputs_stdout.h" #include -#include "banned.h" // This raises a compilation error when certain functions are used void falco::outputs::output_stdout::output(const message *msg) { diff --git a/userspace/falco/outputs_syslog.cpp b/userspace/falco/outputs_syslog.cpp index 99578d3e..3637b2f9 100644 --- a/userspace/falco/outputs_syslog.cpp +++ b/userspace/falco/outputs_syslog.cpp @@ -17,7 +17,6 @@ limitations under the License. #include "outputs_syslog.h" #include -#include "banned.h" // This raises a compilation error when certain functions are used void falco::outputs::output_syslog::output(const message *msg) { diff --git a/userspace/falco/stats_writer.cpp b/userspace/falco/stats_writer.cpp index 5748690e..f085d98d 100644 --- a/userspace/falco/stats_writer.cpp +++ b/userspace/falco/stats_writer.cpp @@ -26,7 +26,6 @@ limitations under the License. #include "falco_common.h" #include "stats_writer.h" #include "logger.h" -#include "banned.h" // This raises a compilation error when certain functions are used #include "config_falco.h" // note: ticker_t is an uint16_t, which is enough because we don't care about