]> git.proxmox.com Git - vncterm.git/blob - newtigerpatches/add-pvecert-parameter.patch
libvncserver: refresh TLS patch
[vncterm.git] / newtigerpatches / add-pvecert-parameter.patch
1 Index: new/java/com/tigervnc/rfb/CSecurityTLS.java
2 ===================================================================
3 --- new.orig/java/com/tigervnc/rfb/CSecurityTLS.java 2013-04-18 11:56:22.000000000 +0200
4 +++ new/java/com/tigervnc/rfb/CSecurityTLS.java 2013-04-18 13:59:03.000000000 +0200
5 @@ -25,6 +25,7 @@
6 import java.io.File;
7 import java.io.InputStream;
8 import java.io.FileInputStream;
9 +import java.io.ByteArrayInputStream;
10 import java.util.ArrayList;
11 import java.util.Collection;
12 import javax.swing.JOptionPane;
13 @@ -34,6 +35,9 @@
14
15 public class CSecurityTLS extends CSecurity {
16
17 + public static StringParameter PVECert
18 + = new StringParameter("PVECert",
19 + "Proxmox VE CA certificate", "");
20 public static StringParameter x509ca
21 = new StringParameter("x509ca",
22 "X509 CA certificate", "");
23 @@ -92,6 +96,8 @@
24 {
25 anon = _anon;
26 setDefaults();
27 +
28 + pvecert = PVECert.getData();
29 cafile = x509ca.getData();
30 crlfile = x509crl.getData();
31 }
32 @@ -170,10 +176,15 @@
33 CertificateFactory cf = CertificateFactory.getInstance("X.509");
34 try {
35 ks.load(null, null);
36 - File cacert = new File(cafile);
37 - if (!cacert.exists() || !cacert.canRead())
38 - return;
39 - InputStream caStream = new FileInputStream(cafile);
40 + InputStream caStream;
41 + if (pvecert != null) {
42 + caStream = new ByteArrayInputStream(pvecert.getBytes("ISO-8859-1"));
43 + } else {
44 + File cacert = new File(cafile);
45 + if (!cacert.exists() || !cacert.canRead())
46 + return;
47 + caStream = new FileInputStream(cafile);
48 + }
49 X509Certificate ca = (X509Certificate)cf.generateCertificate(caStream);
50 ks.setCertificateEntry("CA", ca);
51 PKIXBuilderParameters params = new PKIXBuilderParameters(ks, new X509CertSelector());
52 @@ -241,6 +252,7 @@
53 private boolean anon;
54 private SSLSession session;
55 private String cafile, crlfile;
56 + private String pvecert;
57 private InStream is;
58 private SSLSocket ssl;
59
60 Index: new/java/com/tigervnc/vncviewer/VncViewer.java
61 ===================================================================
62 --- new.orig/java/com/tigervnc/vncviewer/VncViewer.java 2013-04-18 11:56:21.000000000 +0200
63 +++ new/java/com/tigervnc/vncviewer/VncViewer.java 2013-04-18 13:56:33.000000000 +0200
64 @@ -168,6 +168,11 @@
65 if (firstApplet) {
66 alwaysShowServerDialog.setParam(true);
67 Configuration.readAppletParams(this);
68 + String tmpcert = this.getParameter("PVECert");
69 + if (tmpcert != null) {
70 + CSecurityTLS.PVECert.setParam(tmpcert.replace('|', '\n'));
71 + }
72 +
73 String host = getCodeBase().getHost();
74 if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
75 int port = vncServerPort.getValue();