From 89f6d5aed0a3d7b8caba7e869e7f96cc7be7ec32 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Thu, 11 Mar 2021 19:59:29 -0500 Subject: [PATCH] Create VNC homedir if it doesn't already exist --- java/com/tigervnc/rfb/CSecurityTLS.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/java/com/tigervnc/rfb/CSecurityTLS.java b/java/com/tigervnc/rfb/CSecurityTLS.java index e63945dc..ed9de383 100644 --- a/java/com/tigervnc/rfb/CSecurityTLS.java +++ b/java/com/tigervnc/rfb/CSecurityTLS.java @@ -279,9 +279,14 @@ public class CSecurityTLS extends CSecurity { throw new AuthFailureException("server certificate has expired"); } File vncDir = new File(FileUtils.getVncHomeDir()); - if (!vncDir.exists()) - throw new AuthFailureException("Could not obtain VNC home directory "+ - "path for known hosts storage"); + if (!vncDir.exists()) { + try { + vncDir.mkdir(); + } catch(SecurityException e) { + throw new AuthFailureException("Could not obtain VNC home directory "+ + "path for known hosts storage"); + } + } File dbPath = new File(vncDir, "x509_known_hosts"); String info = " Subject: "+cert.getSubjectX500Principal().getName()+"\n"+ -- 2.39.5