]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
old-stats: Set process dumpable during stats gathering
authorAki Tuomi <aki.tuomi@dovecot.fi>
Thu, 8 Feb 2018 11:04:48 +0000 (13:04 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 12 Feb 2018 11:18:19 +0000 (13:18 +0200)
/proc/self/io is not accessible otherwise

src/plugins/stats/mail-stats-fill.c

index b12b1c73ccab382e4a7a7bbf8c335beefed308e8..f9933501d7af5a3ff6be180666819c3bc1bf5c81 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "time-util.h"
+#include "restrict-access.h"
 #include "stats-plugin.h"
 #include "mail-stats.h"
 
@@ -45,6 +46,10 @@ static int process_io_open(void)
 
        if (proc_io_disabled)
                return -1;
+
+       bool dumpable = restrict_access_get_dumpable();
+       if (!dumpable)
+               restrict_access_set_dumpable(TRUE);
        proc_io_fd = open(PROC_IO_PATH, O_RDONLY);
        if (proc_io_fd == -1 && errno == EACCES) {
                /* kludge: if we're running with permissions temporarily
@@ -60,6 +65,8 @@ static int process_io_open(void)
                }
                errno = EACCES;
        }
+       if (!dumpable)
+               restrict_access_set_dumpable(FALSE);
        if (proc_io_fd == -1) {
                if (errno != ENOENT)
                        i_error("open(%s) failed: %m", PROC_IO_PATH);