removed client connection when SSL handshake failed #4313
This commit is contained in:
parent
ad230d46e6
commit
10e6b5ad63
|
@ -62,7 +62,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ArchSocket getSocket() { return m_socket; }
|
ArchSocket getSocket() { return m_socket; }
|
||||||
|
IEventQueue* getEvents() { return m_events; }
|
||||||
virtual bool isSecureReady() { return false; }
|
virtual bool isSecureReady() { return false; }
|
||||||
virtual bool isSecure() { return false; }
|
virtual bool isSecure() { return false; }
|
||||||
virtual UInt32 secureRead(void* buffer, UInt32) { return 0; }
|
virtual UInt32 secureRead(void* buffer, UInt32) { return 0; }
|
||||||
|
@ -76,11 +76,12 @@ protected:
|
||||||
|
|
||||||
Mutex& getMutex() { return m_mutex; }
|
Mutex& getMutex() { return m_mutex; }
|
||||||
|
|
||||||
|
void sendEvent(Event::Type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void sendConnectionFailedEvent(const char*);
|
void sendConnectionFailedEvent(const char*);
|
||||||
void sendEvent(Event::Type);
|
|
||||||
void onConnected();
|
void onConnected();
|
||||||
void onInputShutdown();
|
void onInputShutdown();
|
||||||
void onOutputShutdown();
|
void onOutputShutdown();
|
||||||
|
|
|
@ -308,7 +308,8 @@ SecureSocket::checkResult(int n)
|
||||||
case SSL_ERROR_SSL:
|
case SSL_ERROR_SSL:
|
||||||
// a failure in the SSL library occurred
|
// a failure in the SSL library occurred
|
||||||
LOG((CLOG_DEBUG2 "SSL_ERROR_SSL"));
|
LOG((CLOG_DEBUG2 "SSL_ERROR_SSL"));
|
||||||
throwError("Secure socket SSL error");
|
sendEvent(getEvents()->forIStream().inputShutdown());
|
||||||
|
showError();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -188,6 +188,7 @@ ClientListener::handleUnknownClient(const Event&, void* vclient)
|
||||||
|
|
||||||
// get the real client proxy and install it
|
// get the real client proxy and install it
|
||||||
ClientProxy* client = unknownClient->orphanClientProxy();
|
ClientProxy* client = unknownClient->orphanClientProxy();
|
||||||
|
bool handshakeOk = true;
|
||||||
if (client != NULL) {
|
if (client != NULL) {
|
||||||
// handshake was successful
|
// handshake was successful
|
||||||
m_waitingClients.push_back(client);
|
m_waitingClients.push_back(client);
|
||||||
|
@ -199,12 +200,25 @@ ClientListener::handleUnknownClient(const Event&, void* vclient)
|
||||||
&ClientListener::handleClientDisconnected,
|
&ClientListener::handleClientDisconnected,
|
||||||
client));
|
client));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
handshakeOk = false;
|
||||||
|
}
|
||||||
|
|
||||||
// now finished with unknown client
|
// now finished with unknown client
|
||||||
m_events->removeHandler(m_events->forClientProxyUnknown().success(), client);
|
m_events->removeHandler(m_events->forClientProxyUnknown().success(), client);
|
||||||
m_events->removeHandler(m_events->forClientProxyUnknown().failure(), client);
|
m_events->removeHandler(m_events->forClientProxyUnknown().failure(), client);
|
||||||
m_newClients.erase(unknownClient);
|
m_newClients.erase(unknownClient);
|
||||||
|
PacketStreamFilter* streamFileter = dynamic_cast<PacketStreamFilter*>(unknownClient->getStream());
|
||||||
|
IDataSocket* socket = NULL;
|
||||||
|
if (streamFileter != NULL) {
|
||||||
|
socket = dynamic_cast<IDataSocket*>(streamFileter->getStream());
|
||||||
|
}
|
||||||
|
|
||||||
delete unknownClient;
|
delete unknownClient;
|
||||||
|
|
||||||
|
if (m_useSecureNetwork && !handshakeOk) {
|
||||||
|
deleteSocket(socket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -43,6 +43,9 @@ public:
|
||||||
*/
|
*/
|
||||||
ClientProxy* orphanClientProxy();
|
ClientProxy* orphanClientProxy();
|
||||||
|
|
||||||
|
//! Get the stream
|
||||||
|
synergy::IStream* getStream() { return m_stream; }
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue