void SftpChannelPrivate::handleChannelFailure() { if (channelState() == CloseRequested) return; if (m_sftpState != SubsystemRequested) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Unexpected SSH_MSG_CHANNEL_FAILURE packet."); } emit initializationFailed(tr("Server could not start SFTP subsystem.")); closeChannel(); }
void SftpChannelPrivate::handleServerVersion() { checkChannelActive(); if (m_sftpState != InitSent) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Unexpected SSH_FXP_VERSION packet."); } #ifdef CREATOR_SSH_DEBUG qDebug("sftp init received"); #endif const quint32 serverVersion = m_incomingPacket.extractServerVersion(); if (serverVersion != ProtocolVersion) { emit initializationFailed(tr("Protocol version mismatch: Expected %1, got %2") .arg(serverVersion).arg(ProtocolVersion)); closeChannel(); } else { m_sftpState = Initialized; emit initialized(); } }
void SecureFileUploader::onConnected() { qDebug() << "SecureUploader: Connected"; qDebug() << "SecureUploader: Creating SFTP channel..."; m_channel = m_connection->createSftpChannel(); if (m_channel) { connect(m_channel.data(), SIGNAL(initialized()), SLOT(onChannelInitialized())); connect(m_channel.data(), SIGNAL(initializationFailed(QString)), SLOT(onChannelError(QString))); connect(m_channel.data(), SIGNAL(finished(QSsh::SftpJobId, QString)), SLOT(onOpfinished(QSsh::SftpJobId, QString))); m_channel->initialize(); } else { qDebug() << "SecureUploader: Error null channel"; } }