summaryrefslogtreecommitdiffstats
path: root/src/daemon
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-03-25 16:02:21 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-03-25 16:02:21 +0100
commit56ea4f65a792a6d4ebaeab34d6a0c1d9c8d13082 (patch)
tree49f013fb75aa71aeb0c9bcd7133f389ec40b98c7 /src/daemon
parent6f7c8a224629d298a4663cea2f02d6f1e5932f1f (diff)
downloadabrt-56ea4f65a792a6d4ebaeab34d6a0c1d9c8d13082.tar.gz
abrt-56ea4f65a792a6d4ebaeab34d6a0c1d9c8d13082.tar.xz
abrt-56ea4f65a792a6d4ebaeab34d6a0c1d9c8d13082.zip
remove FILENAME_INFORMALL and tighten up some loose ends
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/CommLayerServerDBus.cpp7
-rw-r--r--src/daemon/CommLayerServerDBus.h1
-rw-r--r--src/daemon/Daemon.cpp10
-rw-r--r--src/daemon/MiddleWare.cpp74
-rw-r--r--src/daemon/abrt_event.conf14
5 files changed, 41 insertions, 65 deletions
diff --git a/src/daemon/CommLayerServerDBus.cpp b/src/daemon/CommLayerServerDBus.cpp
index 386b5872..0f661f23 100644
--- a/src/daemon/CommLayerServerDBus.cpp
+++ b/src/daemon/CommLayerServerDBus.cpp
@@ -59,7 +59,6 @@ static void send_flush_and_unref(DBusMessage* msg)
/* Notify the clients (UI) about a new crash */
void send_dbus_sig_Crash(const char *package_name,
- const char *crash_id,
const char *dir,
const char *uid_str
) {
@@ -68,20 +67,18 @@ void send_dbus_sig_Crash(const char *package_name,
{
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &package_name,
- DBUS_TYPE_STRING, &crash_id,
DBUS_TYPE_STRING, &dir,
DBUS_TYPE_STRING, &uid_str,
DBUS_TYPE_INVALID);
- VERB2 log("Sending signal Crash('%s','%s','%s','%s')", package_name, crash_id, dir, uid_str);
+ VERB2 log("Sending signal Crash('%s','%s','%s')", package_name, dir, uid_str);
}
else
{
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &package_name,
- DBUS_TYPE_STRING, &crash_id,
DBUS_TYPE_STRING, &dir,
DBUS_TYPE_INVALID);
- VERB2 log("Sending signal Crash('%s','%s','%s')", package_name, crash_id, dir);
+ VERB2 log("Sending signal Crash('%s','%s')", package_name, dir);
}
send_flush_and_unref(msg);
}
diff --git a/src/daemon/CommLayerServerDBus.h b/src/daemon/CommLayerServerDBus.h
index 979fef69..eab7d710 100644
--- a/src/daemon/CommLayerServerDBus.h
+++ b/src/daemon/CommLayerServerDBus.h
@@ -27,7 +27,6 @@ int init_dbus(void);
void deinit_dbus(void);
void send_dbus_sig_Crash(const char *package_name,
- const char *crash_id,
const char *dir,
const char *uid_str
);
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp
index 5dd273e7..7bb772c8 100644
--- a/src/daemon/Daemon.cpp
+++ b/src/daemon/Daemon.cpp
@@ -400,23 +400,13 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
}
const char *uid_str = get_crash_item_content_or_NULL(crash_data, FILENAME_UID);
- const char *inform_all = get_crash_item_content_or_NULL(crash_data, FILENAME_INFORMALL);
-
- if (inform_all && string_to_bool(inform_all))
- uid_str = NULL;
- char *crash_id = xasprintf("%s:%s",
- get_crash_item_content_or_NULL(crash_data, FILENAME_UID),
- get_crash_item_content_or_NULL(crash_data, FILENAME_UUID)
- );
/* When dup occurs we need to return first occurence,
* not the one which is deleted
*/
send_dbus_sig_Crash(get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE),
- crash_id, //TODO: stop passing this param, it is unused
(first)? first: fullname,
uid_str
);
- free(crash_id);
break;
}
case MW_CORRUPTED:
diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp
index 9bbd2af3..ffc2d633 100644
--- a/src/daemon/MiddleWare.cpp
+++ b/src/daemon/MiddleWare.cpp
@@ -134,19 +134,15 @@ static mw_result_t CreateCrashReport(const char *dump_dir_name,
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_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
+ bool uid_matches = (uid == NULL || strcmp(uid, caller_uid_str) == 0);
+ free(uid);
+ if (!uid_matches)
{
- char *inform_all = dd_load_text_ext(dd, FILENAME_INFORMALL, DD_FAIL_QUIETLY_ENOENT);
- bool for_all = string_to_bool(inform_all);
- free(inform_all);
- if (!for_all)
- {
- dd_close(dd);
- error_msg("crash '%s' can't be accessed by user with uid %ld", dump_dir_name, caller_uid);
- r = MW_PERM_ERROR;
- goto ret;
- }
+ dd_close(dd);
+ error_msg("Dump directory '%s' can't be accessed by user with uid %ld", dump_dir_name, caller_uid);
+ r = MW_PERM_ERROR;
+ goto ret;
}
}
dd_close(dd);
@@ -222,19 +218,16 @@ report_status_t Report(crash_data_t *client_report,
{
char caller_uid_str[sizeof(long)*3 + 2];
sprintf(caller_uid_str, "%ld", caller_uid);
- if (strcmp(caller_uid_str, get_crash_item_content_or_die(stored_report, FILENAME_UID)) != 0)
+ const char *uid = get_crash_item_content_or_NULL(stored_report, FILENAME_UID);
+ if (uid && strcmp(caller_uid_str, uid) != 0)
{
- const char *inform_all = get_crash_item_content_or_NULL(stored_report, FILENAME_INFORMALL);
- if (!inform_all || !string_to_bool(inform_all))
- {
- free_crash_data(stored_report);
- char *errmsg = xasprintf("user with uid %ld can't report crash %s", caller_uid, dump_dir_name);
- update_client("Reporting error: %s", errmsg);
- ret[""].push_back("0"); // REPORT_STATUS_IDX_FLAG
- ret[""].push_back(errmsg); // REPORT_STATUS_IDX_MSG
- free(errmsg);
- return ret;
- }
+ free_crash_data(stored_report);
+ char *errmsg = xasprintf("user with uid %ld can't report crash %s", caller_uid, dump_dir_name);
+ update_client("Reporting error: %s", errmsg);
+ ret[""].push_back("0"); // REPORT_STATUS_IDX_FLAG
+ ret[""].push_back(errmsg); // REPORT_STATUS_IDX_MSG
+ free(errmsg);
+ return ret;
}
}
@@ -621,18 +614,13 @@ vector_of_crash_data_t *GetCrashInfos(long caller_uid)
sprintf(caller_uid_str, "%ld", caller_uid);
uid = dd_load_text(dd, FILENAME_UID);
- if (strcmp(uid, caller_uid_str) != 0)
+ bool uid_matches = (uid == NULL || strcmp(uid, caller_uid_str) == 0);
+ free(uid);
+ dd_close(dd);
+ if (!uid_matches)
{
- char *inform_all = dd_load_text_ext(dd, FILENAME_INFORMALL, DD_FAIL_QUIETLY_ENOENT);
- bool for_all = string_to_bool(inform_all);
- free(inform_all);
- if (!for_all)
- {
- dd_close(dd);
- goto next;
- }
+ goto next;
}
- dd_close(dd);
}
{
@@ -768,21 +756,19 @@ 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_ext(dd, FILENAME_UID, DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
+ char *uid = dd_load_text_ext(dd, FILENAME_UID, DD_FAIL_QUIETLY_ENOENT | 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)
{
- if (strcmp(uid, caller_uid_str) != 0)
+ bool uid_matches = (strcmp(uid, caller_uid_str) == 0);
+ free(uid);
+ if (!uid_matches)
{
- 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;
- }
+ 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_event.conf b/src/daemon/abrt_event.conf
index d127d38d..129e532a 100644
--- a/src/daemon/abrt_event.conf
+++ b/src/daemon/abrt_event.conf
@@ -45,14 +45,16 @@ EVENT=post-create abrt-action-save-package-data
include events.d/*.conf
-# 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
+# Example: if you want all users (not just root) to be able to see some problems:
+#EVENT=post-create rm uid; chmod a+rX .
+
+# uid file is missing for problems visible to all users
+# (oops scanner is often set up to not create it).
+# In this case, do not record username too:
+EVENT=post-create if [ -f 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
-# If you want all users (not just root) to be able to see oopses:
-#EVENT=post-create analyzer=Kerneloops echo 1 >inform_all_users
-
# If you want behavior similar to one provided by kerneloops daemon
# distributed by kerneloops.org - that is, if you want
# oopses to be reported automatically and immediately without
@@ -60,6 +62,8 @@ EVENT=post-create analyzer=Kerneloops abrt-action-analyze-oops
#EVENT=post-create analyzer=Kerneloops abrt-action-kerneloops
# Example: if you want to save sosreport immediately at the moment of a crash:
+# (alternatively, you can add similar command to EVENT=analyze_foo's,
+# if you would rather perform this collection later):
#EVENT=post-create
nice sosreport --tmp-dir "$DUMP_DIR" --batch \
--only=anaconda --only=bootloader --only=devicemapper \