Skip to content

Commit

Permalink
fix(libsinsp): set glob_match to be case insensitve by default
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo authored and poiana committed Jan 18, 2024
1 parent 2c1ef6c commit 1c644a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions userspace/libsinsp/container_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const sinsp_container_info::container_mount_info *sinsp_container_info::mount_by
// note: linear search
for (auto &mntinfo :m_mounts)
{
if(sinsp_utils::glob_match(source.c_str(), mntinfo.m_source.c_str(), false))
if(sinsp_utils::glob_match(source.c_str(), mntinfo.m_source.c_str()))
{
return &mntinfo;
}
Expand All @@ -139,7 +139,7 @@ const sinsp_container_info::container_mount_info *sinsp_container_info::mount_by
// note: linear search
for (auto &mntinfo :m_mounts)
{
if(sinsp_utils::glob_match(dest.c_str(), mntinfo.m_dest.c_str(), false))
if(sinsp_utils::glob_match(dest.c_str(), mntinfo.m_dest.c_str()))
{
return &mntinfo;
}
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/sinsp_filtercheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool flt_compare_string(cmpop op, char* operand1, char* operand2)
case CO_ENDSWITH:
return (sinsp_utils::endswith(operand1, operand2));
case CO_GLOB:
return sinsp_utils::glob_match(operand2, operand1, false);
return sinsp_utils::glob_match(operand2, operand1);
case CO_IGLOB:
return sinsp_utils::glob_match(operand2, operand1, true);
case CO_LT:
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class sinsp_utils

static uint64_t get_current_time_ns();

static bool glob_match(const char *pattern, const char *string, const bool& case_insensitive);
static bool glob_match(const char *pattern, const char *string, const bool& case_insensitive = false);

#ifndef _WIN32
//
Expand Down

0 comments on commit 1c644a4

Please sign in to comment.