← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 383: Restrict directory permissions, too.

 

------------------------------------------------------------
revno: 383
fixes bug: https://launchpad.net/bugs/926652
committer: Siegfried-Angel Gevatter Pujals <siegfried@xxxxxxxxxxxx>
branch nick: bluebird
timestamp: Mon 2012-02-06 17:11:53 +0100
message:
  Restrict directory permissions, too.
modified:
  src/sql-schema.vala
  src/utils.vala


--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/sql-schema.vala'
--- src/sql-schema.vala	2012-02-02 18:57:35 +0000
+++ src/sql-schema.vala	2012-02-06 16:11:53 +0000
@@ -96,6 +96,8 @@
         {
             if (!Utils.using_in_memory_database ())
                 FileUtils.chmod (Utils.get_database_file_path (), 0600);
+            if (Utils.get_data_path () == Utils.get_default_data_path ())
+                FileUtils.chmod (Utils.get_data_path (), 0700);
 
             exec_query (database, "PRAGMA journal_mode = WAL");
             exec_query (database, "PRAGMA locking_mode = NORMAL");

=== modified file 'src/utils.vala'
--- src/utils.vala	2012-02-05 14:48:50 +0000
+++ src/utils.vala	2012-02-06 16:11:53 +0000
@@ -48,8 +48,7 @@
             if (DATA_PATH != null) return DATA_PATH;
 
             DATA_PATH = Environment.get_variable ("ZEITGEIST_DATA_PATH") ??
-                Path.build_filename (Environment.get_user_data_dir (),
-                    DATA_FOLDER);
+                get_default_data_path ();
 
             if (!FileUtils.test (DATA_PATH, FileTest.IS_DIR))
             {
@@ -61,6 +60,12 @@
             return DATA_PATH;
         }
 
+        public unowned string get_default_data_path ()
+        {
+            return Path.build_filename (Environment.get_user_data_dir (),
+                DATA_FOLDER);
+        }
+
         public unowned string get_database_file_path ()
         {
             if (DATABASE_FILE_PATH != null) return DATABASE_FILE_PATH;