Blame SOURCES/0115-daemon-allow-only-root-user-to-trigger-the-post-crea.patch

8ec399
From 3287aa12eb205cff95cdd00d6d6c5c9a4f8f0eca Mon Sep 17 00:00:00 2001
8ec399
From: Jakub Filak <jfilak@redhat.com>
8ec399
Date: Wed, 6 May 2015 14:39:44 +0200
8ec399
Subject: [ABRT PATCH] daemon: allow only root user to trigger the post-create
8ec399
8ec399
There is no reason to allow non-root users to trigger this
8ec399
functionality. Regular users can create abrt problems only through
8ec399
abrtd or abrt-dbus and both triggers the post-create.
8ec399
8ec399
Other hooks run under root user (CCpp, Koops, VMCore, Xorg).
8ec399
8ec399
Related: #1212861
8ec399
8ec399
Signed-off-by: Jakub Filak <jfilak@redhat.com>
8ec399
---
8ec399
 src/daemon/abrt-server.c | 19 ++++++++-----------
8ec399
 1 file changed, 8 insertions(+), 11 deletions(-)
8ec399
8ec399
diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c
8ec399
index 130c24a..d3fa1b5 100644
8ec399
--- a/src/daemon/abrt-server.c
8ec399
+++ b/src/daemon/abrt-server.c
8ec399
@@ -178,16 +178,6 @@ static int run_post_create(const char *dirname)
8ec399
             return 403;
8ec399
         }
8ec399
     }
8ec399
-    else if (!dump_dir_accessible_by_uid(dirname, client_uid))
8ec399
-    {
8ec399
-        if (errno == ENOTDIR)
8ec399
-        {
8ec399
-            error_msg("Path '%s' isn't problem directory", dirname);
8ec399
-            return 404; /* Not Found */
8ec399
-        }
8ec399
-        error_msg("Problem directory '%s' can't be accessed by user with uid %ld", dirname, (long)client_uid);
8ec399
-        return 403; /* Forbidden */
8ec399
-    }
8ec399
 
8ec399
     int child_stdout_fd;
8ec399
     int child_pid = spawn_event_handler_child(dirname, "post-create", &child_stdout_fd);
8ec399
@@ -741,14 +731,21 @@ static int perform_http_xact(void)
8ec399
     /* Body received, EOF was seen. Don't let alarm to interrupt after this. */
8ec399
     alarm(0);
8ec399
 
8ec399
+    int ret = 0;
8ec399
     if (url_type == CREATION_NOTIFICATION)
8ec399
     {
8ec399
+        if (client_uid != 0)
8ec399
+        {
8ec399
+            error_msg("UID=%ld is not authorized to trigger post-create processing", (long)client_uid);
8ec399
+            ret = 403; /* Forbidden */
8ec399
+            goto out;
8ec399
+        }
8ec399
+
8ec399
         messagebuf_data[messagebuf_len] = '\0';
8ec399
         return run_post_create(messagebuf_data);
8ec399
     }
8ec399
 
8ec399
     /* Save problem dir */
8ec399
-    int ret = 0;
8ec399
     unsigned pid = convert_pid(problem_info);
8ec399
     die_if_data_is_missing(problem_info);
8ec399
 
8ec399
-- 
8ec399
1.8.3.1
8ec399