OmniSciDB  a667adc9c8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ddl_utils::FilePathBlacklist Class Reference

#include <DdlUtils.h>

Static Public Member Functions

static void addToBlacklist (const std::string &path)
 
static bool isBlacklistedPath (const std::string &path)
 
static void clear ()
 

Static Private Attributes

static std::vector< std::string > blacklisted_paths_ {}
 

Detailed Description

Definition at line 97 of file DdlUtils.h.

Member Function Documentation

void ddl_utils::FilePathBlacklist::addToBlacklist ( const std::string &  path)
static

Definition at line 708 of file DdlUtils.cpp.

References blacklisted_paths_, and CHECK.

Referenced by anonymous_namespace{CommandLineOptions.cpp}::addOptionalFileToBlacklist(), and CommandLineOptions::validate().

708  {
709  CHECK(!path.empty());
710  blacklisted_paths_.emplace_back(path);
711 }
#define CHECK(condition)
Definition: Logger.h:197
static std::vector< std::string > blacklisted_paths_
Definition: DdlUtils.h:104

+ Here is the caller graph for this function:

void ddl_utils::FilePathBlacklist::clear ( )
static

Definition at line 735 of file DdlUtils.cpp.

References blacklisted_paths_.

735  {
736  blacklisted_paths_.clear();
737 }
static std::vector< std::string > blacklisted_paths_
Definition: DdlUtils.h:104
bool ddl_utils::FilePathBlacklist::isBlacklistedPath ( const std::string &  path)
static

boost::filesystem::canonical throws an exception if provided path does not exist. This may happen for use cases like license path where the path may not necessarily contain a file. Fallback to boost::filesystem::absolute in this case.

Definition at line 713 of file DdlUtils.cpp.

References blacklisted_paths_.

Referenced by ddl_utils::validate_allowed_file_path().

713  {
714  const auto canonical_path = boost::filesystem::canonical(path).string();
715  for (const auto& blacklisted_path : blacklisted_paths_) {
716  std::string full_path;
717  try {
718  full_path = boost::filesystem::canonical(blacklisted_path).string();
719  } catch (...) {
726  full_path = boost::filesystem::absolute(blacklisted_path).string();
727  }
728  if (boost::istarts_with(canonical_path, full_path)) {
729  return true;
730  }
731  }
732  return false;
733 }
static std::vector< std::string > blacklisted_paths_
Definition: DdlUtils.h:104

+ Here is the caller graph for this function:

Member Data Documentation

std::vector< std::string > ddl_utils::FilePathBlacklist::blacklisted_paths_ {}
staticprivate

Definition at line 104 of file DdlUtils.h.

Referenced by addToBlacklist(), clear(), and isBlacklistedPath().


The documentation for this class was generated from the following files: