[gnome-packagekit] install-catalog: Never pass relative paths to the session interface



commit 467ce52bf70635b918a438e2c8a259f819b1b647
Author: Matthias Klumpp <matthias tenstral net>
Date:   Sat Oct 19 22:50:06 2013 +0200

    install-catalog: Never pass relative paths to the session interface

 src/gpk-install-catalog.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-install-catalog.c b/src/gpk-install-catalog.c
index 77ab485..95b0b55 100644
--- a/src/gpk-install-catalog.c
+++ b/src/gpk-install-catalog.c
@@ -44,6 +44,9 @@ main (int argc, char *argv[])
        DBusGProxy *proxy = NULL;
        GError *error = NULL;
        gboolean ret;
+       guint i;
+       gchar *tmp;
+       gchar *current_dir;
        gchar **files = NULL;
 
        const GOptionEntry options[] = {
@@ -83,6 +86,17 @@ main (int argc, char *argv[])
                goto out;
        }
 
+       /* make sure we don't pass relative paths to the session-interface */
+       current_dir = g_get_current_dir ();
+       for (i = 0; files[i] != NULL; i++) {
+               if (!g_str_has_prefix (files[i], "/")) {
+                       tmp = g_build_filename (current_dir, files[i], NULL);
+                       g_free (files[i]);
+                       files[i] = tmp;
+               }
+       }
+       g_free (current_dir);
+
        /* check dbus connections, exit if not valid */
        connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        if (connection == NULL) {


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