[Development] client: Add dialog window to accept/save invalid X509
certificates. (Guillaume Destuynder)


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4198 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/vncviewer/CConn.cxx b/unix/vncviewer/CConn.cxx
index 1a75a11..8a64787 100644
--- a/unix/vncviewer/CConn.cxx
+++ b/unix/vncviewer/CConn.cxx
@@ -75,7 +75,10 @@
   menuKeysym = XStringToKeysym(menuKeyStr.buf);
 
   setShared(shared);
-  CSecurity::upg = this; /* Security instance is created in CConnection costructor. */
+  CSecurity::upg = this; /* Security instance is created in CConnection constructor. */
+#ifdef HAVE_GNUTLS
+  CSecurityTLS::msg = this;
+#endif
 
   CharArray encStr(preferredEncoding.getData());
   int encNum = encodingNum(encStr.buf);
@@ -125,6 +128,15 @@
   delete sock;
 }
 
+bool CConn::showMsgBox(int flags, const char* title, const char* text)
+{
+  CharArray titleText(strlen(title) + 12);
+  sprintf(titleText.buf, "VNC Viewer: %s", title);
+
+  TXMsgBox msgBox(dpy,text,flags,titleText.buf);
+  return msgBox.show();
+}
+
 // deleteWindow() is called when the user closes the desktop or menu windows.
 
 void CConn::deleteWindow(TXWindow* w) {
@@ -232,7 +244,6 @@
   *password = strDup(dlg.passwdEntry.getText());
 }
 
-
 // CConnection callback methods
 
 // serverInit() is called when the serverInit message has been received.  At
diff --git a/unix/vncviewer/CConn.h b/unix/vncviewer/CConn.h
index ac88963..929e5b5 100644
--- a/unix/vncviewer/CConn.h
+++ b/unix/vncviewer/CConn.h
@@ -26,6 +26,7 @@
 #include <rfb/CConnection.h>
 #include <rfb/Exception.h>
 #include <rfb/UserPasswdGetter.h>
+#include <rfb/UserMsgBox.h>
 #include <rdr/FdInStream.h>
 #include <list>
 
@@ -44,7 +45,7 @@
               public TXDeleteWindowCallback,
               public rdr::FdInStreamBlockCallback,
               public TXMenuCallback , public OptionsDialogCallback,
-              public TXEventHandler
+              public TXEventHandler, public rfb::UserMsgBox
 {
 public:
 
@@ -61,6 +62,9 @@
   // UserPasswdGetter methods
   virtual void getUserPasswd(char** user, char** password);
 
+  // UserMsgBox methods
+  virtual bool showMsgBox(int flags, const char* title, const char* text);
+
   // TXMenuCallback methods
   void menuSelect(long id, TXMenu* m);
 
diff --git a/unix/vncviewer/vncviewer.cxx b/unix/vncviewer/vncviewer.cxx
index 9edb80d..f3a5e01 100644
--- a/unix/vncviewer/vncviewer.cxx
+++ b/unix/vncviewer/vncviewer.cxx
@@ -33,6 +33,7 @@
 #include <locale.h>
 #include <os/os.h>
 #include <rfb/Logger_stdio.h>
+#include <rfb/SecurityClient.h>
 #include <rfb/LogWriter.h>
 #include <network/TcpSocket.h>
 #include "TXWindow.h"
@@ -278,6 +279,8 @@
 				 "Copyright (C) 2004-2009 Peter Astrand for Cendio AB\n"
 				 "See http://www.tigervnc.org for information on TigerVNC.");
 
+  rfb::SecurityClient::setDefaults();
+
   // Write about text to console, still using normal locale codeset
   snprintf(aboutText, sizeof(aboutText),
 	   gettext(englishAbout), PACKAGE_VERSION, buildtime);