- replace magic constant used as thirhd argument of dd_create() fn by DEFAULT_DUMP_DIR_MODE macro - assign dd_mode variable from libreport's pc file to DEFAULT_DUMP_DIR_MODE - related to trac#927
Signed-off-by: Jakub Filak <[email protected]> --- configure.ac | 2 ++ src/daemon/Makefile.am | 1 + src/daemon/abrt-server.c | 2 +- src/hooks/Makefile.am | 1 + src/hooks/abrt-hook-ccpp.c | 2 +- src/plugins/Makefile.am | 2 ++ src/plugins/abrt-dump-oops.c | 4 ++-- src/plugins/abrt-dump-xorg.c | 4 ++-- 8 files changed, 12 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 8d20b66..8af75d3 100644 --- a/configure.ac +++ b/configure.ac @@ -107,12 +107,14 @@ PLUGINS_CONF_DIR='${sysconfdir}/${PACKAGE_NAME}/plugins' EVENTS_DIR='${sysconfdir}/libreport/events' EVENTS_CONF_DIR='${sysconfdir}/libreport/events.d' ENABLE_SOCKET_OR_DBUS='-DENABLE_DBUS=1' +DEFAULT_DUMP_DIR_MODE=$($PKG_CONFIG --variable=dd_mode libreport) AC_SUBST(CONF_DIR) AC_SUBST(VAR_RUN) AC_SUBST(PLUGINS_CONF_DIR) AC_SUBST(EVENTS_CONF_DIR) AC_SUBST(EVENTS_DIR) +AC_SUBST(DEFAULT_DUMP_DIR_MODE) # Initialize the test suite. AC_CONFIG_TESTDIR(tests) diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 423753a..c3892d4 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -37,6 +37,7 @@ abrt_server_CPPFLAGS = \ -I$(srcdir)/../lib \ $(GLIB_CFLAGS) \ $(LIBREPORT_CFLAGS) \ + -DDEFAULT_DUMP_DIR_MODE=$(DEFAULT_DUMP_DIR_MODE) \ -D_GNU_SOURCE abrt_server_LDADD = \ ../lib/libabrt.la \ diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c index d9b7c66..eb94465 100644 --- a/src/daemon/abrt-server.c +++ b/src/daemon/abrt-server.c @@ -103,7 +103,7 @@ static int create_problem_dir(GHashTable *problem_info, unsigned pid) /* No need to check the path length, as all variables used are limited, * and dd_create() fails if the path is too long. */ - struct dump_dir *dd = dd_create(path, client_uid, 0640); + struct dump_dir *dd = dd_create(path, client_uid, DEFAULT_DUMP_DIR_MODE); if (!dd) { error_msg_and_die("Error creating problem directory '%s'", path); diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am index 982803e..6ce7314 100644 --- a/src/hooks/Makefile.am +++ b/src/hooks/Makefile.am @@ -23,6 +23,7 @@ abrt_hook_ccpp_CPPFLAGS = \ -I$(srcdir)/../lib \ -DVAR_RUN=\"$(VAR_RUN)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ + -DDEFAULT_DUMP_DIR_MODE=$(DEFAULT_DUMP_DIR_MODE) \ $(GLIB_CFLAGS) \ $(LIBREPORT_CFLAGS) \ -D_GNU_SOURCE diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c index 100df3c..086effc 100644 --- a/src/hooks/abrt-hook-ccpp.c +++ b/src/hooks/abrt-hook-ccpp.c @@ -657,7 +657,7 @@ int main(int argc, char** argv) /* use fsuid instead of uid, so we don't expose any sensitive * information of suided app in /var/spool/abrt */ - dd = dd_create(path, fsuid, 0640); + dd = dd_create(path, fsuid, DEFAULT_DUMP_DIR_MODE); if (dd) { char *rootdir = get_rootdir(pid); diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 1c479c0..61bb93a 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -109,6 +109,7 @@ abrt_dump_oops_CPPFLAGS = \ -I$(srcdir)/../lib \ $(GLIB_CFLAGS) \ $(LIBREPORT_CFLAGS) \ + -DDEFAULT_DUMP_DIR_MODE=$(DEFAULT_DUMP_DIR_MODE) \ -D_GNU_SOURCE abrt_dump_oops_LDADD = \ $(GLIB_LIBS) \ @@ -122,6 +123,7 @@ abrt_dump_xorg_CPPFLAGS = \ -I$(srcdir)/../lib \ $(GLIB_CFLAGS) \ $(LIBREPORT_CFLAGS) \ + -DDEFAULT_DUMP_DIR_MODE=$(DEFAULT_DUMP_DIR_MODE) \ -D_GNU_SOURCE abrt_dump_xorg_LDADD = \ $(GLIB_LIBS) \ diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c index 8b22ed3..6365006 100644 --- a/src/plugins/abrt-dump-oops.c +++ b/src/plugins/abrt-dump-oops.c @@ -119,11 +119,11 @@ static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt) const char *iso_date = iso_date_string(&t); /* dump should be readable by all if we're run with -x */ uid_t my_euid = (uid_t)-1L; - mode_t mode = 0644; + mode_t mode = DEFAULT_DUMP_DIR_MODE | S_IROTH; /* and readable only for the owner otherwise */ if (!world_readable_dump) { - mode = 0640; + mode = DEFAULT_DUMP_DIR_MODE; my_euid = geteuid(); } diff --git a/src/plugins/abrt-dump-xorg.c b/src/plugins/abrt-dump-xorg.c index 5d9645d..90dae46 100644 --- a/src/plugins/abrt-dump-xorg.c +++ b/src/plugins/abrt-dump-xorg.c @@ -70,11 +70,11 @@ static void save_bt_to_dump_dir(const char *bt, const char *exe, const char *rea const char *iso_date = iso_date_string(&t); /* dump should be readable by all if we're run with -x */ uid_t my_euid = (uid_t)-1L; - mode_t mode = 0644; + mode_t mode = DEFAULT_DUMP_DIR_MODE | S_IROTH; /* and readable only for the owner otherwise */ if (!(g_opts & OPT_x)) { - mode = 0640; + mode = DEFAULT_DUMP_DIR_MODE; my_euid = geteuid(); } -- 1.7.11.7
