Blame SOURCES/0254-daemon-send-base-names-from-abrt-server-to-abrtd.patch

baab13
From 4bba01e5bc60b4827a007f7d401b1e34f0944b70 Mon Sep 17 00:00:00 2001
baab13
From: Jakub Filak <jfilak@redhat.com>
baab13
Date: Fri, 26 Aug 2016 12:22:24 +0200
baab13
Subject: [PATCH] daemon: send  base names from abrt-server to abrtd
baab13
baab13
The /creation_notification method accepts arbitrary file system path and
baab13
it might cause abrtd some troubles if the path is not in canonical form.
baab13
baab13
ABRT enforces the notified paths to be directories in /var/spool/abrt
baab13
but ignores number of slash occurrences as it is not security relevant.
baab13
baab13
Switching to base names will assure that the problems associated with file
baab13
system path forms will be gone and no new problems will be introduced.
baab13
baab13
The other option is to use realpath() but this function resolves
baab13
symbolic links and if /var/spool is a symbolic link, we will be in
baab13
trouble.
baab13
baab13
Related: rhbz#1132459
baab13
baab13
Signed-off-by: Jakub Filak <jfilak@redhat.com>
baab13
---
baab13
 src/daemon/abrt-server.c | 2 +-
baab13
 src/daemon/abrtd.c       | 6 +++---
baab13
 2 files changed, 4 insertions(+), 4 deletions(-)
baab13
baab13
diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c
baab13
index 9a1361b..76186db 100644
baab13
--- a/src/daemon/abrt-server.c
baab13
+++ b/src/daemon/abrt-server.c
baab13
@@ -273,7 +273,7 @@ static int run_post_create(const char *dirname)
baab13
     log_debug("Creating glib main loop");
baab13
     struct waiting_context context = {0};
baab13
     context.main_loop = g_main_loop_new(NULL, FALSE);
baab13
-    context.dirname = dirname;
baab13
+    context.dirname = strrchr(dirname, '/') + 1;
baab13
 
baab13
     log_debug("Setting up a signal handler");
baab13
     /* Set up signal pipe */
baab13
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
baab13
index ff0565c..fc4f01e 100644
baab13
--- a/src/daemon/abrtd.c
baab13
+++ b/src/daemon/abrtd.c
baab13
@@ -174,16 +174,15 @@ static void queue_post_craete_process(struct abrt_server_proc *proc)
baab13
            && worst_dir)
baab13
     {
baab13
         const char *kind = "old";
baab13
-        char *deleted = concat_path_file(g_settings_dump_location, worst_dir);
baab13
 
baab13
         GList *proc_of_deleted_item = NULL;
baab13
-        if (proc != NULL && strcmp(deleted, proc->dirname) == 0)
baab13
+        if (proc != NULL && strcmp(worst_dir, proc->dirname) == 0)
baab13
         {
baab13
             kind = "new";
baab13
             stop_abrt_server(proc);
baab13
             proc = NULL;
baab13
         }
baab13
-        else if ((proc_of_deleted_item = g_list_find_custom(s_dir_queue, deleted, (GCompareFunc)abrt_server_compare_dirname)))
baab13
+        else if ((proc_of_deleted_item = g_list_find_custom(s_dir_queue, worst_dir, (GCompareFunc)abrt_server_compare_dirname)))
baab13
         {
baab13
             kind = "unprocessed";
baab13
             struct abrt_server_proc *removed_proc = (struct abrt_server_proc *)proc_of_deleted_item->data;
baab13
@@ -195,6 +194,7 @@ static void queue_post_craete_process(struct abrt_server_proc *proc)
baab13
                 g_settings_dump_location, g_settings_nMaxCrashReportsSize,
baab13
                 kind, worst_dir);
baab13
 
baab13
+        char *deleted = concat_path_file(g_settings_dump_location, worst_dir);
baab13
         free(worst_dir);
baab13
         worst_dir = NULL;
baab13
 
baab13
-- 
baab13
1.8.3.1
baab13