mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-04 10:26:40 +00:00
update(engine): remove banned.h
Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
parent
b7cef5bab2
commit
1e38967b18
@ -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)
|
|
@ -16,7 +16,6 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "evttype_index_ruleset.h"
|
#include "evttype_index_ruleset.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ limitations under the License.
|
|||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
#include "evttype_index_ruleset.h"
|
#include "evttype_index_ruleset.h"
|
||||||
|
|
||||||
const std::string falco_engine::s_default_ruleset = "falco-default-ruleset";
|
const std::string falco_engine::s_default_ruleset = "falco-default-ruleset";
|
||||||
|
@ -22,7 +22,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "falco_utils.h"
|
#include "falco_utils.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
#include <re2/re2.h>
|
#include <re2/re2.h>
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
#include "falco_engine.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<const falco_engine> engine,
|
falco_formats::falco_formats(std::shared_ptr<const falco_engine> engine,
|
||||||
bool json_include_output_property,
|
bool json_include_output_property,
|
||||||
|
@ -22,7 +22,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "falco_common.h"
|
#include "falco_common.h"
|
||||||
#include "json_evt.h"
|
#include "json_evt.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -30,7 +30,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
falco_configuration::falco_configuration():
|
falco_configuration::falco_configuration():
|
||||||
m_json_output(false),
|
m_json_output(false),
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "event_drops.h"
|
#include "event_drops.h"
|
||||||
#include "falco_common.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():
|
syscall_evt_drop_mgr::syscall_evt_drop_mgr():
|
||||||
m_num_syscall_evt_drops(0),
|
m_num_syscall_evt_drops(0),
|
||||||
|
@ -22,7 +22,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "logger.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)
|
static void display_fatal_err(const std::string &&msg)
|
||||||
{
|
{
|
||||||
|
@ -35,8 +35,6 @@ limitations under the License.
|
|||||||
#include "outputs_grpc.h"
|
#include "outputs_grpc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
static const char* s_internal_source = "internal";
|
static const char* s_internal_source = "internal";
|
||||||
|
|
||||||
falco_outputs::falco_outputs(
|
falco_outputs::falco_outputs(
|
||||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "grpc_context.h"
|
#include "grpc_context.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
falco::grpc::context::context(::grpc::ServerContext* ctx):
|
falco::grpc::context::context(::grpc::ServerContext* ctx):
|
||||||
m_ctx(ctx)
|
m_ctx(ctx)
|
||||||
|
@ -25,7 +25,6 @@ limitations under the License.
|
|||||||
#include "grpc_server.h"
|
#include "grpc_server.h"
|
||||||
#include "grpc_request_context.h"
|
#include "grpc_request_context.h"
|
||||||
#include "falco_utils.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) \
|
#define REGISTER_STREAM(req, res, svc, rpc, impl, num) \
|
||||||
std::vector<request_stream_context<svc, req, res>> rpc##_contexts(num); \
|
std::vector<request_stream_context<svc, req, res>> rpc##_contexts(num); \
|
||||||
|
@ -21,7 +21,6 @@ limitations under the License.
|
|||||||
#include "grpc_server_impl.h"
|
#include "grpc_server_impl.h"
|
||||||
#include "grpc_queue.h"
|
#include "grpc_queue.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
bool falco::grpc::server_impl::is_running()
|
bool falco::grpc::server_impl::is_running()
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
|||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#include "falco_common.h"
|
#include "falco_common.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
int falco_logger::level = LOG_INFO;
|
int falco_logger::level = LOG_INFO;
|
||||||
bool falco_logger::time_format_iso_8601 = false;
|
bool falco_logger::time_format_iso_8601 = false;
|
||||||
|
@ -18,7 +18,6 @@ limitations under the License.
|
|||||||
#include "outputs_file.h"
|
#include "outputs_file.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
void falco::outputs::output_file::open_file()
|
void falco::outputs::output_file::open_file()
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,6 @@ limitations under the License.
|
|||||||
#include "grpc_queue.h"
|
#include "grpc_queue.h"
|
||||||
#include "falco_common.h"
|
#include "falco_common.h"
|
||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
#if __has_attribute(deprecated)
|
#if __has_attribute(deprecated)
|
||||||
#define DISABLE_WARNING_PUSH _Pragma("GCC diagnostic push")
|
#define DISABLE_WARNING_PUSH _Pragma("GCC diagnostic push")
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "outputs_http.h"
|
#include "outputs_http.h"
|
||||||
#include "logger.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
|
#define CHECK_RES(fn) res = res == CURLE_OK ? fn : res
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "outputs_program.h"
|
#include "outputs_program.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
void falco::outputs::output_program::open_pfile()
|
void falco::outputs::output_program::open_pfile()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "outputs_stdout.h"
|
#include "outputs_stdout.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
void falco::outputs::output_stdout::output(const message *msg)
|
void falco::outputs::output_stdout::output(const message *msg)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "outputs_syslog.h"
|
#include "outputs_syslog.h"
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
|
|
||||||
void falco::outputs::output_syslog::output(const message *msg)
|
void falco::outputs::output_syslog::output(const message *msg)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,6 @@ limitations under the License.
|
|||||||
#include "falco_common.h"
|
#include "falco_common.h"
|
||||||
#include "stats_writer.h"
|
#include "stats_writer.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
|
||||||
#include "config_falco.h"
|
#include "config_falco.h"
|
||||||
|
|
||||||
// note: ticker_t is an uint16_t, which is enough because we don't care about
|
// note: ticker_t is an uint16_t, which is enough because we don't care about
|
||||||
|
Loading…
Reference in New Issue
Block a user