blocxx
|
Enumerations | |
enum | ESecurity { E_INSECURE, E_SECURE_DIR, E_SECURE_FILE } |
Functions | |
BLOCXX_COMMON_API String | realPath (const String &path) |
BLOCXX_COMMON_API std::pair < ESecurity, String > | security (String const &path, UserId uid) |
BLOCXX_COMMON_API std::pair < ESecurity, String > | security (String const &path) |
Equivalent to security (path, uid), where uid is the effective user ID of the process. | |
BLOCXX_COMMON_API std::pair < ESecurity, String > | security (String const &base_dir, String const &rel_path, UserId uid) |
A variant of security() that is more efficient if some ancestor directory of the path is already known to be secure and in canonical form. | |
BLOCXX_COMMON_API std::pair < ESecurity, String > | security (String const &base_dir, String const &rel_path) |
Equivalent to security (base_dir, rel_path, uid), where uid is the effective user ID of the process. | |
BLOCXX_COMMON_API String | dirname (const String &filename) |
Take a string that contains a pathname, and return a string that is a pathname of the parent directory of that file. | |
BLOCXX_COMMON_API String | basename (const String &filename) |
Take a string that contains a pathname, and return a string that is the filename with the path removed. | |
BLOCXX_COMMON_API String | getCurrentWorkingDirectory () |
Get the process's current working directory. |
Definition at line 341 of file FileSystem.hpp.
Take a string that contains a pathname, and return a string that is the filename with the path removed.
filename | The file pathname |
Definition at line 1171 of file PosixFileSystem.cpp.
References BLOCXX_FILENAME_SEPARATOR, BLOCXX_FILENAME_SEPARATOR_C, BLOCXX_NAMESPACE::FileSystem::g_fileSystemMockObject, BLOCXX_NAMESPACE::String::lastIndexOf(), BLOCXX_NAMESPACE::String::length(), BLOCXX_NAMESPACE::String::npos, and BLOCXX_NAMESPACE::String::substring().
Take a string that contains a pathname, and return a string that is a pathname of the parent directory of that file.
Trailing '/' characters in the path are not counted as part of the path. If path does not contain a '/', then dirname() shall return the string ".". If path an empty string, dirname() shall return the string ".".
filename | The file pathname |
Definition at line 1132 of file PosixFileSystem.cpp.
References BLOCXX_FILENAME_SEPARATOR, BLOCXX_FILENAME_SEPARATOR_C, BLOCXX_NAMESPACE::FileSystem::g_fileSystemMockObject, BLOCXX_NAMESPACE::String::lastIndexOf(), BLOCXX_NAMESPACE::String::length(), BLOCXX_NAMESPACE::String::npos, and BLOCXX_NAMESPACE::String::substring().
String BLOCXX_NAMESPACE::FileSystem::Path::getCurrentWorkingDirectory | ( | ) |
Get the process's current working directory.
Calls to chdir() or fchdir() will modify this. Multi-threaded applications must exercise caution changing the current working directory.
FileSystemException,: | ENOENT-The current working directory has been unlinked. |
Definition at line 1209 of file PosixFileSystem.cpp.
References BLOCXX_THROW_ERRNO, BLOCXX_NAMESPACE::FileSystem::g_fileSystemMockObject, and MAXPATHLEN.
Referenced by realPath().
If path is relative, it will be interpreted relative to the current working directory. This function is similar to the SuSv3 function, however it's easier to use and thread safe.
path | The path to canonicalize. |
FileSystemException | EACCESS, EIO, ELOOP, ENOENT, ENOTDIR |
Definition at line 1080 of file PosixFileSystem.cpp.
References BLOCXX_THROW, BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::FileSystem::g_fileSystemMockObject, getCurrentWorkingDirectory(), security(), and BLOCXX_NAMESPACE::String::startsWith().
Referenced by BLOCXX_NAMESPACE::FileSystem::readSymbolicLink().
std::pair< ESecurity, String > BLOCXX_NAMESPACE::FileSystem::Path::security | ( | String const & | base_dir, |
String const & | rel_path | ||
) |
Equivalent to security
(base_dir, rel_path, uid), where uid is the effective user ID of the process.
Definition at line 544 of file PathSecurity.cpp.
References security().
std::pair< ESecurity, String > BLOCXX_NAMESPACE::FileSystem::Path::security | ( | String const & | path, |
UserId | uid | ||
) |
realpath
(path).root
or user uid can change the contents of this directory or make path refer to some other file or directory, then sec = E_SECURE_DIR
.root
or user uid can change the contents of this file or make path refer to some other file or directory, then sec = E_SECURE_FILE
.root
or user uid can change what path refers to, or change the contents of the file or directory it refers to, then sec = E_INSECURE
.root
or user uid while the function executes.FileSystemException | EACCESS, EIO, ELOOP, ENOENT, ENOTDIR |
Definition at line 524 of file PathSecurity.cpp.
Referenced by realPath(), and security().
Equivalent to security
(path, uid), where uid is the effective user ID of the process.
Definition at line 538 of file PathSecurity.cpp.
std::pair< ESecurity, String > BLOCXX_NAMESPACE::FileSystem::Path::security | ( | String const & | base_dir, |
String const & | rel_path, | ||
UserId | uid | ||
) |
A variant of security()
that is more efficient if some ancestor directory of the path is already known to be secure and in canonical form.
realPath()
, and rel_path is a relative path.security
(path, uid), where path is the catenation of base_dir, "/", and rel_path, under the assumption that base_dir is a secure directory. Definition at line 531 of file PathSecurity.cpp.
References BLOCXX_NAMESPACE::String::c_str().