///////////////////////////////////////////////////////
| 772 | |
| 773 | //////////////////////////////////////////////////////////// |
| 774 | Sftp::Result Sftp::login(std::string_view name, std::string_view password, const TimeoutWithPredicate& timeout) |
| 775 | { |
| 776 | // Perform login |
| 777 | { |
| 778 | const auto result = m_impl->waitForOperationComplete( |
| 779 | [&] |
| 780 | { |
| 781 | return libssh2_userauth_password_ex(m_impl->ssh2Session.get(), |
| 782 | name.data(), |
| 783 | static_cast<unsigned int>(name.size()), |
| 784 | password.data(), |
| 785 | static_cast<unsigned int>(password.size()), |
| 786 | nullptr); |
| 787 | }, |
| 788 | timeout); |
| 789 | |
| 790 | if (result == LIBSSH2_ERROR_EAGAIN) |
| 791 | return Result(Result::Value::Timeout); |
| 792 | |
| 793 | if (result < 0) |
| 794 | return makeError(m_impl->ssh2Session.get()); |
| 795 | } |
| 796 | |
| 797 | // Initialize SFTP session |
| 798 | return m_impl->initializeSftp(timeout); |
| 799 | } |
| 800 | |
| 801 | |
| 802 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected