Blame SOURCES/0118-dbus-validate-parameters-of-all-calls.patch

06486d
From 7a47f57975be0d285a2f20758e4572dca6d9cdd3 Mon Sep 17 00:00:00 2001
06486d
From: Jakub Filak <jfilak@redhat.com>
06486d
Date: Wed, 13 May 2015 11:10:23 +0200
06486d
Subject: [ABRT PATCH] dbus: validate parameters of all calls
06486d
06486d
SetElement and DeleteElement were missing check for valid dump directory
06486d
path.
06486d
06486d
FindProblemByElementInTimeRange was not reporting invalid element names.
06486d
06486d
Related: #1214451
06486d
06486d
Signed-off-by: Jakub Filak <jfilak@redhat.com>
06486d
---
06486d
 src/dbus/abrt-dbus.c | 24 ++++++++++++++++++++++++
06486d
 1 file changed, 24 insertions(+)
06486d
06486d
diff --git a/src/dbus/abrt-dbus.c b/src/dbus/abrt-dbus.c
06486d
index bef95bd..f2f742b 100644
06486d
--- a/src/dbus/abrt-dbus.c
06486d
+++ b/src/dbus/abrt-dbus.c
06486d
@@ -607,6 +607,12 @@ static void handle_method_call(GDBusConnection *connection,
06486d
 
06486d
         g_variant_get(parameters, "(&s&s&s)", &problem_id, &element, &value);
06486d
 
06486d
+        if (!allowed_problem_dir(problem_id))
06486d
+        {
06486d
+            return_InvalidProblemDir_error(invocation, problem_id);
06486d
+            return;
06486d
+        }
06486d
+
06486d
         if (!str_is_correct_filename(element))
06486d
         {
06486d
             log_notice("'%s' is not a valid element name of '%s'", element, problem_id);
06486d
@@ -666,6 +672,12 @@ static void handle_method_call(GDBusConnection *connection,
06486d
 
06486d
         g_variant_get(parameters, "(&s&s)", &problem_id, &element);
06486d
 
06486d
+        if (!allowed_problem_dir(problem_id))
06486d
+        {
06486d
+            return_InvalidProblemDir_error(invocation, problem_id);
06486d
+            return;
06486d
+        }
06486d
+
06486d
         if (!str_is_correct_filename(element))
06486d
         {
06486d
             log_notice("'%s' is not a valid element name of '%s'", element, problem_id);
06486d
@@ -783,6 +795,18 @@ static void handle_method_call(GDBusConnection *connection,
06486d
         g_variant_get_child(parameters, 3, "x", &timestamp_to);
06486d
         g_variant_get_child(parameters, 4, "b", &all;;
06486d
 
06486d
+        if (!str_is_correct_filename(element))
06486d
+        {
06486d
+            log_notice("'%s' is not a valid element name", element);
06486d
+            char *error = xasprintf(_("'%s' is not a valid element name"), element);
06486d
+            g_dbus_method_invocation_return_dbus_error(invocation,
06486d
+                                              "org.freedesktop.problems.InvalidElement",
06486d
+                                              error);
06486d
+
06486d
+            free(error);
06486d
+            return;
06486d
+        }
06486d
+
06486d
         if (all && polkit_check_authorization_dname(caller, "org.freedesktop.problems.getall") == PolkitYes)
06486d
             caller_uid = 0;
06486d
 
06486d
-- 
06486d
1.8.3.1
06486d