|
|
baab13 |
From f3c2a6af3455b2882e28570e8a04f1c2d4500d5b Mon Sep 17 00:00:00 2001
|
|
|
baab13 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
baab13 |
Date: Mon, 27 Apr 2015 07:52:00 +0200
|
|
|
baab13 |
Subject: [ABRT PATCH] dbus: report invalid element names
|
|
|
baab13 |
|
|
|
baab13 |
Return D-Bus error in case of invalid problem element name.
|
|
|
baab13 |
|
|
|
baab13 |
Related: #1214451
|
|
|
baab13 |
|
|
|
baab13 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
baab13 |
---
|
|
|
baab13 |
src/dbus/abrt-dbus.c | 14 +++++++++++++-
|
|
|
baab13 |
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
baab13 |
|
|
|
baab13 |
diff --git a/src/dbus/abrt-dbus.c b/src/dbus/abrt-dbus.c
|
|
|
baab13 |
index 9e1844a..6de15e9 100644
|
|
|
baab13 |
--- a/src/dbus/abrt-dbus.c
|
|
|
baab13 |
+++ b/src/dbus/abrt-dbus.c
|
|
|
baab13 |
@@ -599,7 +599,7 @@ static void handle_method_call(GDBusConnection *connection,
|
|
|
baab13 |
|
|
|
baab13 |
g_variant_get(parameters, "(&s&s&s)", &problem_id, &element, &value);
|
|
|
baab13 |
|
|
|
baab13 |
- if (element == NULL || element[0] == '\0' || strlen(element) > 64)
|
|
|
baab13 |
+ if (!str_is_correct_filename(element))
|
|
|
baab13 |
{
|
|
|
baab13 |
log_notice("'%s' is not a valid element name of '%s'", element, problem_id);
|
|
|
baab13 |
char *error = xasprintf(_("'%s' is not a valid element name"), element);
|
|
|
baab13 |
@@ -658,6 +658,18 @@ static void handle_method_call(GDBusConnection *connection,
|
|
|
baab13 |
|
|
|
baab13 |
g_variant_get(parameters, "(&s&s)", &problem_id, &element);
|
|
|
baab13 |
|
|
|
baab13 |
+ if (!str_is_correct_filename(element))
|
|
|
baab13 |
+ {
|
|
|
baab13 |
+ log_notice("'%s' is not a valid element name of '%s'", element, problem_id);
|
|
|
baab13 |
+ char *error = xasprintf(_("'%s' is not a valid element name"), element);
|
|
|
baab13 |
+ g_dbus_method_invocation_return_dbus_error(invocation,
|
|
|
baab13 |
+ "org.freedesktop.problems.InvalidElement",
|
|
|
baab13 |
+ error);
|
|
|
baab13 |
+
|
|
|
baab13 |
+ free(error);
|
|
|
baab13 |
+ return;
|
|
|
baab13 |
+ }
|
|
|
baab13 |
+
|
|
|
baab13 |
struct dump_dir *dd = open_directory_for_modification_of_element(
|
|
|
baab13 |
invocation, caller_uid, problem_id, element);
|
|
|
baab13 |
if (!dd)
|
|
|
baab13 |
--
|
|
|
baab13 |
1.8.3.1
|
|
|
baab13 |
|