Skip to content

FTPClientSession(socket, readWelcomeMessage=false) sets _serverReady=true without reading welcome reply #5413

Description

@micheleselea

Whe we use this constructor

FTPClientSession::FTPClientSession(const StreamSocket& socket,
	bool readWelcomeMessage,
	Poco::UInt16 activeDataPort):
	_pControlSocket(new DialogSocket(socket)),
	_pDataStream(nullptr),
	_host(socket.address().host().toString()),
	_port(socket.address().port()),
	_activeDataPort(activeDataPort),
	_passiveMode(true),
	_fileType(TYPE_BINARY),
	_supports1738(true),
	_serverReady(false),
	_isLoggedIn(false),
	_timeout(DEFAULT_TIMEOUT)
{
	_pControlSocket->setReceiveTimeout(_timeout);
	if (readWelcomeMessage)
	{
		receiveServerReadyReply();
	}
	else
	{
		_serverReady = true;
	}
}

using readWelcomeMessage = false;
we end up setting _serverReady = true without actually read server reply. This cause next receiveServerReadyReply return without reading, I think is wrong here to set _serverReady = true

The only reason to put _serverReady = true is if you think that the message is already read outside the function

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions