]> source.dussan.org Git - tigervnc.git/commitdiff
Remove writeConnFailedFromScratch()
authorPierre Ossman <ossman@cendio.se>
Thu, 11 Oct 2018 05:52:50 +0000 (07:52 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 9 Nov 2018 16:16:04 +0000 (17:16 +0100)
It is static and only used from a single place, so let's inline it.

common/rfb/SConnection.cxx
common/rfb/SConnection.h
common/rfb/VNCServerST.cxx

index 6b4a5c4fd7fade29a156994ffc47b2de7ee42e1d..a79abeefab7150d9c71d790653aaed1377929d2a 100644 (file)
@@ -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;
index 7148294b0d912930b8b7480c7a51a5aff684d194..92ddff7198c3e03e7131d361231cf4f5ebc2b467 100644 (file)
@@ -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_; }
 
index cf2a1144faeaf19dea49c116cfc1afc7658ab558..038da3dc55b68c5b264e9fc4fa8947a04f297047 100644 (file)
@@ -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();