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

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