gnome-screensaver r1611 - in trunk: . src



Author: matthiasc
Date: Sat Feb 21 05:37:02 2009
New Revision: 1611
URL: http://svn.gnome.org/viewvc/gnome-screensaver?rev=1611&view=rev

Log:
        * src/gs-theme-manager.c (find_command): Accept a full path
        as long as it is one of the trusted directories. (#561855)




Modified:
   trunk/ChangeLog
   trunk/src/gs-theme-manager.c

Modified: trunk/src/gs-theme-manager.c
==============================================================================
--- trunk/src/gs-theme-manager.c	(original)
+++ trunk/src/gs-theme-manager.c	Sat Feb 21 05:37:02 2009
@@ -75,17 +75,33 @@
 {
         int i;
 
-        for (i = 0; known_engine_locations [i]; i++){
-                char *path;
+        if (g_path_is_absolute (command)) {
+                char *dirname;
 
-                path = g_build_filename (known_engine_locations [i], command, NULL);
-
-                if (g_file_test (path, G_FILE_TEST_IS_EXECUTABLE)
-                    && ! g_file_test (path, G_FILE_TEST_IS_DIR)) {
-                        return path;
+                dirname = g_path_get_dirname (command);
+                for (i = 0; known_engine_locations [i]; i++) {
+                        if (strcmp (dirname, known_engine_locations [i]) == 0) {
+                                if (g_file_test (command, G_FILE_TEST_IS_EXECUTABLE)
+                                    && ! g_file_test (command, G_FILE_TEST_IS_DIR)) {
+                                        g_free (dirname);
+                                        return g_strdup (command);
+                                }
+                        }
                 }
+                g_free (dirname);
+        } else {
+                for (i = 0; known_engine_locations [i]; i++){
+                        char *path;
 
-                g_free (path);
+                        path = g_build_filename (known_engine_locations [i], command, NULL);
+
+                        if (g_file_test (path, G_FILE_TEST_IS_EXECUTABLE)
+                            && ! g_file_test (path, G_FILE_TEST_IS_DIR)) {
+                                return path;
+                        }
+
+                        g_free (path);
+                }
         }
 
         return NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]