From f73a68c388d3cf36ea83758a7feea53f20eb9d16 Mon Sep 17 00:00:00 2001
From: Damian Minkov <damencho@jitsi.org>
Date: Tue, 2 Jul 2013 13:11:41 +0300
Subject: [PATCH] Checks and fixes permissions of home folder and config file
 to be editable and writable only to the owner when using macosx or linux.

---
 .../ConfigurationServiceImpl.java             | 23 +++++++++++++++++++
 .../configuration/ConfigurationService.java   | 22 +++++++++++++-----
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/src/org/jitsi/impl/configuration/ConfigurationServiceImpl.java b/src/org/jitsi/impl/configuration/ConfigurationServiceImpl.java
index 990f478d..422ce08e 100644
--- a/src/org/jitsi/impl/configuration/ConfigurationServiceImpl.java
+++ b/src/org/jitsi/impl/configuration/ConfigurationServiceImpl.java
@@ -779,6 +779,29 @@ private void storeConfiguration(File file)
         }
     }
 
+    /**
+     * Use with caution! Returns the name of the configuration file currently
+     * used. Placed in HomeDirLocation/HomeDirName
+     * {@link #getScHomeDirLocation()}
+     * {@link #getScHomeDirName()}
+     * @return  the name of the configuration file currently used.
+     */
+    public String getConfigurationFilename()
+    {
+        try
+        {
+            File file =  getConfigurationFile();
+            if(file != null)
+                return file.getName();
+        }
+        catch(IOException ex)
+        {
+            logger.error("Error loading configuration file", ex);
+        }
+
+        return null;
+    }
+
     /**
      * Returns the configuration file currently used by the implementation.
      * If there is no such file or this is the first time we reference it
diff --git a/src/org/jitsi/service/configuration/ConfigurationService.java b/src/org/jitsi/service/configuration/ConfigurationService.java
index 9b91b7ca..fd42d8f7 100644
--- a/src/org/jitsi/service/configuration/ConfigurationService.java
+++ b/src/org/jitsi/service/configuration/ConfigurationService.java
@@ -22,7 +22,7 @@ public interface ConfigurationService
 {
     /**
      * The name of the property that indicates the name of the directory where
-     * SIP Communicator is to store user specific data such as configuration
+     * Jitsi is to store user specific data such as configuration
      * files, message and call history as well as is bundle repository.
      */
     public static final String PNAME_SC_HOME_DIR_NAME
@@ -30,7 +30,7 @@ public interface ConfigurationService
 
     /**
      * The name of the property that indicates the location of the directory
-     * where SIP Communicator is to store user specific data such as
+     * where Jitsi is to store user specific data such as
      * configuration files, message and call history as well as is bundle
      * repository.
      */
@@ -428,24 +428,34 @@ public void reloadConfiguration()
     public void purgeStoredConfiguration();
 
     /**
-     * Returns the name of the directory where SIP Communicator is to store user
+     * Returns the name of the directory where Jitsi is to store user
      * specific data such as configuration files, message and call history
      * as well as is bundle repository.
      *
-     * @return the name of the directory where SIP Communicator is to store
+     * @return the name of the directory where Jitsi is to store
      * user specific data such as configuration files, message and call history
      * as well as is bundle repository.
      */
     public String getScHomeDirName();
 
     /**
-     * Returns the location of the directory where SIP Communicator is to store
+     * Returns the location of the directory where Jitsi is to store
      * user specific data such as configuration files, message and call history
      * as well as is bundle repository.
      *
-     * @return the location of the directory where SIP Communicator is to store
+     * @return the location of the directory where Jitsi is to store
      * user specific data such as configuration files, message and call history
      * as well as is bundle repository.
      */
     public String getScHomeDirLocation();
+
+    /**
+     * Use with caution!
+     * Returns the name of the configuration file currently
+     * used. Placed in HomeDirLocation/HomeDirName
+     * {@link #getScHomeDirLocation()}
+     * {@link #getScHomeDirName()}
+     * @return  the name of the configuration file currently used.
+     */
+    public String getConfigurationFilename();
 }
-- 
GitLab