aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-10-11 07:52:50 +0200
committerPierre Ossman <ossman@cendio.se>2018-11-09 17:16:04 +0100
commit4bba2467fbd9279b71d962c10399e9a35c9a05ec (patch)
tree8abb17ad8ba9f43d8ef17bf5418ac47223914195
parentf858682c36cbae39f056a51c0e025826a77e9cbc (diff)
downloadtigervnc-4bba2467fbd9279b71d962c10399e9a35c9a05ec.tar.gz
tigervnc-4bba2467fbd9279b71d962c10399e9a35c9a05ec.zip
Remove writeConnFailedFromScratch()
It is static and only used from a single place, so let's inline it.
-rw-r--r--common/rfb/SConnection.cxx9
-rw-r--r--common/rfb/SConnection.h7
-rw-r--r--common/rfb/VNCServerST.cxx9
3 files changed, 7 insertions, 18 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 6b4a5c4f..a79abeef 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -260,15 +260,6 @@ void SConnection::throwConnFailedException(const char* format, ...)
throw ConnFailedException(str);
}
-void SConnection::writeConnFailedFromScratch(const char* msg,
- rdr::OutStream* os)
-{
- os->writeBytes("RFB 003.003\n", 12);
- os->writeU32(0);
- os->writeString(msg);
- os->flush();
-}
-
void SConnection::setAccessRights(AccessRights ar)
{
accessRights = ar;
diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h
index 7148294b..92ddff71 100644
--- a/common/rfb/SConnection.h
+++ b/common/rfb/SConnection.h
@@ -154,13 +154,6 @@ namespace rfb {
// ConnFailedException.
void throwConnFailedException(const char* format, ...) __printf_attr(2, 3);
- // writeConnFailedFromScratch() sends a conn failed message to an OutStream
- // without the need to negotiate the protocol version first. It actually
- // does this by assuming that the client will understand version 3.3 of the
- // protocol.
- static void writeConnFailedFromScratch(const char* msg,
- rdr::OutStream* os);
-
SMsgReader* reader() { return reader_; }
SMsgWriter* writer() { return writer_; }
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index cf2a1144..038da3dc 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -126,8 +126,13 @@ void VNCServerST::addSocket(network::Socket* sock, bool outgoing)
if (blHosts->isBlackmarked(address.buf)) {
connectionsLog.error("blacklisted: %s", address.buf);
try {
- SConnection::writeConnFailedFromScratch("Too many security failures",
- &sock->outStream());
+ rdr::OutStream& os = sock->outStream();
+
+ // Shortest possible way to tell a client it is not welcome
+ os.writeBytes("RFB 003.003\n", 12);
+ os.writeU32(0);
+ os.writeString("Too many security failures");
+ os.flush();
} catch (rdr::Exception&) {
}
sock->shutdown();