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

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