--- rfb/SConnection.old	2006-05-13 21:58:56.000000000 +0200
+++ rfb/SConnection.cxx	2006-05-13 22:05:43.000000000 +0200
@@ -181,6 +181,17 @@
   vlog.info("Client requests security type %s(%d)",
             secTypeName(secType),secType);
 
+  std::list<rdr::U8> secTypes;
+  std::list<rdr::U8>::iterator i;
+  securityFactory->getSecTypes(&secTypes, reverseConnection);
+  for (i=secTypes.begin(); i!=secTypes.end(); i++)
+    if (*i == secType)
+      break;
+
+  if (*i != secType)
+    throwConnFailedException("unexpected security type");
+    
+
   try {
     state_ = RFBSTATE_SECURITY;
     security = securityFactory->getSSecurity(secType, reverseConnection);
