Project 'savoirfairelinux/ring-daemon' was moved to 'savoirfairelinux/jami-daemon'. Please update any links and bookmarks that may still have the old path.
Select Git revision
-
8+3 filename → 8.3 filename be ware → beware {cannot, can not, cant, can't, could not, couldn't} → unable to conpleted → completed file name → filename imcomplete → incomplete informations → information trying to → attempting to wrong password → incorrect password GitLab: jami-client-qt#1730 Change-Id: Ia7757efafd2c06af978db02c65b40b1b77c393f8
8+3 filename → 8.3 filename be ware → beware {cannot, can not, cant, can't, could not, couldn't} → unable to conpleted → completed file name → filename imcomplete → incomplete informations → information trying to → attempting to wrong password → incorrect password GitLab: jami-client-qt#1730 Change-Id: Ia7757efafd2c06af978db02c65b40b1b77c393f8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
To find the state of this project's repository at the time of any of these versions, check out the tags.
ftp_server.cpp 6.37 KiB
/*
* Copyright (C) 2017-2019 Savoir-faire Linux Inc.
*
* Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ftp_server.h"
#include "logger.h"
#include "string_utils.h"
#include "manager.h"
#include <algorithm>
#include <array>
#include <stdexcept>
#include <iterator>
#include <cstdlib> // strtoull
namespace jami {
//==============================================================================
FtpServer::FtpServer(const std::string& account_id,
const std::string& peer_uri)
: Stream()
, accountId_ {account_id}
, peerUri_ {peer_uri}
{}
DRing::DataTransferId
FtpServer::getId() const
{
// Because FtpServer is just the protocol on the top of a stream so the id
// of the stream is the id of out_.
return out_.id;
}
void
FtpServer::close() noexcept
{
closeCurrentFile();
JAMI_WARN() << "[FTP] server closed";
}
bool
FtpServer::startNewFile()
{
// Request filename from client (WARNING: synchrone call!)
DRing::DataTransferInfo info {};
info.accountId = accountId_;
info.peer = peerUri_;
info.displayName = displayName_;
info.totalSize = fileSize_;
info.bytesProgress = 0;
rx_ = 0;
out_ = Manager::instance().dataTransfers->onIncomingFileRequest(info); // we block here until answer from client