Seems ok, please apply.
On 09/03/2010 03:33 PM, Nikola Pajkovsky wrote:
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
inc/Makefile.am | 2 +-
inc/abrtlib.h | 2 +
inc/crash_types.h | 2 +
inc/debug_dump.h | 58 ----
inc/dump_dir.h | 58 ++++
lib/plugins/Bugzilla.cpp | 1 -
lib/plugins/CCpp.cpp | 1 -
lib/plugins/FileTransfer.cpp | 1 -
lib/plugins/Kerneloops.cpp | 1 -
lib/plugins/KerneloopsScanner.cpp | 1 -
lib/plugins/Logger.cpp | 1 -
lib/plugins/Mailx.cpp | 1 -
lib/plugins/Python.cpp | 1 -
lib/plugins/RHTSupport.cpp | 1 -
lib/plugins/ReportUploader.cpp | 1 -
lib/plugins/RunApp.cpp | 1 -
lib/plugins/SOSreport.cpp | 1 -
lib/utils/DebugDump.cpp | 536 -------------------------------------
lib/utils/Makefile.am | 2 +-
lib/utils/dump_dir.c | 535 ++++++++++++++++++++++++++++++++++++
lib/utils/hooklib.c | 1 -
lib/utils/make_descr.cpp | 1 -
src/cli/report.cpp | 1 -
src/daemon/CrashWatcher.cpp | 1 -
src/daemon/Daemon.cpp | 1 -
src/daemon/MiddleWare.cpp | 1 -
src/daemon/dumpsocket.cpp | 1 -
src/hooks/abrt-hook-ccpp.cpp | 1 -
28 files changed, 599 insertions(+), 616 deletions(-)
delete mode 100644 inc/debug_dump.h
create mode 100644 inc/dump_dir.h
delete mode 100644 lib/utils/DebugDump.cpp
create mode 100644 lib/utils/dump_dir.c
diff --git a/inc/Makefile.am b/inc/Makefile.am
index 901c23f..a6b52be 100644
--- a/inc/Makefile.am
+++ b/inc/Makefile.am
@@ -9,7 +9,7 @@ HEADER_FILES = \
crash_types.h \
database.h \
dbus_common.h \
- debug_dump.h \
+ dump_dir.h \
observer.h \
plugin.h \
reporter.h \
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index 4d96aa1..2fc5101 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -72,6 +72,8 @@ int vdprintf(int d, const char *format, va_list ap);
#include "logging.h"
#include "read_write.h"
#include "strbuf.h"
+#include "crash_types.h"
+#include "dump_dir.h"
#ifdef __cplusplus
diff --git a/inc/crash_types.h b/inc/crash_types.h
index 25dbcd4..d892754 100644
--- a/inc/crash_types.h
+++ b/inc/crash_types.h
@@ -90,6 +90,7 @@ extern const char *const must_have_files[];
bool is_editable_file(const char *file_name);
+#ifdef __cplusplus
// <key, data>
typedef map_vector_string_t map_crash_data_t;
typedef std::vector<map_crash_data_t> vector_map_crash_data_t;
@@ -109,5 +110,6 @@ const char *get_crash_data_item_content_or_NULL(const
map_crash_data_t& crash_da
const std::string& get_crash_data_item_content(const map_crash_data_t&
crash_data, const char *key);
void log_map_crash_data(const map_crash_data_t& data, const char *name);
+#endif
#endif
diff --git a/inc/debug_dump.h b/inc/debug_dump.h
deleted file mode 100644
index 96d50d3..0000000
--- a/inc/debug_dump.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- DebugDump.h - header file for the library caring of writing new reports
- to the specific directory
-
- Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
- Copyright (C) 2009 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#ifndef DEBUGDUMP_H_
-#define DEBUGDUMP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct dump_dir {
- char *dd_dir;
- DIR *next_dir;
- int opened;
- int locked;
- uid_t uid;
- gid_t gid;
-} dump_dir_t;
-
-dump_dir_t* dd_init(void);
-void dd_close(dump_dir_t *dd);
-
-int dd_opendir(dump_dir_t *dd, const char *dir);
-int dd_exist(dump_dir_t *dd, const char *path);
-int dd_create(dump_dir_t *dd, const char *dir, uid_t uid);
-int dd_init_next_file(dump_dir_t *dd);
-int dd_get_next_file(dump_dir_t *dd, char **short_name, char **full_name);
-
-char* dd_load_text(const dump_dir_t *dd, const char* name);
-void dd_save_text(dump_dir_t *dd, const char *name, const char *data);
-void dd_save_binary(dump_dir_t* dd, const char* name, const char* data, unsigned size);
-void dd_delete(dump_dir_t *dd);
-
-void delete_debug_dump_dir(const char *dd_dir);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/inc/dump_dir.h b/inc/dump_dir.h
new file mode 100644
index 0000000..96d50d3
--- /dev/null
+++ b/inc/dump_dir.h
@@ -0,0 +1,58 @@
+/*
+ DebugDump.h - header file for the library caring of writing new reports
+ to the specific directory
+
+ Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef DEBUGDUMP_H_
+#define DEBUGDUMP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct dump_dir {
+ char *dd_dir;
+ DIR *next_dir;
+ int opened;
+ int locked;
+ uid_t uid;
+ gid_t gid;
+} dump_dir_t;
+
+dump_dir_t* dd_init(void);
+void dd_close(dump_dir_t *dd);
+
+int dd_opendir(dump_dir_t *dd, const char *dir);
+int dd_exist(dump_dir_t *dd, const char *path);
+int dd_create(dump_dir_t *dd, const char *dir, uid_t uid);
+int dd_init_next_file(dump_dir_t *dd);
+int dd_get_next_file(dump_dir_t *dd, char **short_name, char **full_name);
+
+char* dd_load_text(const dump_dir_t *dd, const char* name);
+void dd_save_text(dump_dir_t *dd, const char *name, const char *data);
+void dd_save_binary(dump_dir_t* dd, const char* name, const char* data, unsigned size);
+void dd_delete(dump_dir_t *dd);
+
+void delete_debug_dump_dir(const char *dd_dir);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/plugins/Bugzilla.cpp b/lib/plugins/Bugzilla.cpp
index 6e5ffd9..752d8c5 100644
--- a/lib/plugins/Bugzilla.cpp
+++ b/lib/plugins/Bugzilla.cpp
@@ -21,7 +21,6 @@
#include "abrt_xmlrpc.h"
#include "Bugzilla.h"
#include "crash_types.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp
index c01b195..9f52b97 100644
--- a/lib/plugins/CCpp.cpp
+++ b/lib/plugins/CCpp.cpp
@@ -23,7 +23,6 @@
#include "abrtlib.h"
#include "CCpp.h"
#include "abrt_exception.h"
-#include "debug_dump.h"
#include "comm_layer_inner.h"
#include "Polkit.h"
#include "backtrace.h"
diff --git a/lib/plugins/FileTransfer.cpp b/lib/plugins/FileTransfer.cpp
index 41874d2..4e4b581 100644
--- a/lib/plugins/FileTransfer.cpp
+++ b/lib/plugins/FileTransfer.cpp
@@ -27,7 +27,6 @@
#include "abrtlib.h"
#include "abrt_curl.h"
#include "FileTransfer.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
diff --git a/lib/plugins/Kerneloops.cpp b/lib/plugins/Kerneloops.cpp
index 1b58cd1..e12be7e 100644
--- a/lib/plugins/Kerneloops.cpp
+++ b/lib/plugins/Kerneloops.cpp
@@ -19,7 +19,6 @@
#include "abrtlib.h"
#include "Kerneloops.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
diff --git a/lib/plugins/KerneloopsScanner.cpp b/lib/plugins/KerneloopsScanner.cpp
index 2a1bc47..9b45402 100644
--- a/lib/plugins/KerneloopsScanner.cpp
+++ b/lib/plugins/KerneloopsScanner.cpp
@@ -23,7 +23,6 @@
#include <syslog.h>
#include <asm/unistd.h> /* __NR_syslog */
#include "abrtlib.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
#include "KerneloopsSysLog.h"
diff --git a/lib/plugins/Logger.cpp b/lib/plugins/Logger.cpp
index 0c4aad6..6a02e71 100644
--- a/lib/plugins/Logger.cpp
+++ b/lib/plugins/Logger.cpp
@@ -20,7 +20,6 @@
*/
#include "abrtlib.h"
#include "Logger.h"
-#include "debug_dump.h"
#include "comm_layer_inner.h"
#include "abrt_exception.h"
diff --git a/lib/plugins/Mailx.cpp b/lib/plugins/Mailx.cpp
index 2580bab..2bb125b 100644
--- a/lib/plugins/Mailx.cpp
+++ b/lib/plugins/Mailx.cpp
@@ -20,7 +20,6 @@
*/
#include "abrtlib.h"
#include "Mailx.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
diff --git a/lib/plugins/Python.cpp b/lib/plugins/Python.cpp
index 96ba03e..257fe80 100644
--- a/lib/plugins/Python.cpp
+++ b/lib/plugins/Python.cpp
@@ -18,7 +18,6 @@
*/
#include "abrtlib.h"
#include "Python.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "Python_hash.h"
diff --git a/lib/plugins/RHTSupport.cpp b/lib/plugins/RHTSupport.cpp
index 1caea09..94615fe 100644
--- a/lib/plugins/RHTSupport.cpp
+++ b/lib/plugins/RHTSupport.cpp
@@ -23,7 +23,6 @@
#include "abrt_curl.h"
#include "abrt_rh_support.h"
#include "crash_types.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
#include "RHTSupport.h"
diff --git a/lib/plugins/ReportUploader.cpp b/lib/plugins/ReportUploader.cpp
index 7c31d51..cab2ada 100644
--- a/lib/plugins/ReportUploader.cpp
+++ b/lib/plugins/ReportUploader.cpp
@@ -20,7 +20,6 @@
#include "abrtlib.h"
#include "abrt_curl.h"
#include "ReportUploader.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
diff --git a/lib/plugins/RunApp.cpp b/lib/plugins/RunApp.cpp
index 2f9d128..085a133 100644
--- a/lib/plugins/RunApp.cpp
+++ b/lib/plugins/RunApp.cpp
@@ -20,7 +20,6 @@
*/
#include "abrtlib.h"
#include "RunApp.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
#include "abrtlib.h"
diff --git a/lib/plugins/SOSreport.cpp b/lib/plugins/SOSreport.cpp
index 5180266..237fa10 100644
--- a/lib/plugins/SOSreport.cpp
+++ b/lib/plugins/SOSreport.cpp
@@ -20,7 +20,6 @@
#include "abrtlib.h"
#include "abrt_exception.h"
#include "SOSreport.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "comm_layer_inner.h"
diff --git a/lib/utils/DebugDump.cpp b/lib/utils/DebugDump.cpp
deleted file mode 100644
index 689c9da..0000000
--- a/lib/utils/DebugDump.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- DebugDump.cpp
-
- Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
- Copyright (C) 2009 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include <sys/utsname.h>
-#include "abrtlib.h"
-#include "debug_dump.h"
-#include "comm_layer_inner.h"
-#include "strbuf.h"
-
-static bool isdigit_str(const char *str)
-{
- do
- {
- if (*str < '0' || *str > '9') return false;
- str++;
- } while (*str);
- return true;
-}
-
-static char* rm_trailing_slashes(const char *dir)
-{
- unsigned len = strlen(dir);
- while (len != 0 && dir[len-1] == '/')
- len--;
- return xstrndup(dir, len);
-}
-
-static bool exist_file_dir(const char *path)
-{
- struct stat buf;
- if (stat(path, &buf) == 0)
- {
- if (S_ISDIR(buf.st_mode) || S_ISREG(buf.st_mode))
- {
- return true;
- }
- }
- return false;
-}
-
-static char *load_text_file(const char *path);
-static void dd_lock(dump_dir_t *dd);
-static void dd_unlock(dump_dir_t *dd);
-
-dump_dir_t* dd_init(void)
-{
- return (dump_dir_t*)xzalloc(sizeof(dump_dir_t));
-}
-
-void dd_close(dump_dir_t *dd)
-{
- if (!dd)
- return;
-
- dd_unlock(dd);
- if (dd->next_dir)
- {
- closedir(dd->next_dir);
- free(dd->next_dir);
- }
-
- free(dd->dd_dir);
- free(dd);
-}
-
-int dd_opendir(dump_dir_t *dd, const char *dir)
-{
- if (dd->opened)
- error_msg_and_die("CDebugDump is already opened");
-
- dd->dd_dir = rm_trailing_slashes(dir);
- if (!dd->dd_dir || !exist_file_dir(dd->dd_dir))
- {
- error_msg("'%s' does not exist", dd->dd_dir);
- return 0;
- }
-
- dd_lock(dd);
- dd->opened = 1;
-
- /* In case caller would want to create more files, he'll need uid:gid */
- struct stat stat_buf;
- if (stat(dd->dd_dir, &stat_buf) == 0)
- {
- dd->uid = stat_buf.st_uid;
- dd->gid = stat_buf.st_gid;
- }
-
- return 1;
-}
-
-int dd_exist(dump_dir_t *dd, const char *path)
-{
- char *full_path = concat_path_file(dd->dd_dir, path);
- int ret = exist_file_dir(full_path);
- free(full_path);
- return ret;
-}
-
-static bool get_and_set_lock(const char* lock_file, const char* pid)
-{
- while (symlink(pid, lock_file) != 0)
- {
- if (errno != EEXIST)
- perror_msg_and_die("Can't create lock file '%s'",
lock_file);
-
- char pid_buf[sizeof(pid_t)*3 + 4];
- ssize_t r = readlink(lock_file, pid_buf, sizeof(pid_buf) - 1);
- if (r < 0)
- {
- if (errno == ENOENT)
- {
- /* Looks like lock_file was deleted */
- usleep(10 * 1000); /* avoid CPU eating loop */
- continue;
- }
- perror_msg_and_die("Can't read lock file '%s'",
lock_file);
- }
- pid_buf[r] = '\0';
-
- if (strcmp(pid_buf, pid) == 0)
- {
- log("Lock file '%s' is already locked by us", lock_file);
- return false;
- }
- if (isdigit_str(pid_buf))
- {
- char pid_str[sizeof("/proc/") + strlen(pid_buf)];
- sprintf(pid_str, "/proc/%s", pid_buf);
- if (access(pid_str, F_OK) == 0)
- {
- log("Lock file '%s' is locked by process %s",
lock_file, pid_buf);
- return false;
- }
- log("Lock file '%s' was locked by process %s, but it
crashed?", lock_file, pid_buf);
- }
- /* The file may be deleted by now by other process. Ignore ENOENT */
- if (unlink(lock_file) != 0 && errno != ENOENT)
- {
- perror_msg_and_die("Can't remove stale lock file
'%s'", lock_file);
- }
- }
-
- VERB1 log("Locked '%s'", lock_file);
- return true;
-
-#if 0
-/* Old code was using ordinary files instead of symlinks,
- * but it had a race window between open and write, during which file was
- * empty. It was seen to happen in practice.
- */
- int fd;
- while ((fd = open(pLockFile, O_WRONLY | O_CREAT | O_EXCL, 0640)) < 0)
- {
- if (errno != EEXIST)
- perror_msg_and_die("Can't create lock file '%s'",
pLockFile);
- fd = open(pLockFile, O_RDONLY);
- if (fd < 0)
- {
- if (errno == ENOENT)
- continue; /* someone else deleted the file */
- perror_msg_and_die("Can't open lock file '%s'",
pLockFile);
- }
- char pid_buf[sizeof(pid_t)*3 + 4];
- int r = read(fd, pid_buf, sizeof(pid_buf) - 1);
- if (r < 0)
- perror_msg_and_die("Can't read lock file '%s'",
pLockFile);
- close(fd);
- if (r == 0)
- {
- /* Other process did not write out PID yet.
- * We HOPE it did not crash... */
- continue;
- }
- pid_buf[r] = '\0';
- if (strcmp(pid_buf, pPID) == 0)
- {
- log("Lock file '%s' is already locked by us", pLockFile);
- return -1;
- }
- if (isdigit_str(pid_buf))
- {
- if (access(ssprintf("/proc/%s", pid_buf).c_str(), F_OK) == 0)
- {
- log("Lock file '%s' is locked by process %s",
pLockFile, pid_buf);
- return -1;
- }
- log("Lock file '%s' was locked by process %s, but it
crashed?", pLockFile, pid_buf);
- }
- /* The file may be deleted by now by other process. Ignore errors */
- unlink(pLockFile);
- }
-
- int len = strlen(pPID);
- if (write(fd, pPID, len) != len)
- {
- unlink(pLockFile);
- /* close(fd); - not needed, exiting does it too */
- perror_msg_and_die("Can't write lock file '%s'",
pLockFile);
- }
- close(fd);
-
- VERB1 log("Locked '%s'", pLockFile);
- return true;
-#endif
-}
-
-static void dd_lock(dump_dir_t *dd)
-{
- if (dd->locked)
- error_msg_and_die("Locking bug on '%s'", dd->dd_dir);
-
- char lock_buf[strlen(dd->dd_dir) + sizeof(".lock")];
- sprintf(lock_buf, "%s.lock", dd->dd_dir);
-
- char pid_buf[sizeof(long)*3 + 2];
- sprintf(pid_buf, "%lu", (long)getpid());
- while ((dd->locked = get_and_set_lock(lock_buf, pid_buf)) != true)
- {
- sleep(1); /* was 0.5 seconds */
- }
-}
-
-static void dd_unlock(dump_dir_t *dd)
-{
- if (dd->locked)
- {
- char lock_buf[strlen(dd->dd_dir) + sizeof(".lock")];
- sprintf(lock_buf, "%s.lock", dd->dd_dir);
- xunlink(lock_buf);
- VERB1 log("Unlocked '%s'", lock_buf);
- }
-}
-
-/* Create a fresh empty debug dump dir.
- *
- * Security: we should not allow users to write new files or write
- * into existing ones, but they should be able to read them.
- *
- * @param uid
- * Crashed application's User Id
- *
- * We currently have only three callers:
- * kernel oops hook: uid=0
- * this hook runs under 0:0
- * ccpp hook: uid=uid of crashed user's binary
- * this hook runs under 0:0
- * python hook: uid=uid of crashed user's script
- * this hook runs under abrt:gid
- *
- * Currently, we set dir's gid to passwd(uid)->pw_gid parameter, and we set uid
to
- * abrt's user id. We do not allow write access to group.
- */
-int dd_create(dump_dir_t *dd, const char *dir, uid_t uid)
-{
- if (dd->opened)
- error_msg_and_die("DebugDump is already opened");
-
- dd->dd_dir = rm_trailing_slashes(dir);
- if (exist_file_dir(dd->dd_dir))
- {
- error_msg("'%s' already exists", dd->dd_dir);
- return 0;
- }
-
- dd_lock(dd);
- dd->opened = 1;
-
- /* Was creating it with mode 0700 and user as the owner, but this allows
- * the user to replace any file in the directory, changing security-sensitive data
- * (e.g. "uid", "analyzer", "executable")
- */
- if (mkdir(dd->dd_dir, 0750) == -1)
- {
- dd_unlock(dd);
- dd->opened = 0;
- error_msg("Can't create dir '%s'", dir);
- return 0;
- }
-
- /* mkdir's mode (above) can be affected by umask, fix it */
- if (chmod(dd->dd_dir, 0750) == -1)
- {
- dd_unlock(dd);
- dd->opened = false;
- error_msg("Can't change mode of '%s'", dir);
- return false;
- }
-
- /* Get ABRT's user id */
- dd->uid = 0;
- struct passwd *pw = getpwnam("abrt");
- if (pw)
- dd->uid = pw->pw_uid;
- else
- error_msg("User 'abrt' does not exist, using uid 0");
-
- /* Get crashed application's group id */
- dd->gid = 0;
- pw = getpwuid(uid);
- if (pw)
- dd->gid = pw->pw_gid;
- else
- error_msg("User %lu does not exist, using gid 0", (long)uid);
-
- if (chown(dd->dd_dir, dd->uid, dd->gid) == -1)
- {
- perror_msg("can't change '%s' ownership to %lu:%lu",
dd->dd_dir,
- (long)dd->uid, (long)dd->gid);
- }
-
- char uid_str[sizeof(long) * 3 + 2];
- sprintf(uid_str, "%lu", (long)uid);
- dd_save_text(dd, CD_UID, uid_str);
-
- {
- struct utsname buf;
- if (uname(&buf) != 0)
- {
- perror_msg_and_die("uname");
- }
- dd_save_text(dd, FILENAME_KERNEL, buf.release);
- dd_save_text(dd, FILENAME_ARCHITECTURE, buf.machine);
- char *release = load_text_file("/etc/redhat-release");
- strchrnul(release, '\n')[0] = '\0';
- dd_save_text(dd, FILENAME_RELEASE, release);
- free(release);
- }
-
- time_t t = time(NULL);
- char t_str[sizeof(time_t) * 3 + 2];
- sprintf(t_str, "%lu", (time_t)t);
- dd_save_text(dd, FILENAME_TIME, t_str);
-
- return 1;
-}
-
-static bool delete_file_dir(const char *dir)
-{
- if (!exist_file_dir(dir))
- return true;
-
- DIR *d = opendir(dir);
- if (!d)
- {
- error_msg("Can't open dir '%s'", dir);
- return false;
- }
-
- struct dirent *dent;
- while ((dent = readdir(d)) != NULL)
- {
- if (dot_or_dotdot(dent->d_name))
- continue;
- char *full_path = concat_path_file(dir, dent->d_name);
- if (unlink(full_path) == -1)
- {
- if (errno != EISDIR)
- {
- closedir(d);
- error_msg("Can't remove dir '%s'", full_path);
- free(full_path);
- return false;
- }
- delete_file_dir(full_path);
- }
- free(full_path);
- }
- closedir(d);
- if (rmdir(dir) == -1)
- {
- error_msg("Can't remove dir %s", dir);
- return false;
- }
-
- return true;
-}
-
-void dd_delete(dump_dir_t *dd)
-{
- if (!exist_file_dir(dd->dd_dir))
- {
- return;
- }
-
- delete_file_dir(dd->dd_dir);
-}
-
-static char *load_text_file(const char *path)
-{
- FILE *fp = fopen(path, "r");
- if (!fp)
- {
- perror_msg("Can't open file '%s'", path);
- return xstrdup("");
- }
-
- struct strbuf *buf_content = strbuf_new();
- int ch;
- while ((ch = fgetc(fp)) != EOF)
- {
- if (ch == '\0')
- strbuf_append_char(buf_content, ' ');
- else if (isspace(ch) || (isascii(ch) && !iscntrl(ch)))
- strbuf_append_char(buf_content, ch);
- }
- fclose(fp);
-
- return strbuf_free_nobuf(buf_content);
-}
-
-static bool save_binary_file(const char *path, const char* data, unsigned size, uid_t
uid, gid_t gid)
-{
- /* "Why 0640?!" See ::Create() for security analysis */
- unlink(path);
- int fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, 0640);
- if (fd < 0)
- {
- error_msg("Can't open file '%s': %s", path, errno ?
strerror(errno) : "errno == 0");
- return false;
- }
- if (fchown(fd, uid, gid) == -1)
- {
- perror_msg("can't change '%s' ownership to %lu:%lu", path,
(long)uid, (long)gid);
- }
- unsigned r = full_write(fd, data, size);
- close(fd);
- if (r != size)
- {
- error_msg("Can't save file '%s'", path);
- return false;
- }
-
- return true;
-}
-
-char* dd_load_text(const dump_dir_t *dd, const char *name)
-{
- if (!dd->opened)
- error_msg_and_die("DebugDump is not opened");
-
- char *full_path = concat_path_file(dd->dd_dir, name);
- char *ret = load_text_file(full_path);
- free(full_path);
-
- return ret;
-}
-
-void dd_save_text(dump_dir_t *dd, const char *name, const char *data)
-{
- if (!dd->opened)
- error_msg_and_die("DebugDump is not opened");
-
- char *full_path = concat_path_file(dd->dd_dir, name);
- save_binary_file(full_path, data, strlen(data), dd->uid, dd->gid);
- free(full_path);
-}
-
-void dd_save_binary(dump_dir_t* dd, const char* name, const char* data, unsigned size)
-{
- if (dd->opened)
- error_msg_and_die("DebugDump is not opened");
-
- char *full_path = concat_path_file(dd->dd_dir, name);
- save_binary_file(full_path, data, size, dd->uid, dd->gid);
- free(full_path);
-}
-
-int dd_init_next_file(dump_dir_t *dd)
-{
- if (!dd->opened)
- error_msg_and_die("DebugDump is not opened");
-
- if (dd->next_dir)
- closedir(dd->next_dir);
-
- dd->next_dir = opendir(dd->dd_dir);
- if (!dd->next_dir)
- {
- error_msg("Can't open dir '%s'", dd->dd_dir);
- return 0;
- }
-
- return 1;
-}
-
-int dd_get_next_file(dump_dir_t *dd, char **short_name, char **full_name)
-{
- if (dd->next_dir == NULL)
- return 0;
-
- struct dirent *dent;
- while ((dent = readdir(dd->next_dir)) != NULL)
- {
- if (is_regular_file(dent, dd->dd_dir))
- {
- if (short_name)
- *short_name = xstrdup(dent->d_name);
- if (full_name)
- *full_name = concat_path_file(dd->dd_dir, dent->d_name);
- return 1;
- }
- }
-
- closedir(dd->next_dir);
- dd->next_dir = NULL;
- return 0;
-}
-
-/* Utility function */
-void delete_debug_dump_dir(const char *dd_dir)
-{
- dump_dir_t *dd = dd_init();
- if (dd_opendir(dd, dd_dir))
- dd_delete(dd);
- else
- VERB1 log("Unable to open debug dump '%s'", dd_dir);
- dd_close(dd);
-}
diff --git a/lib/utils/Makefile.am b/lib/utils/Makefile.am
index d35ffb8..cc77c82 100644
--- a/lib/utils/Makefile.am
+++ b/lib/utils/Makefile.am
@@ -23,7 +23,7 @@ libABRTUtils_la_SOURCES = \
spawn.c \
stringops.cpp \
dirsize.c \
- DebugDump.cpp \
+ dump_dir.c \
abrt_dbus.c abrt_dbus.h \
CrashTypes.cpp \
ABRTException.cpp \
diff --git a/lib/utils/dump_dir.c b/lib/utils/dump_dir.c
new file mode 100644
index 0000000..7ce9ab0
--- /dev/null
+++ b/lib/utils/dump_dir.c
@@ -0,0 +1,535 @@
+/*
+ DebugDump.cpp
+
+ Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include <sys/utsname.h>
+#include "abrtlib.h"
+#include "comm_layer_inner.h"
+#include "strbuf.h"
+
+static bool isdigit_str(const char *str)
+{
+ do
+ {
+ if (*str < '0' || *str > '9') return false;
+ str++;
+ } while (*str);
+ return true;
+}
+
+static char* rm_trailing_slashes(const char *dir)
+{
+ unsigned len = strlen(dir);
+ while (len != 0 && dir[len-1] == '/')
+ len--;
+ return xstrndup(dir, len);
+}
+
+static bool exist_file_dir(const char *path)
+{
+ struct stat buf;
+ if (stat(path, &buf) == 0)
+ {
+ if (S_ISDIR(buf.st_mode) || S_ISREG(buf.st_mode))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+static char *load_text_file(const char *path);
+static void dd_lock(dump_dir_t *dd);
+static void dd_unlock(dump_dir_t *dd);
+
+dump_dir_t* dd_init(void)
+{
+ return (dump_dir_t*)xzalloc(sizeof(dump_dir_t));
+}
+
+void dd_close(dump_dir_t *dd)
+{
+ if (!dd)
+ return;
+
+ dd_unlock(dd);
+ if (dd->next_dir)
+ {
+ closedir(dd->next_dir);
+ free(dd->next_dir);
+ }
+
+ free(dd->dd_dir);
+ free(dd);
+}
+
+int dd_opendir(dump_dir_t *dd, const char *dir)
+{
+ if (dd->opened)
+ error_msg_and_die("CDebugDump is already opened");
+
+ dd->dd_dir = rm_trailing_slashes(dir);
+ if (!dd->dd_dir || !exist_file_dir(dd->dd_dir))
+ {
+ error_msg("'%s' does not exist", dd->dd_dir);
+ return 0;
+ }
+
+ dd_lock(dd);
+ dd->opened = 1;
+
+ /* In case caller would want to create more files, he'll need uid:gid */
+ struct stat stat_buf;
+ if (stat(dd->dd_dir, &stat_buf) == 0)
+ {
+ dd->uid = stat_buf.st_uid;
+ dd->gid = stat_buf.st_gid;
+ }
+
+ return 1;
+}
+
+int dd_exist(dump_dir_t *dd, const char *path)
+{
+ char *full_path = concat_path_file(dd->dd_dir, path);
+ int ret = exist_file_dir(full_path);
+ free(full_path);
+ return ret;
+}
+
+static bool get_and_set_lock(const char* lock_file, const char* pid)
+{
+ while (symlink(pid, lock_file) != 0)
+ {
+ if (errno != EEXIST)
+ perror_msg_and_die("Can't create lock file '%s'",
lock_file);
+
+ char pid_buf[sizeof(pid_t)*3 + 4];
+ ssize_t r = readlink(lock_file, pid_buf, sizeof(pid_buf) - 1);
+ if (r < 0)
+ {
+ if (errno == ENOENT)
+ {
+ /* Looks like lock_file was deleted */
+ usleep(10 * 1000); /* avoid CPU eating loop */
+ continue;
+ }
+ perror_msg_and_die("Can't read lock file '%s'",
lock_file);
+ }
+ pid_buf[r] = '\0';
+
+ if (strcmp(pid_buf, pid) == 0)
+ {
+ log("Lock file '%s' is already locked by us", lock_file);
+ return false;
+ }
+ if (isdigit_str(pid_buf))
+ {
+ char pid_str[sizeof("/proc/") + strlen(pid_buf)];
+ sprintf(pid_str, "/proc/%s", pid_buf);
+ if (access(pid_str, F_OK) == 0)
+ {
+ log("Lock file '%s' is locked by process %s",
lock_file, pid_buf);
+ return false;
+ }
+ log("Lock file '%s' was locked by process %s, but it
crashed?", lock_file, pid_buf);
+ }
+ /* The file may be deleted by now by other process. Ignore ENOENT */
+ if (unlink(lock_file) != 0 && errno != ENOENT)
+ {
+ perror_msg_and_die("Can't remove stale lock file
'%s'", lock_file);
+ }
+ }
+
+ VERB1 log("Locked '%s'", lock_file);
+ return true;
+
+#if 0
+/* Old code was using ordinary files instead of symlinks,
+ * but it had a race window between open and write, during which file was
+ * empty. It was seen to happen in practice.
+ */
+ int fd;
+ while ((fd = open(pLockFile, O_WRONLY | O_CREAT | O_EXCL, 0640)) < 0)
+ {
+ if (errno != EEXIST)
+ perror_msg_and_die("Can't create lock file '%s'",
pLockFile);
+ fd = open(pLockFile, O_RDONLY);
+ if (fd < 0)
+ {
+ if (errno == ENOENT)
+ continue; /* someone else deleted the file */
+ perror_msg_and_die("Can't open lock file '%s'",
pLockFile);
+ }
+ char pid_buf[sizeof(pid_t)*3 + 4];
+ int r = read(fd, pid_buf, sizeof(pid_buf) - 1);
+ if (r < 0)
+ perror_msg_and_die("Can't read lock file '%s'",
pLockFile);
+ close(fd);
+ if (r == 0)
+ {
+ /* Other process did not write out PID yet.
+ * We HOPE it did not crash... */
+ continue;
+ }
+ pid_buf[r] = '\0';
+ if (strcmp(pid_buf, pPID) == 0)
+ {
+ log("Lock file '%s' is already locked by us", pLockFile);
+ return -1;
+ }
+ if (isdigit_str(pid_buf))
+ {
+ if (access(ssprintf("/proc/%s", pid_buf).c_str(), F_OK) == 0)
+ {
+ log("Lock file '%s' is locked by process %s",
pLockFile, pid_buf);
+ return -1;
+ }
+ log("Lock file '%s' was locked by process %s, but it
crashed?", pLockFile, pid_buf);
+ }
+ /* The file may be deleted by now by other process. Ignore errors */
+ unlink(pLockFile);
+ }
+
+ int len = strlen(pPID);
+ if (write(fd, pPID, len) != len)
+ {
+ unlink(pLockFile);
+ /* close(fd); - not needed, exiting does it too */
+ perror_msg_and_die("Can't write lock file '%s'",
pLockFile);
+ }
+ close(fd);
+
+ VERB1 log("Locked '%s'", pLockFile);
+ return true;
+#endif
+}
+
+static void dd_lock(dump_dir_t *dd)
+{
+ if (dd->locked)
+ error_msg_and_die("Locking bug on '%s'", dd->dd_dir);
+
+ char lock_buf[strlen(dd->dd_dir) + sizeof(".lock")];
+ sprintf(lock_buf, "%s.lock", dd->dd_dir);
+
+ char pid_buf[sizeof(long)*3 + 2];
+ sprintf(pid_buf, "%lu", (long)getpid());
+ while ((dd->locked = get_and_set_lock(lock_buf, pid_buf)) != true)
+ {
+ sleep(1); /* was 0.5 seconds */
+ }
+}
+
+static void dd_unlock(dump_dir_t *dd)
+{
+ if (dd->locked)
+ {
+ char lock_buf[strlen(dd->dd_dir) + sizeof(".lock")];
+ sprintf(lock_buf, "%s.lock", dd->dd_dir);
+ xunlink(lock_buf);
+ VERB1 log("Unlocked '%s'", lock_buf);
+ }
+}
+
+/* Create a fresh empty debug dump dir.
+ *
+ * Security: we should not allow users to write new files or write
+ * into existing ones, but they should be able to read them.
+ *
+ * @param uid
+ * Crashed application's User Id
+ *
+ * We currently have only three callers:
+ * kernel oops hook: uid=0
+ * this hook runs under 0:0
+ * ccpp hook: uid=uid of crashed user's binary
+ * this hook runs under 0:0
+ * python hook: uid=uid of crashed user's script
+ * this hook runs under abrt:gid
+ *
+ * Currently, we set dir's gid to passwd(uid)->pw_gid parameter, and we set uid
to
+ * abrt's user id. We do not allow write access to group.
+ */
+int dd_create(dump_dir_t *dd, const char *dir, uid_t uid)
+{
+ if (dd->opened)
+ error_msg_and_die("DebugDump is already opened");
+
+ dd->dd_dir = rm_trailing_slashes(dir);
+ if (exist_file_dir(dd->dd_dir))
+ {
+ error_msg("'%s' already exists", dd->dd_dir);
+ return 0;
+ }
+
+ dd_lock(dd);
+ dd->opened = 1;
+
+ /* Was creating it with mode 0700 and user as the owner, but this allows
+ * the user to replace any file in the directory, changing security-sensitive data
+ * (e.g. "uid", "analyzer", "executable")
+ */
+ if (mkdir(dd->dd_dir, 0750) == -1)
+ {
+ dd_unlock(dd);
+ dd->opened = 0;
+ error_msg("Can't create dir '%s'", dir);
+ return 0;
+ }
+
+ /* mkdir's mode (above) can be affected by umask, fix it */
+ if (chmod(dd->dd_dir, 0750) == -1)
+ {
+ dd_unlock(dd);
+ dd->opened = false;
+ error_msg("Can't change mode of '%s'", dir);
+ return false;
+ }
+
+ /* Get ABRT's user id */
+ dd->uid = 0;
+ struct passwd *pw = getpwnam("abrt");
+ if (pw)
+ dd->uid = pw->pw_uid;
+ else
+ error_msg("User 'abrt' does not exist, using uid 0");
+
+ /* Get crashed application's group id */
+ dd->gid = 0;
+ pw = getpwuid(uid);
+ if (pw)
+ dd->gid = pw->pw_gid;
+ else
+ error_msg("User %lu does not exist, using gid 0", (long)uid);
+
+ if (chown(dd->dd_dir, dd->uid, dd->gid) == -1)
+ {
+ perror_msg("can't change '%s' ownership to %lu:%lu",
dd->dd_dir,
+ (long)dd->uid, (long)dd->gid);
+ }
+
+ char uid_str[sizeof(long) * 3 + 2];
+ sprintf(uid_str, "%lu", (long)uid);
+ dd_save_text(dd, CD_UID, uid_str);
+
+ {
+ struct utsname buf;
+ if (uname(&buf) != 0)
+ {
+ perror_msg_and_die("uname");
+ }
+ dd_save_text(dd, FILENAME_KERNEL, buf.release);
+ dd_save_text(dd, FILENAME_ARCHITECTURE, buf.machine);
+ char *release = load_text_file("/etc/redhat-release");
+ strchrnul(release, '\n')[0] = '\0';
+ dd_save_text(dd, FILENAME_RELEASE, release);
+ free(release);
+ }
+
+ time_t t = time(NULL);
+ char t_str[sizeof(time_t) * 3 + 2];
+ sprintf(t_str, "%lu", (time_t)t);
+ dd_save_text(dd, FILENAME_TIME, t_str);
+
+ return 1;
+}
+
+static bool delete_file_dir(const char *dir)
+{
+ if (!exist_file_dir(dir))
+ return true;
+
+ DIR *d = opendir(dir);
+ if (!d)
+ {
+ error_msg("Can't open dir '%s'", dir);
+ return false;
+ }
+
+ struct dirent *dent;
+ while ((dent = readdir(d)) != NULL)
+ {
+ if (dot_or_dotdot(dent->d_name))
+ continue;
+ char *full_path = concat_path_file(dir, dent->d_name);
+ if (unlink(full_path) == -1)
+ {
+ if (errno != EISDIR)
+ {
+ closedir(d);
+ error_msg("Can't remove dir '%s'", full_path);
+ free(full_path);
+ return false;
+ }
+ delete_file_dir(full_path);
+ }
+ free(full_path);
+ }
+ closedir(d);
+ if (rmdir(dir) == -1)
+ {
+ error_msg("Can't remove dir %s", dir);
+ return false;
+ }
+
+ return true;
+}
+
+void dd_delete(dump_dir_t *dd)
+{
+ if (!exist_file_dir(dd->dd_dir))
+ {
+ return;
+ }
+
+ delete_file_dir(dd->dd_dir);
+}
+
+static char *load_text_file(const char *path)
+{
+ FILE *fp = fopen(path, "r");
+ if (!fp)
+ {
+ perror_msg("Can't open file '%s'", path);
+ return xstrdup("");
+ }
+
+ struct strbuf *buf_content = strbuf_new();
+ int ch;
+ while ((ch = fgetc(fp)) != EOF)
+ {
+ if (ch == '\0')
+ strbuf_append_char(buf_content, ' ');
+ else if (isspace(ch) || (isascii(ch) && !iscntrl(ch)))
+ strbuf_append_char(buf_content, ch);
+ }
+ fclose(fp);
+
+ return strbuf_free_nobuf(buf_content);
+}
+
+static bool save_binary_file(const char *path, const char* data, unsigned size, uid_t
uid, gid_t gid)
+{
+ /* "Why 0640?!" See ::Create() for security analysis */
+ unlink(path);
+ int fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, 0640);
+ if (fd < 0)
+ {
+ error_msg("Can't open file '%s': %s", path, errno ?
strerror(errno) : "errno == 0");
+ return false;
+ }
+ if (fchown(fd, uid, gid) == -1)
+ {
+ perror_msg("can't change '%s' ownership to %lu:%lu", path,
(long)uid, (long)gid);
+ }
+ unsigned r = full_write(fd, data, size);
+ close(fd);
+ if (r != size)
+ {
+ error_msg("Can't save file '%s'", path);
+ return false;
+ }
+
+ return true;
+}
+
+char* dd_load_text(const dump_dir_t *dd, const char *name)
+{
+ if (!dd->opened)
+ error_msg_and_die("DebugDump is not opened");
+
+ char *full_path = concat_path_file(dd->dd_dir, name);
+ char *ret = load_text_file(full_path);
+ free(full_path);
+
+ return ret;
+}
+
+void dd_save_text(dump_dir_t *dd, const char *name, const char *data)
+{
+ if (!dd->opened)
+ error_msg_and_die("DebugDump is not opened");
+
+ char *full_path = concat_path_file(dd->dd_dir, name);
+ save_binary_file(full_path, data, strlen(data), dd->uid, dd->gid);
+ free(full_path);
+}
+
+void dd_save_binary(dump_dir_t* dd, const char* name, const char* data, unsigned size)
+{
+ if (dd->opened)
+ error_msg_and_die("DebugDump is not opened");
+
+ char *full_path = concat_path_file(dd->dd_dir, name);
+ save_binary_file(full_path, data, size, dd->uid, dd->gid);
+ free(full_path);
+}
+
+int dd_init_next_file(dump_dir_t *dd)
+{
+ if (!dd->opened)
+ error_msg_and_die("DebugDump is not opened");
+
+ if (dd->next_dir)
+ closedir(dd->next_dir);
+
+ dd->next_dir = opendir(dd->dd_dir);
+ if (!dd->next_dir)
+ {
+ error_msg("Can't open dir '%s'", dd->dd_dir);
+ return 0;
+ }
+
+ return 1;
+}
+
+int dd_get_next_file(dump_dir_t *dd, char **short_name, char **full_name)
+{
+ if (dd->next_dir == NULL)
+ return 0;
+
+ struct dirent *dent;
+ while ((dent = readdir(dd->next_dir)) != NULL)
+ {
+ if (is_regular_file(dent, dd->dd_dir))
+ {
+ if (short_name)
+ *short_name = xstrdup(dent->d_name);
+ if (full_name)
+ *full_name = concat_path_file(dd->dd_dir, dent->d_name);
+ return 1;
+ }
+ }
+
+ closedir(dd->next_dir);
+ dd->next_dir = NULL;
+ return 0;
+}
+
+/* Utility function */
+void delete_debug_dump_dir(const char *dd_dir)
+{
+ dump_dir_t *dd = dd_init();
+ if (dd_opendir(dd, dd_dir))
+ dd_delete(dd);
+ else
+ VERB1 log("Unable to open debug dump '%s'", dd_dir);
+ dd_close(dd);
+}
diff --git a/lib/utils/hooklib.c b/lib/utils/hooklib.c
index b0d161d..243d269 100644
--- a/lib/utils/hooklib.c
+++ b/lib/utils/hooklib.c
@@ -17,7 +17,6 @@
*/
#include "abrtlib.h"
#include "hooklib.h"
-#include "debug_dump.h"
#include <sys/statvfs.h>
void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool
*setting_MakeCompatCore, bool *setting_SaveBinaryImage)
diff --git a/lib/utils/make_descr.cpp b/lib/utils/make_descr.cpp
index 131a0a3..bfe2a10 100644
--- a/lib/utils/make_descr.cpp
+++ b/lib/utils/make_descr.cpp
@@ -18,7 +18,6 @@
*/
#include "abrtlib.h"
#include "crash_types.h"
-#include "debug_dump.h" /* FILENAME_ARCHITECTURE etc */
using namespace std;
diff --git a/src/cli/report.cpp b/src/cli/report.cpp
index f56050f..4396889 100644
--- a/src/cli/report.cpp
+++ b/src/cli/report.cpp
@@ -22,7 +22,6 @@
#include "run-command.h"
#include "dbus.h"
#include "abrtlib.h"
-#include "debug_dump.h"
#include "crash_types.h" // FILENAME_* defines
#include "plugin.h" // LoadPluginSettings
diff --git a/src/daemon/CrashWatcher.cpp b/src/daemon/CrashWatcher.cpp
index dad4381..6310118 100644
--- a/src/daemon/CrashWatcher.cpp
+++ b/src/daemon/CrashWatcher.cpp
@@ -19,7 +19,6 @@
#include "abrtlib.h"
#include "Daemon.h"
#include "abrt_exception.h"
-#include "debug_dump.h"
#include "CrashWatcher.h"
void CCrashWatcher::Status(const char *pMessage, const char* peer)
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp
index ac845b1..a0406f4 100644
--- a/src/daemon/Daemon.cpp
+++ b/src/daemon/Daemon.cpp
@@ -31,7 +31,6 @@
#include "abrtlib.h"
#include "abrt_exception.h"
#include "CrashWatcher.h"
-#include "debug_dump.h"
#include "Daemon.h"
#include "dumpsocket.h"
#include "rpm.h"
diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp
index 65d4a4b..7752dc3 100644
--- a/src/daemon/MiddleWare.cpp
+++ b/src/daemon/MiddleWare.cpp
@@ -24,7 +24,6 @@
#include "Daemon.h"
#include "Settings.h"
#include "rpm.h"
-#include "debug_dump.h"
#include "abrt_exception.h"
#include "abrt_packages.h"
#include "comm_layer_inner.h"
diff --git a/src/daemon/dumpsocket.cpp b/src/daemon/dumpsocket.cpp
index c72e366..0132b07 100644
--- a/src/daemon/dumpsocket.cpp
+++ b/src/daemon/dumpsocket.cpp
@@ -19,7 +19,6 @@
#include <sys/un.h>
#include "abrtlib.h"
#include "dumpsocket.h"
-#include "debug_dump.h"
#include "crash_types.h"
#include "abrt_exception.h"
#include "hooklib.h"
diff --git a/src/hooks/abrt-hook-ccpp.cpp b/src/hooks/abrt-hook-ccpp.cpp
index 9a7500b..6faa6a6 100644
--- a/src/hooks/abrt-hook-ccpp.cpp
+++ b/src/hooks/abrt-hook-ccpp.cpp
@@ -20,7 +20,6 @@
*/
#include "abrtlib.h"
#include "hooklib.h"
-#include "debug_dump.h"
#include "crash_types.h"
#include "abrt_exception.h"
#include <syslog.h>