]> source.dussan.org Git - tigervnc.git/commitdiff
Remove auth exception prefix
authorPierre Ossman <ossman@cendio.se>
Wed, 7 Aug 2024 08:08:43 +0000 (10:08 +0200)
committerPierre Ossman <ossman@cendio.se>
Wed, 7 Aug 2024 09:02:18 +0000 (11:02 +0200)
This prefix often just added noise, and could sometimes be added
multiple times. It's better that user interface catch the specific
exception type and give a more descriptive presentation to the user.

This is partially a revert of 1922550.

common/rfb/CConnection.cxx
common/rfb/Exception.h
common/rfb/SConnection.cxx
common/rfb/SSecurityPlain.cxx
common/rfb/SSecurityRSAAES.cxx
common/rfb/SSecurityVncAuth.cxx

index 0db5f4c8a7724ee313c5e3f194b04633f780c90a..b4017dba8e658c832e4ff778f4fc51a1e31c4f87 100644 (file)
@@ -332,7 +332,7 @@ bool CConnection::processSecurityResultMsg()
 
   if (server.beforeVersion(3,8)) {
     state_ = RFBSTATE_INVALID;
-    throw AuthFailureException();
+    throw AuthFailureException("Authentication failed");
   }
 
   state_ = RFBSTATE_SECURITY_REASON;
index 827ced522644e284f5d9965abd860dda74480279..4520bc8c2f0829ac4814688468d9c732f869c70d 100644 (file)
 namespace rfb {
   typedef rdr::Exception Exception;
   struct AuthFailureException : public Exception {
-    AuthFailureException()
-      : Exception("Authentication failure") {}
     AuthFailureException(const char* reason)
-      : Exception("Authentication failure: %s", reason) {}
+      : Exception("%s", reason) {}
   };
   struct AuthCancelledException : public rfb::Exception {
     AuthCancelledException()
       : Exception("Authentication cancelled") {}
   };
   struct ConnFailedException : public Exception {
-    ConnFailedException()
-      : Exception("Connection failed") {}
     ConnFailedException(const char* reason)
-      : Exception("Connection failed: %s", reason) {}
+      : Exception("%s", reason) {}
   };
 }
 #endif
index 866d19a2c9feb3c9f5386029a91c9fb94faed22c..08cef044b91829d0ab9f165c63644bd307d97724 100644 (file)
@@ -458,7 +458,7 @@ void SConnection::approveConnection(bool accept, const char* reason)
       os->writeU32(secResultFailed);
       if (!client.beforeVersion(3,8)) { // 3.8 onwards have failure message
         if (!reason)
-          reason = "Authentication failure";
+          reason = "Connection rejected";
         os->writeU32(strlen(reason));
         os->writeBytes((const uint8_t*)reason, strlen(reason));
       }
@@ -476,7 +476,7 @@ void SConnection::approveConnection(bool accept, const char* reason)
     if (reason)
       throw AuthFailureException(reason);
     else
-      throw AuthFailureException();
+      throw AuthFailureException("Connection rejected");
   }
 }
 
index 73a21335db7ad8352a4a29eb315b017cf7fffd8c..69c6d9ca97b1e5ae2ae5a3327b8c87013336237a 100644 (file)
@@ -114,7 +114,7 @@ bool SSecurityPlain::processMsg()
     username[ulen] = 0;
     plen = 0;
     if (!valid->validate(sc, username, password))
-      throw AuthFailureException("invalid password or username");
+      throw AuthFailureException("Authentication failed");
   }
 
   return true;
index 13e03b22d08dbced7560c83cd6275568c22913bf..4aa3911108e9324345f615d369ca833ab12188eb 100644 (file)
@@ -561,7 +561,7 @@ void SSecurityRSAAES::verifyUserPass()
 #endif
   if (!valid->validate(sc, username, password)) {
     delete valid;
-    throw AuthFailureException("invalid password or username");
+    throw AuthFailureException("Authentication failed");
   }
   delete valid;
 #else
@@ -588,7 +588,7 @@ void SSecurityRSAAES::verifyPass()
     return;
   }
 
-  throw AuthFailureException();
+  throw AuthFailureException("Authentication failed");
 }
 
 const char* SSecurityRSAAES::getUserName() const
index 1276f68a898967671f47212f8da40876407b515c..500903a80b8ebc48f79616dd39d7755740982e4f 100644 (file)
@@ -113,7 +113,7 @@ bool SSecurityVncAuth::processMsg()
     return true;
   }
 
-  throw AuthFailureException();
+  throw AuthFailureException("Authentication failed");
 }
 
 VncAuthPasswdParameter::VncAuthPasswdParameter(const char* name_,