From 38d14ec4d7ec62ff29fa5636d3462c3ae297e917 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Thu, 24 Mar 2011 20:59:31 +0100 Subject: extend dump_dir to allow creating world-readable directory - so far used only by kerneloops --- src/daemon/MiddleWare.cpp | 20 +++++++++++++------- src/daemon/abrt-server.c | 2 +- src/daemon/abrt.conf | 2 +- src/daemon/abrt_event.conf | 3 ++- 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp index 77e18b0a..9bbd2af3 100644 --- a/src/daemon/MiddleWare.cpp +++ b/src/daemon/MiddleWare.cpp @@ -768,15 +768,21 @@ int DeleteDebugDump(const char *dump_dir_name, long caller_uid) char caller_uid_str[sizeof(long) * 3 + 2]; sprintf(caller_uid_str, "%ld", caller_uid); - char *uid = dd_load_text(dd, FILENAME_UID); - if (strcmp(uid, caller_uid_str) != 0) + char *uid = dd_load_text_ext(dd, FILENAME_UID, DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); + /* we assume that the dump_dir can be handled by everyone if uid == NULL + * e.g: kerneloops + */ + if (uid != NULL) { - char *inform_all = dd_load_text_ext(dd, FILENAME_INFORMALL, DD_FAIL_QUIETLY_ENOENT); - if (!string_to_bool(inform_all)) + if (strcmp(uid, caller_uid_str) != 0) { - dd_close(dd); - error_msg("Dump directory '%s' can't be accessed by user with uid %ld", dump_dir_name, caller_uid); - return 1; + char *inform_all = dd_load_text_ext(dd, FILENAME_INFORMALL, DD_FAIL_QUIETLY_ENOENT); + if (!string_to_bool(inform_all)) + { + dd_close(dd); + error_msg("Dump directory '%s' can't be accessed by user with uid %ld", dump_dir_name, caller_uid); + return 1; + } } } } diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c index de22f427..0c45e3e8 100644 --- a/src/daemon/abrt-server.c +++ b/src/daemon/abrt-server.c @@ -114,7 +114,7 @@ static void create_debug_dump() /* 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); + struct dump_dir *dd = dd_create(path, client_uid, 0640); if (!dd) { error_msg_and_die("Error creating crash dump %s", path); diff --git a/src/daemon/abrt.conf b/src/daemon/abrt.conf index 7f5a9c58..460bf061 100644 --- a/src/daemon/abrt.conf +++ b/src/daemon/abrt.conf @@ -33,4 +33,4 @@ MaxCrashReportsSize = 1000 # So far we support only one line here # [ LogScanners ] -abrt-dump-oops = abrt-dump-oops -drw /var/log/messages +abrt-dump-oops = abrt-dump-oops -drwx /var/log/messages diff --git a/src/daemon/abrt_event.conf b/src/daemon/abrt_event.conf index d9b87d5a..d127d38d 100644 --- a/src/daemon/abrt_event.conf +++ b/src/daemon/abrt_event.conf @@ -45,7 +45,8 @@ EVENT=post-create abrt-action-save-package-data include events.d/*.conf -EVENT=post-create getent passwd "`cat uid`" | cut -d: -f1 >username +# uid file doesn't exist for some problems like kerneloops +EVENT=post-create if [ -e uid ]; then getent passwd "`cat uid`" | cut -d: -f1 >username; fi EVENT=post-create analyzer=Python abrt-action-analyze-python EVENT=post-create analyzer=Kerneloops abrt-action-analyze-oops -- cgit