]> source.dussan.org Git - tigervnc.git/commitdiff
Use $XDG_STATE_HOME for known hosts storage
authorPierre Ossman <ossman@cendio.se>
Thu, 30 May 2024 13:37:27 +0000 (15:37 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 30 May 2024 14:33:02 +0000 (16:33 +0200)
This is an often changed database, so it is better suited for
$XDG_STATE_HOME rather than the more static $XDG_DATA_HOME.

common/rfb/CSecurityTLS.cxx
java/com/tigervnc/rfb/CSecurityTLS.java
java/com/tigervnc/vncviewer/FileUtils.java

index cc0ca89ff95aadafb231c678e2874b98f21c975e..11e6dfe3b4fc161806ded664324f14987f15862c 100644 (file)
@@ -384,9 +384,9 @@ void CSecurityTLS::checkSession()
 
   /* Certificate has some user overridable problems, so TOFU time */
 
-  hostsDir = os::getvncdatadir();
+  hostsDir = os::getvncstatedir();
   if (hostsDir == NULL) {
-    throw AuthFailureException("Could not obtain VNC data directory "
+    throw AuthFailureException("Could not obtain VNC state directory "
                                "path for known hosts storage");
   }
 
index ab221427ef79e2b5b0d1d8c9be74f6ea3dc8bd2c..39d1f541e8c843261c9d482738caca6385a1a4c0 100644 (file)
@@ -277,12 +277,12 @@ public class CSecurityTLS extends CSecurity {
                              "do you want to continue?"))
           throw new AuthFailureException("server certificate has expired");
       }
-      File vncDir = new File(FileUtils.getVncDataDir());
+      File vncDir = new File(FileUtils.getVncStateDir());
       if (!vncDir.exists()) {
         try {
           vncDir.mkdir();
         } catch(SecurityException e) {
-          throw new AuthFailureException("Could not obtain VNC data directory "+
+          throw new AuthFailureException("Could not obtain VNC state directory "+
                                          "path for known hosts storage");
         }
       }
index 95fec3e612c2448039804ab78a1cfe228dd51189..6b82d3e2e659fd04a610c31f9d4354664670bf66 100644 (file)
@@ -98,6 +98,10 @@ public class FileUtils {
     return getVncDir("XDG_DATA_HOME", ".local" + getFileSeparator() + "share");
   }
 
+  public static String getVncStateDir() {
+    return getVncDir("XDG_STATE_HOME", ".local" + getFileSeparator() + "state");
+  }
+
   public static String getFileSeparator() {
     String separator = null;
     try {