add patches for newer tigervnc 1.2.0
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 19 Apr 2013 07:07:04 +0000 (09:07 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 19 Apr 2013 07:07:04 +0000 (09:07 +0200)
but the current 1.2.0 branch is not usable because it always
opens a new toplevel window.

Makefile
README
newtigerpatches/add-pvecert-parameter.patch [new file with mode: 0644]
newtigerpatches/add-username-param.patch [new file with mode: 0644]
newtigerpatches/series [new file with mode: 0644]

index 84a6201..e4246cf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ VNCSRC=${VNCDIR}.tar.gz
 VNCLIB=${VNCDIR}/libvncserver/.libs/libvncserver.a
 
 TIGERVNCSRC=tigervnc-1.1.0.tgz
+#TIGERVNCSRC=tigervnc-1.2.0.tgz
 
 DEB=${PACKAGE}_${VERSION}-${PACKAGERELEASE}_${ARCH}.deb
 SNAP=${PACKAGE}-${VERSION}-${CDATE}.tar.gz
@@ -46,12 +47,16 @@ jar: tigervnc.org
        cd tigervnc; quilt push -a
        cd tigervnc/java/src/com/tigervnc/vncviewer; make clean; make
        jarsigner -keystore ${KEYSTORE} -signedjar VncViewer.jar  tigervnc/java/src/com/tigervnc/vncviewer/VncViewer.jar proxmox
+# this is for version 1.2
+#      ln -s ../newtigerpatches tigervnc/patches
+#      cd tigervnc/java;cmake -G "Unix Makefiles"; make
+#      jarsigner -keystore ${KEYSTORE} -signedjar VncViewer.jar  tigervnc/java/VncViewer.jar proxmox
 
 tigervnc.org: ${TIGERVNCSRC}
        rm -rf tigervnc.org
        tar xf ${TIGERVNCSRC}
 
-downlaod:
+download:
        rm -rf tigervnc.org
        svn co https://tigervnc.svn.sourceforge.net/svnroot/tigervnc/tags/1_1_0 tigervnc.org 
        tar cf ${TIGERVNCSRC} tigervnc.org
diff --git a/README b/README
index b709fca..9a8d385 100644 (file)
--- a/README
+++ b/README
@@ -19,12 +19,18 @@ libraries.
 VNC Java Applet (for use in web based applications):
 ====================================================
 
-We use patched VncViewer files (latest TigerVNC sources):
+We use patched VncViewer files (TigerVNC 1.1.0 sources):
 
 http://www.tigervnc.com/
 
 We sign the applet to make clipboard working.
 
+Note: Newer tigervnc 1.2.0 always use a toplevel window, which
+make it basically useless as applet.
+
+http://sourceforge.net/tracker/?func=detail&aid=3488166&group_id=254363&atid=1126849
+
+I put patches for 1.2.0 to newtigerpatches subdir.
 
 TODO:
 =====
diff --git a/newtigerpatches/add-pvecert-parameter.patch b/newtigerpatches/add-pvecert-parameter.patch
new file mode 100644 (file)
index 0000000..11bef80
--- /dev/null
@@ -0,0 +1,75 @@
+Index: new/java/com/tigervnc/rfb/CSecurityTLS.java
+===================================================================
+--- new.orig/java/com/tigervnc/rfb/CSecurityTLS.java   2013-04-18 11:56:22.000000000 +0200
++++ new/java/com/tigervnc/rfb/CSecurityTLS.java        2013-04-18 13:59:03.000000000 +0200
+@@ -25,6 +25,7 @@
+ import java.io.File;
+ import java.io.InputStream;
+ import java.io.FileInputStream;
++import java.io.ByteArrayInputStream;
+ import java.util.ArrayList;
+ import java.util.Collection;
+ import javax.swing.JOptionPane;
+@@ -34,6 +35,9 @@
+ public class CSecurityTLS extends CSecurity {
++  public static StringParameter PVECert
++  = new StringParameter("PVECert",
++                        "Proxmox VE CA certificate", "");
+   public static StringParameter x509ca
+   = new StringParameter("x509ca",
+                         "X509 CA certificate", "");
+@@ -92,6 +96,8 @@
+   {
+     anon = _anon;
+     setDefaults();
++
++    pvecert = PVECert.getData();
+     cafile = x509ca.getData(); 
+     crlfile = x509crl.getData(); 
+   }
+@@ -170,10 +176,15 @@
+       CertificateFactory cf = CertificateFactory.getInstance("X.509");
+       try {
+         ks.load(null, null);
+-        File cacert = new File(cafile);
+-        if (!cacert.exists() || !cacert.canRead())
+-          return;
+-        InputStream caStream = new FileInputStream(cafile);
++        InputStream caStream;
++        if (pvecert != null) {
++            caStream = new ByteArrayInputStream(pvecert.getBytes("ISO-8859-1"));
++        } else {
++            File cacert = new File(cafile);
++            if (!cacert.exists() || !cacert.canRead())
++                return;
++            caStream = new FileInputStream(cafile);
++        }
+         X509Certificate ca = (X509Certificate)cf.generateCertificate(caStream);
+         ks.setCertificateEntry("CA", ca);
+         PKIXBuilderParameters params = new PKIXBuilderParameters(ks, new X509CertSelector());
+@@ -241,6 +252,7 @@
+   private boolean anon;
+   private SSLSession session;
+   private String cafile, crlfile;
++  private String pvecert;
+   private InStream is;
+   private SSLSocket ssl;
+Index: new/java/com/tigervnc/vncviewer/VncViewer.java
+===================================================================
+--- new.orig/java/com/tigervnc/vncviewer/VncViewer.java        2013-04-18 11:56:21.000000000 +0200
++++ new/java/com/tigervnc/vncviewer/VncViewer.java     2013-04-18 13:56:33.000000000 +0200
+@@ -168,6 +168,11 @@
+     if (firstApplet) {
+       alwaysShowServerDialog.setParam(true);
+       Configuration.readAppletParams(this);
++      String tmpcert = this.getParameter("PVECert");
++      if (tmpcert != null) {
++          CSecurityTLS.PVECert.setParam(tmpcert.replace('|', '\n'));
++      }
++ 
+       String host = getCodeBase().getHost();
+       if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
+         int port = vncServerPort.getValue();
diff --git a/newtigerpatches/add-username-param.patch b/newtigerpatches/add-username-param.patch
new file mode 100644 (file)
index 0000000..6aff7c0
--- /dev/null
@@ -0,0 +1,50 @@
+Index: new/java/com/tigervnc/vncviewer/CConn.java
+===================================================================
+--- new.orig/java/com/tigervnc/vncviewer/CConn.java    2013-04-18 11:56:21.000000000 +0200
++++ new/java/com/tigervnc/vncviewer/CConn.java 2013-04-18 14:23:58.000000000 +0200
+@@ -246,6 +246,16 @@
+     String passwordFileStr = viewer.passwordFile.getValue();
+     PasswdDialog dlg;    
++    String usernameParam = viewer.usernameParam.getValue();
++    String passwordParam = viewer.passwordParam.getValue();
++    vlog.info("USERNAME: " + usernameParam);
++    vlog.info("PASSWORD: " + passwordParam);
++    if (usernameParam != null && passwordParam != null) {
++        user.append(usernameParam);
++        passwd.append(passwordParam);
++        return true;
++    }
++
+     if (user == null && passwordFileStr != "") {
+       InputStream fp = null;
+       try {
+Index: new/java/com/tigervnc/vncviewer/VncViewer.java
+===================================================================
+--- new.orig/java/com/tigervnc/vncviewer/VncViewer.java        2013-04-18 13:56:33.000000000 +0200
++++ new/java/com/tigervnc/vncviewer/VncViewer.java     2013-04-19 07:52:32.000000000 +0200
+@@ -168,6 +168,9 @@
+     if (firstApplet) {
+       alwaysShowServerDialog.setParam(true);
+       Configuration.readAppletParams(this);
++                        
++      System.err.print(Configuration.listParams());
++ 
+       String tmpcert = this.getParameter("PVECert");
+       if (tmpcert != null) {
+           CSecurityTLS.PVECert.setParam(tmpcert.replace('|', '\n'));
+@@ -263,6 +266,14 @@
+                           "Password file for VNC authentication", "");
+   AliasParameter passwd
+   = new AliasParameter("passwd", "Alias for PasswordFile", passwordFile);
++
++  StringParameter usernameParam
++  = new StringParameter("USERNAME",
++                        "Username for VNC authentication", null);
++  StringParameter passwordParam
++  = new StringParameter("PASSWORD",
++                        "Password for VNC authentication", null);
++
+   BoolParameter autoSelect
+   = new BoolParameter("AutoSelect",
+                           "Auto select pixel format and encoding", true);
diff --git a/newtigerpatches/series b/newtigerpatches/series
new file mode 100644 (file)
index 0000000..621984e
--- /dev/null
@@ -0,0 +1,2 @@
+add-pvecert-parameter.patch
+add-username-param.patch