#include <inputHandlerLibssh.h>
Definition at line 14 of file inputHandlerLibssh.h.
◆ libssh()
inputHandler::libssh::libssh |
( |
| ) |
|
◆ ~libssh()
inputHandler::libssh::~libssh |
( |
| ) |
|
|
overridedefault |
◆ getDirectory()
std::unique_ptr< base::Directory > inputHandler::libssh::getDirectory |
( |
const std::string & |
path | ) |
|
|
overridevirtual |
◆ newReader()
get a reader for the file at path
- Returns
- unique ptr to a file reader.
- Exceptions
-
std::system_error | if file can't be opened File will be closed when the pointer goes out of scope. |
- Parameters
-
[in] | path | [in] path to the file to be opened for reading |
[in,out] | state | [in,out] state may be set to vanished if the file does not exist |
[in] | inititalStat | [in] genericStat data of the file encountered before reading, needed for checking unchangedness at the end |
Implements inputHandler::base.
Definition at line 24 of file inputHandlerLibssh.cpp.
27 return std::unique_ptr<base::reader>(
new readerLibssh(aPath,
◆ readLinkTarget()
bool inputHandler::libssh::readLinkTarget |
( |
const std::string & |
, |
|
|
std::vector< char > & |
|
|
) |
| |
|
overridevirtual |
read link target from a symlink
- Parameters
-
[in] | path | is the path to the link |
[in,out] | target | is a vector that the link target gets written into, must be large enough |
- Returns
- true if link could be read, false if the link does not exist
- Exceptions
-
std::system_error | if the link could not be read |
std::runtime_error | if the target size is larger than target.size() |
Reimplemented from inputHandler::base.
Definition at line 34 of file inputHandlerLibssh.cpp.
36 auto targetString = sftp_readlink(
sftp, path.c_str());
37 if (targetString ==
nullptr && sftp_get_error(
sftp) == SSH_FX_NO_SUCH_FILE) {
41 auto linklength = strlen(targetString);
42 if (linklength >= target.size()) {
43 ssh_string_free_char(targetString);
44 throw std::runtime_error(
"link size increased after stat for " + path);
46 for (
auto c = targetString; *c; c++) {
47 target.at(c - targetString) = *c;
49 ssh_string_free_char(targetString);
50 target[linklength] =
'\0';
References throwcall::sftp::badval(), and libsshCommon::sftp.
◆ factory
The documentation for this class was generated from the following files: