Commit 72c724a8 authored by Huff, Israel's avatar Huff, Israel

Merge branch 'rsmpbs' of code.ornl.gov:jap/rsm into rsmpbs

parents 35972ea6 5e268181
Pipeline #100473 failed with stages
in 4 minutes and 26 seconds
......@@ -22,7 +22,10 @@ mac_llvm_testing:
-Drsm_ENABLE_TESTS=ON
-Drsm_ENABLE_rsmcore=ON
-Drsm_ENABLE_rsmwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
- ctest --verbose --output-on-failure
-D ExperimentalStart
-D ExperimentalBuild
-D ExperimentalTest
linux_gcc_testing:
tags:
......@@ -42,7 +45,10 @@ linux_gcc_testing:
-Drsm_ENABLE_TESTS=ON
-Drsm_ENABLE_rsmcore=ON
-Drsm_ENABLE_rsmwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
- ctest --verbose --output-on-failure
-D ExperimentalStart
-D ExperimentalBuild
-D ExperimentalTest
linux_analysis:
stage: analysis
......@@ -66,7 +72,12 @@ linux_analysis:
-Drsm_ENABLE_TESTS=ON
-Drsm_ENABLE_rsmcore=ON
-Drsm_ENABLE_rsmwidgets=OFF ..
- ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalMemCheck -D ExperimentalCoverage -D ExperimentalSubmit
- ctest --verbose --output-on-failure
-D ExperimentalStart
-D ExperimentalBuild
-D ExperimentalTest
-D ExperimentalMemCheck
-D ExperimentalCoverage
allow_failure: true
windows_msvc_testing:
......
......@@ -15,4 +15,7 @@ cmake -DBUILD_SHARED_LIBS=OFF ^
-Drsm_ENABLE_rsmcore=ON ^
-Drsm_ENABLE_rsmwidgets=OFF ^
-G "NMake Makefiles" ..
ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
ctest --verbose --output-on-failure ^
-D ExperimentalStart ^
-D ExperimentalBuild ^
-D ExperimentalTest
......@@ -5,7 +5,7 @@
#include <libssh/libssh.h>
#include <libssh/sftp.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <cassert>
#include <sstream>
......@@ -247,7 +247,10 @@ ssize_t SFTPFile::write(QString str)
// success
QString SFTPFile::read(size_t nBytes)
{
char* buf = new char[nBytes + 1];
if (nBytes == 0) return QString();
char* buf = new char[nBytes + 1];
// initialize buff
memset(&buf[0], 0, nBytes);
buf[nBytes] = '\0';
ssize_t nBytesRead = sftp_read(p->file, buf, nBytes);
if (nBytesRead < 0)
......@@ -278,10 +281,9 @@ bool SFTPFile::seek(size_t offset)
return true;
}
// returns < 0 on error
ssize_t SFTPFile::tell()
size_t SFTPFile::tell()
{
ssize_t result = static_cast<ssize_t>(sftp_tell64(p->file));
size_t result = static_cast<size_t>(sftp_tell64(p->file));
return result;
}
......@@ -353,6 +355,9 @@ SFTPAttributes* SFTPDir::next()
retVal->extended_data =
QString(ssh_string_get_char(sftpResult->extended_data));
// release memory
sftp_attributes_free(sftpResult);
return retVal;
}
......@@ -383,7 +388,6 @@ class SessionImpl
if (session != nullptr)
{
ssh_free(session);
ssh_finalize();
}
}
}; // class SessionImpl
......@@ -411,18 +415,16 @@ QString Session::host() const
{
// This may not be necessary
assert_ssh_session(p->session, "host() -- Session is not allocated.");
char* host_name;
char* host_name = nullptr;
QString host;
int rv = ssh_options_get(p->session, SSH_OPTIONS_HOST, &host_name);
if (rv == SSH_OK)
{
QString host = host_name;
delete host_name;
return host;
}
else
{
return QString("");
host = host_name;
}
if (host_name != nullptr) ssh_string_free_char(host_name);
return host;
}
void Session::setLogVerbosity(SessionVerbosity level)
{
......@@ -446,18 +448,15 @@ QString Session::user() const
{
// This may not be necessary
assert_ssh_session(p->session, "user() -- Session is not allocated.");
char* user_name;
char* user_name = nullptr;
QString user;
int rv = ssh_options_get(p->session, SSH_OPTIONS_USER, &user_name);
if (rv == SSH_OK)
{
QString user = user_name;
delete user_name;
return user;
}
else
{
return QString("");
user = user_name;
}
if (user_name != nullptr) ssh_string_free_char(user_name);
return user;
}
void Session::setProxyCommand(QString command)
......@@ -480,6 +479,7 @@ bool Session::connect()
radix_tagged_line("Attempting connection.");
// attempt a connection
int rc = ssh_connect(p->session);
radix_tagged_line("\tConnect return: " << rc);
return (rc == SSH_OK);
}
}
......@@ -499,7 +499,7 @@ bool Session::disconnect()
{
assert_ssh_session(p->session, "disconnect() -- Session is not allocated.");
radix_tagged_line("disconnect()");
if (ssh_is_connected(p->session) != 0)
if (isConnected())
{
radix_tagged_line("Disconnecting session.");
ssh_disconnect(p->session);
......@@ -556,7 +556,7 @@ SessionHostState Session::verifyKnownHost() const
int rc = ssh_get_server_publickey(p->session, &server_public_key);
if (rc < 0)
{
return SessionHostState::ERROR;
return SessionHostState::ERROR_STATE;
}
rc = ssh_get_publickey_hash(server_public_key, SSH_PUBLICKEY_HASH_SHA1, &hash,
......@@ -565,7 +565,7 @@ SessionHostState Session::verifyKnownHost() const
ssh_key_free(server_public_key);
if (rc < 0)
{
return SessionHostState::ERROR;
return SessionHostState::ERROR_STATE;
}
state = ssh_session_is_known_server(p->session);
......@@ -682,7 +682,7 @@ SessionAuthState Session::authenticatePrompts(QStringList responses)
if (err < 0)
{
ssh_disconnect(p->session);
return SessionAuthState::ERROR;
return SessionAuthState::ERROR_STATE;
}
}
// check status
......
......@@ -15,7 +15,7 @@ enum class SessionAuthState
PARTIAL,
INFO,
AGAIN,
ERROR = -1
ERROR_STATE = -1
};
#define SessionAuthMethodUNKNOWN 0x0000u
......@@ -33,7 +33,7 @@ enum class SessionHostState
{ /**
* There had been an error checking the host.
*/
ERROR = -2,
ERROR_STATE = -2,
/**
* The known host file does not exist. The host is thus unknown. File will
......@@ -354,7 +354,7 @@ class RSM_PUBLIC SFTPFile
QString read(size_t nBytes);
bool close();
bool seek(size_t offset);
ssize_t tell();
size_t tell();
}; // class SFTPFile
// ----------------------------------------------------------------------------
......
......@@ -132,7 +132,7 @@ void SessionWorker::verifyKnownHost()
radix_tagged_line("SSH_KNOWN_HOSTS_UNKNOWN: " << qhexa.toStdString());
emit hostUnknown(qhexa);
break;
case SessionHostState::ERROR:
case SessionHostState::ERROR_STATE:
QString message = p->session->getError();
radix_tagged_line("SSH_KNOWN_HOSTS_ERROR: " << message.toStdString());
emit knownHostError(message);
......@@ -163,7 +163,7 @@ void SessionWorker::authenticate()
if (method & SessionAuthMethodPUBLICKEY)
{
SessionAuthState state = p->session->authenticateWithPublicKey();
if (state == SessionAuthState::ERROR)
if (state == SessionAuthState::ERROR_STATE)
{
QString message = p->session->getError();
emit authenticationError(message);
......@@ -207,7 +207,8 @@ void SessionWorker::authenticateWithPassword(QString pswd)
{
radix_tagged_line("Authenticate with password.");
SessionAuthState state = p->session->authenticateWithPassword(pswd);
if (state == SessionAuthState::ERROR)
if (state == SessionAuthState::ERROR_STATE ||
state == SessionAuthState::DENIED)
{
QString message = p->session->getError();
emit authenticationError(message);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment