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

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