XRootD
XrdOucPrivateUtils.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2024-2025 by European Organization for Nuclear Research (CERN)
3 // Author: Cedric Caffy <cedric.caffy@cern.ch>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 
19 
23 #ifndef XROOTD_XRDOUCPRIVATEUTILS_HH
24 #define XROOTD_XRDOUCPRIVATEUTILS_HH
25 
26 #include <regex>
27 #include <string>
28 #include <vector>
29 
33 static inline bool is_subdirectory(const std::string_view dir,
34  const std::string_view subdir)
35 {
36  if (subdir.size() < dir.size())
37  return false;
38 
39  if (subdir.compare(0, dir.size(), dir, 0, dir.size()) != 0)
40  return false;
41 
42  return dir.size() == subdir.size() || subdir[dir.size()] == '/' || dir == "/";
43 }
44 
52 std::string obfuscateAuth(const std::string & input);
53 
54 #endif //XROOTD_XRDOUCPRIVATEUTILS_HH
static bool is_subdirectory(const std::string_view dir, const std::string_view subdir)
std::string obfuscateAuth(const std::string &input)