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

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