From 34dad7f6af8f0cc37bf6eab9461ed52896d4f9d7 Mon Sep 17 00:00:00 2001 From: Matej Habrnal Date: May 20 2015 14:00:35 +0000 Subject: Automatic reporting from GSettings, Spelling/grammar fixes and another fixes Resolves: #1217901 Signed-off-by: Matej Habrnal --- diff --git a/0004-applet-switch-to-D-Bus-methods.patch b/0004-applet-switch-to-D-Bus-methods.patch new file mode 100644 index 0000000..ee6d7c5 --- /dev/null +++ b/0004-applet-switch-to-D-Bus-methods.patch @@ -0,0 +1,427 @@ +From a2977b0fe023a896c3006f27ee2b148690dff24a Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Wed, 8 Apr 2015 08:23:03 +0200 +Subject: [PATCH] applet: switch to D-Bus methods + +This patch is a part of our efforts to make abrt-applet independent on +the backend. + +This patch converts all data manipulation functions to D-Bus calls, so +the notifications are made of data obtained through D-Bus. + +The reporting still relies on file system access, though. + +Signed-off-by: Jakub Filak +--- + src/applet/applet.c | 181 ++++++++++++++++++++++++++++----------------- + src/include/libabrt.h | 16 ++++ + src/lib/problem_api_dbus.c | 61 +++++++++++---- + 3 files changed, 174 insertions(+), 84 deletions(-) + +diff --git a/src/applet/applet.c b/src/applet/applet.c +index 7b58f6e..4df69fc 100644 +--- a/src/applet/applet.c ++++ b/src/applet/applet.c +@@ -120,6 +120,7 @@ typedef struct problem_info { + bool reported; + bool was_announced; + bool is_writable; ++ int time; + } problem_info_t; + + static void push_to_deferred_queue(problem_info_t *pi) +@@ -137,6 +138,59 @@ static const char *problem_info_get_command_line(problem_info_t *pi) + return problem_data_get_content_or_NULL(pi->problem_data, FILENAME_CMDLINE); + } + ++static int problem_info_get_time(problem_info_t *pi) ++{ ++ if (pi->time == -1) ++ { ++ const char *time_str = problem_data_get_content_or_NULL(pi->problem_data, FILENAME_TIME); ++ ++ if (time_str == NULL) ++ error_msg_and_die("BUG: Problem info has data without the element time"); ++ ++ pi->time = atoi(time_str); ++ } ++ ++ return pi->time; ++} ++ ++static const char **problem_info_get_env(problem_info_t *pi) ++{ ++ if (pi->envp == NULL) ++ { ++ const char *env_str = problem_data_get_content_or_NULL(pi->problem_data, FILENAME_ENVIRON); ++ pi->envp = (env_str != NULL) ? g_strsplit (env_str, "\n", -1) : NULL; ++ } ++ ++ return (const char **)pi->envp; ++} ++ ++static int problem_info_get_pid(problem_info_t *pi) ++{ ++ if (pi->pid == -1) ++ { ++ const char *pid_str = problem_data_get_content_or_NULL(pi->problem_data, FILENAME_PID); ++ pi->pid = (pid_str != NULL) ? atoi (pid_str) : -1; ++ } ++ ++ return pi->pid; ++} ++ ++static int problem_info_get_count(problem_info_t *pi) ++{ ++ if (pi->count == -1) ++ { ++ const char *count_str = problem_data_get_content_or_NULL(pi->problem_data, FILENAME_COUNT); ++ pi->count = count_str ? atoi(count_str) : 1; ++ } ++ ++ return pi->count; ++} ++ ++static bool problem_info_is_reported(problem_info_t *pi) ++{ ++ return problem_data_get_content_or_NULL(pi->problem_data, FILENAME_REPORTED_TO) != NULL; ++} ++ + static void problem_info_set_dir(problem_info_t *pi, const char *dir) + { + problem_data_add_text_noteditable(pi->problem_data, CD_DUMPDIR, dir); +@@ -176,6 +230,9 @@ static problem_info_t *problem_info_new(const char *dir) + { + problem_info_t *pi = g_new0(problem_info_t, 1); + pi->refcount = 1; ++ pi->time = -1; ++ pi->pid = -1; ++ pi->count = -1; + pi->problem_data = problem_data_new(); + problem_info_set_dir(pi, dir); + return pi; +@@ -194,8 +251,6 @@ static void problem_info_unref(gpointer data) + return; + + problem_data_free(pi->problem_data); +- if (pi->envp) +- g_strfreev(pi->envp); + g_free(pi); + } + +@@ -556,7 +611,7 @@ static void notify_problem_list(GList *problems) + continue; + } + +- app = problem_create_app_from_env ((const char **)pi->envp, pi->pid); ++ app = problem_create_app_from_env (problem_info_get_env(pi), problem_info_get_pid(pi)); + + if (!app) + app = problem_create_app_from_cmdline (problem_info_get_command_line(pi)); +@@ -572,7 +627,7 @@ static void notify_problem_list(GList *problems) + gboolean is_packaged = pi->is_packaged; + gboolean is_running_again = is_app_running(app); + gboolean is_current_user = !pi->foreign; +- gboolean already_reported = (pi->count > 1); ++ gboolean already_reported = problem_info_get_count(pi) > 1; + + gboolean report_button = FALSE; + gboolean restart_button = FALSE; +@@ -914,14 +969,22 @@ static void Crash(GVariant *parameters) + if (foreign_problem && !g_user_is_admin) + return; + +- struct dump_dir *dd = dd_opendir(dir, DD_OPEN_READONLY); +- char *command_line = dd_load_text_ext(dd, FILENAME_CMDLINE, DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); +- char *count_str = dd_load_text_ext(dd, FILENAME_COUNT, DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); +- guint count = count_str ? atoi(count_str) : 1; +- g_free(count_str); +- char *env = dd_load_text_ext(dd, FILENAME_ENVIRON, DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); +- char *pid = dd_load_text_ext(dd, FILENAME_PID, DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); +- dd_close(dd); ++ static const char *elements[] = { ++ FILENAME_CMDLINE, ++ FILENAME_COUNT, ++ FILENAME_UUID, ++ FILENAME_DUPHASH, ++ FILENAME_COMPONENT, ++ FILENAME_ENVIRON, ++ FILENAME_PID, ++ NULL, ++ }; ++ ++ problem_info_t *pi = problem_info_new(dir); ++ fill_problem_data_over_dbus(dir, elements, pi->problem_data); ++ ++ pi->foreign = foreign_problem; ++ pi->is_packaged = (package_name != NULL); + + /* + * Can't append dir to the seen list because of directory stealing +@@ -929,24 +992,6 @@ static void Crash(GVariant *parameters) + * append_dirlist(dir); + * + */ +- +- problem_info_t *pi = problem_info_new(dir); +- if (uuid != NULL && uuid[0] != '\0') +- problem_data_add_text_noteditable(pi->problem_data, FILENAME_UUID, uuid); +- if (duphash != NULL && duphash[0] != '\0') +- problem_data_add_text_noteditable(pi->problem_data, FILENAME_DUPHASH, duphash); +- if (package_name != NULL && package_name[0] != '\0') +- problem_data_add_text_noteditable(pi->problem_data, FILENAME_COMPONENT, package_name); +- if (command_line != NULL) +- problem_data_add_text_noteditable(pi->problem_data, FILENAME_CMDLINE, command_line); +- pi->foreign = foreign_problem; +- pi->count = count; +- pi->is_packaged = (package_name != NULL); +- pi->envp = (env != NULL) ? g_strsplit (env, "\n", -1) : NULL; +- pi->pid = (pid != NULL) ? atoi (pid) : -1; +- free(command_line); +- free(env); +- free(pid); + show_problem_notification(pi); + } + +@@ -970,6 +1015,19 @@ name_acquired_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) + { ++ static const char *elements[] = { ++ FILENAME_CMDLINE, ++ FILENAME_COUNT, ++ FILENAME_UUID, ++ FILENAME_DUPHASH, ++ FILENAME_COMPONENT, ++ FILENAME_UID, ++ FILENAME_TIME, ++ FILENAME_REPORTED_TO, ++ FILENAME_NOT_REPORTABLE, ++ NULL ++ }; ++ + /* If some new dirs appeared since our last run, let user know it */ + GList *new_dirs = NULL; + GList *notify_list = NULL; +@@ -980,58 +1038,45 @@ name_acquired_handler (GDBusConnection *connection, + /* Age limit = now - 3 days */ + const unsigned long min_born_time = (unsigned long)(time_before_ndays(3)); + +- while (new_dirs) ++ for ( ; new_dirs != NULL; new_dirs = g_list_next(new_dirs)) + { +- struct dump_dir *dd = dd_opendir((char *)new_dirs->data, DD_OPEN_READONLY); +- if (dd == NULL) ++ const char *problem_id = (const char *)new_dirs->data; ++ problem_info_t *pi = problem_info_new(problem_id); ++ ++ if (fill_problem_data_over_dbus(problem_id, elements, pi->problem_data) != 0) + { +- log_notice("'%s' is not a dump dir - ignoring\n", (char *)new_dirs->data); +- new_dirs = g_list_next(new_dirs); ++ log_notice("'%s' is not a dump dir - ignoring\n", problem_id); ++ problem_info_unref(pi); + continue; + } + +- if (dd->dd_time < min_born_time) ++ /* TODO: add a filter for only complete problems to GetProblems D-Bus method */ ++ if (!dbus_problem_is_complete(problem_id)) + { +- log_notice("Ignoring outdated problem '%s'", (char *)new_dirs->data); +- goto next; ++ log_notice("Ignoring incomplete problem '%s'", problem_id); ++ problem_info_unref(pi); ++ continue; + } + +- if (!problem_dump_dir_is_complete(dd)) ++ /* TODO: add a filter for max-old reported problems to GetProblems D-Bus method */ ++ if (problem_info_get_time(pi) < min_born_time) + { +- log_notice("Ignoring incomplete problem '%s'", (char *)new_dirs->data); +- goto next; ++ log_notice("Ignoring outdated problem '%s'", problem_id); ++ problem_info_unref(pi); ++ continue; + } + +- if (!dd_exist(dd, FILENAME_REPORTED_TO)) ++ /* TODO: add a filter for not-yet reported problems to GetProblems D-Bus method */ ++ if (problem_info_is_reported(pi)) + { +- problem_info_t *pi = problem_info_new(new_dirs->data); +- const char *elements[] = {FILENAME_UUID, FILENAME_DUPHASH, FILENAME_COMPONENT, FILENAME_NOT_REPORTABLE, FILENAME_CMDLINE}; +- +- for (size_t i = 0; i < sizeof(elements)/sizeof(*elements); ++i) +- { +- char * const value = dd_load_text_ext(dd, elements[i], +- DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); +- if (value) +- problem_data_add_text_noteditable(pi->problem_data, elements[i], value); +- free(value); +- } +- +- /* Can't be foreign because if the problem is foreign then the +- * dd_opendir() call failed few lines above and the problem is ignored. +- * */ +- pi->foreign = false; +- +- notify_list = g_list_prepend(notify_list, pi); +- } +- else +- { +- log_notice("Ignoring already reported problem '%s'", (char *)new_dirs->data); ++ log_notice("Ignoring already reported problem '%s'", problem_id); ++ problem_info_unref(pi); ++ continue; + } + +-next: +- dd_close(dd); +- +- new_dirs = g_list_next(new_dirs); ++ /* Can't be foreig because new_dir_exists() returns only own problems */ ++ pi->foreign = false; ++ notify_list = g_list_prepend(notify_list, pi); + } + + if (notify_list) +diff --git a/src/include/libabrt.h b/src/include/libabrt.h +index 19ad4a8..07dc172 100644 +--- a/src/include/libabrt.h ++++ b/src/include/libabrt.h +@@ -164,6 +164,15 @@ int chown_dir_over_dbus(const char *problem_dir_path); + int test_exist_over_dbus(const char *problem_id, const char *element_name); + + /** ++ @brief Checks whether the problem corresponding to the given ID is complete ++ ++ Might require authorization ++ ++ @return Positive number if such the proble is complete, 0 if doesn't and negative number if an error occurs. ++ */ ++int dbus_problem_is_complete(const char *problem_id); ++ ++/** + @ Returns value of the given element name + + Might require authorization +@@ -182,6 +191,13 @@ char *load_text_over_dbus(const char *problem_id, const char *element_name); + int delete_problem_dirs_over_dbus(const GList *problem_dir_paths); + + /** ++ @brief Fetches given problem elements for specified problem id ++ ++ @return on failures returns non zero value and emits error message ++*/ ++int fill_problem_data_over_dbus(const char *problem_dir_path, const char **elements, problem_data_t *problem_data); ++ ++/** + @brief Fetches problem information for specified problem id + + @return problem_data_t or NULL on failure +diff --git a/src/lib/problem_api_dbus.c b/src/lib/problem_api_dbus.c +index 5148932..ce5c47b 100644 +--- a/src/lib/problem_api_dbus.c ++++ b/src/lib/problem_api_dbus.c +@@ -101,23 +101,21 @@ int delete_problem_dirs_over_dbus(const GList *problem_dir_paths) + return 0; + } + +-problem_data_t *get_problem_data_dbus(const char *problem_dir_path) ++int fill_problem_data_over_dbus(const char *problem_id, const char **elements, problem_data_t *problem_data) + { + INITIALIZE_LIBABRT(); + + GDBusProxy *proxy = get_dbus_proxy(); + if (!proxy) +- return NULL; ++ return -1; + +- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("as")); +- g_variant_builder_add(builder, "s", FILENAME_TIME ); +- g_variant_builder_add(builder, "s", FILENAME_REASON ); +- g_variant_builder_add(builder, "s", FILENAME_NOT_REPORTABLE); +- g_variant_builder_add(builder, "s", FILENAME_COMPONENT ); +- g_variant_builder_add(builder, "s", FILENAME_EXECUTABLE ); +- g_variant_builder_add(builder, "s", FILENAME_REPORTED_TO ); +- GVariant *params = g_variant_new("(sas)", problem_dir_path, builder); +- g_variant_builder_unref(builder); ++ GVariantBuilder *args_builder = g_variant_builder_new(G_VARIANT_TYPE("as")); ++ ++ for (const char **iter = elements; *iter; ++iter) ++ g_variant_builder_add(args_builder, "s", *iter); ++ ++ GVariant *params = g_variant_new("(sas)", problem_id, args_builder); ++ g_variant_builder_unref(args_builder); + + GError *error = NULL; + GVariant *result = g_dbus_proxy_call_sync(proxy, +@@ -130,20 +128,46 @@ problem_data_t *get_problem_data_dbus(const char *problem_dir_path) + + if (error) + { +- error_msg(_("Can't get problem data from abrt-dbus: %s"), error->message); ++ error_msg(_("D-Bus GetInfo method call failed: %s"), error->message); + g_error_free(error); +- return NULL; ++ return -2; + } + +- problem_data_t *pd = problem_data_new(); ++ + char *key, *val; + GVariantIter *iter; + g_variant_get(result, "(a{ss})", &iter); + while (g_variant_iter_loop(iter, "{ss}", &key, &val)) ++ problem_data_add_text_noteditable(problem_data, key, val); ++ ++ g_variant_unref(result); ++ ++ return 0; ++} ++ ++problem_data_t *get_problem_data_dbus(const char *problem_dir_path) ++{ ++ INITIALIZE_LIBABRT(); ++ ++ static const char *elements[] = { ++ FILENAME_TIME, ++ FILENAME_REASON, ++ FILENAME_NOT_REPORTABLE, ++ FILENAME_COMPONENT, ++ FILENAME_EXECUTABLE, ++ FILENAME_REPORTED_TO, ++ NULL, ++ }; ++ ++ problem_data_t *pd = problem_data_new(); ++ ++ if (fill_problem_data_over_dbus(problem_dir_path, elements, pd) != 0) + { +- problem_data_add_text_noteditable(pd, key, val); ++ error_msg(_("Can't get problem data from abrt-dbus")); ++ problem_data_free(pd); ++ return NULL; + } +- g_variant_unref(result); ++ + return pd; + } + +@@ -259,6 +283,11 @@ int test_exist_over_dbus(const char *problem_id, const char *element_name) + return retval; + } + ++int dbus_problem_is_complete(const char *problem_id) ++{ ++ return test_exist_over_dbus(problem_id, FILENAME_COUNT); ++} ++ + char *load_text_over_dbus(const char *problem_id, const char *element_name) + { + INITIALIZE_LIBABRT(); +-- +2.4.1 + diff --git a/0005-lib-add-new-kernel-taint-flags.patch b/0005-lib-add-new-kernel-taint-flags.patch new file mode 100644 index 0000000..555c5a5 --- /dev/null +++ b/0005-lib-add-new-kernel-taint-flags.patch @@ -0,0 +1,60 @@ +From e52d14214bd356f31856a5ab63ef14a60d318364 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Tue, 5 May 2015 10:46:06 +0200 +Subject: [PATCH] lib: add new kernel taint flags + +Signed-off-by: Jakub Filak +--- + src/lib/kernel.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/src/lib/kernel.c b/src/lib/kernel.c +index af43ae0..dde3d28 100644 +--- a/src/lib/kernel.c ++++ b/src/lib/kernel.c +@@ -632,8 +632,14 @@ char *koops_extract_version(const char *linepointer) + * 'W' - Taint on warning. + * 'C' - modules from drivers/staging are loaded. + * 'I' - Working around severe firmware bug. ++ * 'O' - Out-of-tree module has been loaded. ++ * 'E' - Unsigned module has been loaded. ++ * 'L' - A soft lockup has previously occurred. ++ * 'K' - Kernel has been live patched. ++ * ++ * Compatibility flags from older versions and downstream sources: + * 'H' - Hardware is unsupported. +- * T - Tech_preview ++ * 'T' - Tech_preview + */ + + #if 0 /* unused */ +@@ -658,7 +664,7 @@ char *kernel_tainted_short(const char *kernel_bt) + return NULL; + + tainted += strlen("Tainted: "); +- /* 13 == current count of known flags */ ++ /* 17 + 2 == current count of known flags */ + /* http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=kernel/panic.c;hb=HEAD */ + /* 26 the maximal sane count of flags because of alphabet limits */ + unsigned sz = 26 + 1; +@@ -701,14 +707,14 @@ static const char *const tnts_long[] = { + /* B */ "System has hit bad_page.", + /* C */ "Modules from drivers/staging are loaded.", + /* D */ "Kernel has oopsed before", +- /* E */ NULL, ++ /* E */ "Unsigned module has been loaded." + /* F */ "Module has been forcibly loaded.", + /* G */ "Proprietary module has not been loaded.", + /* H */ NULL, + /* I */ "Working around severe firmware bug.", + /* J */ NULL, +- /* K */ NULL, +- /* L */ NULL, ++ /* K */ "Kernel has been live patched.", ++ /* L */ "A soft lockup has previously occurred.", + /* M */ "System experienced a machine check exception.", + /* N */ NULL, + /* O */ "Out-of-tree module has been loaded.", +-- +2.4.1 + diff --git a/0006-upload-validate-and-sanitize-uploaded-dump-directori.patch b/0006-upload-validate-and-sanitize-uploaded-dump-directori.patch new file mode 100644 index 0000000..6823b33 --- /dev/null +++ b/0006-upload-validate-and-sanitize-uploaded-dump-directori.patch @@ -0,0 +1,142 @@ +From 3746b7627218438ae7d781fc8b18a221454e9091 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Mon, 20 Apr 2015 15:15:40 +0200 +Subject: [PATCH] upload: validate and sanitize uploaded dump directories + +It was discovered that, when moving problem reports from +/var/spool/abrt-upload to /var/spool/abrt or /var/tmp/abrt, +abrt-handle-upload does not verify that the new problem directory +has appropriate permissions and does not contain symbolic links. A +crafted problem report exposes other parts of abrt to attack, and +the abrt-handle-upload script allows to overwrite arbitrary files. + +Acknowledgement: + +This issue was discovered by Florian Weimer of Red Hat Product Security. + +Related: #1212953 + +Signed-off-by: Jakub Filak +--- + src/daemon/abrt-handle-upload.in | 78 +++++++++++++++++++++++++++++++++++----- + 1 file changed, 70 insertions(+), 8 deletions(-) + +diff --git a/src/daemon/abrt-handle-upload.in b/src/daemon/abrt-handle-upload.in +index 45ba72d..e812ef0 100755 +--- a/src/daemon/abrt-handle-upload.in ++++ b/src/daemon/abrt-handle-upload.in +@@ -10,6 +10,7 @@ import getopt + import tempfile + import shutil + import datetime ++import grp + + from reportclient import set_verbosity, error_msg_and_die, error_msg, log + +@@ -36,12 +37,77 @@ def init_gettext(): + + import problem + +-def write_str_to(filename, s): +- fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, @DEFAULT_DUMP_DIR_MODE@ | stat.S_IROTH) ++def write_str_to(filename, s, uid, gid, mode): ++ fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, mode) + if fd >= 0: ++ os.fchown(fd, uid, gid) + os.write(fd, s) + os.close(fd) + ++ ++def validate_transform_move_and_notify(uploaded_dir_path, problem_dir_path, dest=None): ++ fsuid = 0 ++ fsgid = 0 ++ ++ try: ++ gabrt = grp.getgrnam("abrt") ++ fsgid = gabrt.gr_gid ++ except KeyError as ex: ++ error_msg("Failed to get GID of 'abrt' (using 0 instead): {0}'".format(str(ex))) ++ ++ try: ++ # give the uploaded directory to 'root:abrt' or 'root:root' ++ os.chown(uploaded_dir_path, fsuid, fsgid) ++ # set the right permissions for this machine ++ # (allow the owner and the group to access problem elements, ++ # the default dump dir mode lacks x bit for both) ++ os.chmod(uploaded_dir_path, @DEFAULT_DUMP_DIR_MODE@ | stat.S_IXUSR | stat.S_IXGRP) ++ ++ # sanitize problem elements ++ for item in os.listdir(uploaded_dir_path): ++ apath = os.path.join(uploaded_dir_path, item) ++ if os.path.islink(apath): ++ # remove symbolic links ++ os.remove(apath) ++ elif os.path.isdir(apath): ++ # remove directories ++ shutil.rmtree(apath) ++ elif os.path.isfile(apath): ++ # set file ownership to 'root:abrt' or 'root:root' ++ os.chown(apath, fsuid, fsgid) ++ # set the right file permissions for this machine ++ os.chmod(apath, @DEFAULT_DUMP_DIR_MODE@) ++ else: ++ # remove things that are neither files, symlinks nor directories ++ os.remove(apath) ++ except OSError as ex: ++ error_msg("Removing uploaded dir '{0}': '{1}'".format(uploaded_dir_path, str(ex))) ++ try: ++ shutil.rmtree(uploaded_dir_path) ++ except OSError as ex2: ++ error_msg_and_die("Failed to clean up dir '{0}': '{1}'".format(uploaded_dir_path, str(ex2))) ++ return ++ ++ # overwrite remote if it exists ++ remote_path = os.path.join(uploaded_dir_path, "remote") ++ write_str_to(remote_path, "1", fsuid, fsgid, @DEFAULT_DUMP_DIR_MODE@) ++ ++ # abrtd would increment count value and abrt-server refuses to process ++ # problem directories containing 'count' element when PrivateReports is on. ++ count_path = os.path.join(uploaded_dir_path, "count") ++ if os.path.exists(count_path): ++ # overwrite remote_count if it exists ++ remote_count_path = os.path.join(uploaded_dir_path, "remote_count") ++ os.rename(count_path, remote_count_path) ++ ++ if not dest: ++ dest = problem_dir_path ++ ++ shutil.move(uploaded_dir_path, dest) ++ ++ problem.notify_new_path(problem_dir_path) ++ ++ + if __name__ == "__main__": + + # Helper: exit with cleanup +@@ -177,21 +243,17 @@ if __name__ == "__main__": + # or one or more complete problem data directories. + # Checking second possibility first. + if (os.path.exists(tempdir+"/analyzer") or os.path.exists(tempdir+"/type")) and os.path.exists(tempdir+"/time"): +- write_str_to(tempdir+"/remote", "1") +- shutil.move(tempdir, abrt_dir) +- problem.notify_new_path(abrt_dir+"/"+os.path.basename(tempdir)) ++ validate_transform_move_and_notify(tempdir, abrt_dir+"/"+os.path.basename(tempdir), dest=abrt_dir) + else: + for d in os.listdir(tempdir): + if not os.path.isdir(tempdir+"/"+d): + continue +- write_str_to(tempdir+"/"+d+"/remote", "1") + dst = abrt_dir+"/"+d + if os.path.exists(dst): + dst += "."+str(os.getpid()) + if os.path.exists(dst): + continue +- shutil.move(tempdir+"/"+d, dst) +- problem.notify_new_path(dst) ++ validate_transform_move_and_notify(tempdir+"/"+d, dst) + + die_exitcode = 0 + # This deletes working_dir (== delete_on_exit) +-- +2.4.1 + diff --git a/0008-a-a-s-p-d-add-new-known-interpreter-to-conf-file.patch b/0008-a-a-s-p-d-add-new-known-interpreter-to-conf-file.patch new file mode 100644 index 0000000..7a254b7 --- /dev/null +++ b/0008-a-a-s-p-d-add-new-known-interpreter-to-conf-file.patch @@ -0,0 +1,29 @@ +From 7d5be427e208e565ee16a7f34be64acb781fb2f9 Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Mon, 18 May 2015 08:45:48 +0200 +Subject: [PATCH] a-a-s-p-d: add new known interpreter to conf file + +There were new bugzillas opened with wrong component 'python3' because of a new +version of python (3.4). We don't want to blame the interpreters but the +running scripts. + +close #965 + +Signed-off-by: Matej Habrnal +--- + src/daemon/abrt-action-save-package-data.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon/abrt-action-save-package-data.conf b/src/daemon/abrt-action-save-package-data.conf +index 33cef8f..27b9607 100644 +--- a/src/daemon/abrt-action-save-package-data.conf ++++ b/src/daemon/abrt-action-save-package-data.conf +@@ -18,4 +18,4 @@ ProcessUnpackaged = yes + BlackListedPaths = /usr/share/doc/*, */example*, /usr/bin/nspluginviewer + + # interpreters names +-Interpreters = python2, python2.7, python, python3, python3.3, perl, perl5.16.2 ++Interpreters = python2, python2.7, python, python3, python3.3, python3.4, python3.5, perl, perl5.16.2 +-- +2.4.1 + diff --git a/0010-applet-fix-problem-info-double-free.patch b/0010-applet-fix-problem-info-double-free.patch new file mode 100644 index 0000000..256ba04 --- /dev/null +++ b/0010-applet-fix-problem-info-double-free.patch @@ -0,0 +1,41 @@ +From 65c24bb248b9b7b2e33e8b0ba9e3e06ffde4b291 Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Mon, 18 May 2015 15:46:59 +0200 +Subject: [PATCH] applet: fix problem info double free + +There was a double free when an action function was called. +Problem info is freed when the notification is destroyed because the free +function is registred when the action is added +(notify_notification_add_action()). So the problem_info_unref() function in the +action function is moreover and causes the double free problem. + +Related to rhbz#1211644 + +Signed-off-by: Matej Habrnal +--- + src/applet/applet.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/applet/applet.c b/src/applet/applet.c +index 4df69fc..c00f7e3 100644 +--- a/src/applet/applet.c ++++ b/src/applet/applet.c +@@ -501,7 +501,6 @@ static void action_report(NotifyNotification *notification, gchar *action, gpoin + problem_info_t *pi = (problem_info_t *)user_data; + if (problem_info_get_dir(pi)) + fork_exec_gui(problem_info_get_dir(pi)); +- problem_info_unref(pi); + } + + static void action_restart(NotifyNotification *notification, gchar *action, gpointer user_data) +@@ -528,7 +527,6 @@ static void action_restart(NotifyNotification *notification, gchar *action, gpoi + err->message); + } + g_object_unref (app); +- problem_info_unref(pi); + } + + static void on_notify_close(NotifyNotification *notification, gpointer user_data) +-- +2.4.1 + diff --git a/0011-cli-do-not-exit-with-segfault-if-dbus-fails.patch b/0011-cli-do-not-exit-with-segfault-if-dbus-fails.patch new file mode 100644 index 0000000..c17e33e --- /dev/null +++ b/0011-cli-do-not-exit-with-segfault-if-dbus-fails.patch @@ -0,0 +1,30 @@ +From 82957a3390188509921ec16bddc27f2aeeb01b8d Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Mon, 4 May 2015 10:35:25 +0200 +Subject: [PATCH] cli: do not exit with segfault if dbus fails + +There was a segfault when we ran 'abrt-cli list' and dbus failed. + +Related to rhbz#1217901 + +Signed-off-by: Matej Habrnal +--- + src/cli/list.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/cli/list.c b/src/cli/list.c +index c0c819d..31d1835 100644 +--- a/src/cli/list.c ++++ b/src/cli/list.c +@@ -142,6 +142,8 @@ int cmd_list(int argc, const char **argv) + parse_opts(argc, (char **)argv, program_options, program_usage_string); + + vector_of_problem_data_t *ci = fetch_crash_infos(); ++ if (ci == NULL) ++ return 1; + + g_ptr_array_sort_with_data(ci, &cmp_problem_data, (char *) FILENAME_LAST_OCCURRENCE); + +-- +2.4.1 + diff --git a/0013-abrt-auto-reporting-require-rhtsupport.conf-file-onl.patch b/0013-abrt-auto-reporting-require-rhtsupport.conf-file-onl.patch new file mode 100644 index 0000000..5fec7d9 --- /dev/null +++ b/0013-abrt-auto-reporting-require-rhtsupport.conf-file-onl.patch @@ -0,0 +1,589 @@ +From 0b8955a845f7a28a090bfe07d33a0acf161526e2 Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Fri, 24 Apr 2015 15:37:15 +0200 +Subject: [PATCH] abrt-auto-reporting: require rhtsupport.conf file only on + RHEL + +abrt-auto-reporting required the rhtsupport.conf on Fedora and CentOS but the conf +file do not exists in those systems. + +Resolves abrt/abrt#957 + +Signed-off-by: Matej Habrnal +--- + configure.ac | 11 +++ + doc/Makefile.am | 13 +++- + doc/abrt-auto-reporting-authenticated.txt | 106 ++++++++++++++++++++++++++++ + doc/abrt-auto-reporting-unauthenticated.txt | 71 +++++++++++++++++++ + doc/abrt-auto-reporting.txt | 106 ---------------------------- + src/daemon/abrt-auto-reporting.c | 71 ++++++++++++++----- + 6 files changed, 254 insertions(+), 124 deletions(-) + create mode 100644 doc/abrt-auto-reporting-authenticated.txt + create mode 100644 doc/abrt-auto-reporting-unauthenticated.txt + delete mode 100644 doc/abrt-auto-reporting.txt + +diff --git a/configure.ac b/configure.ac +index acd0d32..6962d2c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -296,6 +296,17 @@ AC_ARG_ENABLE(suggest-autoreporting, + + AM_CONDITIONAL(SUGGEST_AUTOREPORTING, test "$enable_suggest_autoreporting" = "yes") + ++# Authenticated autoreporting ++ ++AC_ARG_ENABLE(authenticated-autoreporting, ++ AS_HELP_STRING([--enable-authenticated-autoreporting], ++ [enable authenticated autoreporting]), ++ [enable_authenticated_autoreporting=$enableval], ++ [enable_authenticated_autoreporting=no] ++) ++ ++AM_CONDITIONAL(AUTHENTICATED_AUTOREPORTING, test "$enable_authenticated_autoreporting" = "yes") ++ + # Make satyr use GDB or elfutils/libunwind for unwinding? + + AC_ARG_ENABLE([native-unwinder], +diff --git a/doc/Makefile.am b/doc/Makefile.am +index 6efd6d6..3e7499c 100644 +--- a/doc/Makefile.am ++++ b/doc/Makefile.am +@@ -78,6 +78,17 @@ man1_MANS = ${MAN1_TXT:%.txt=%.1} + man5_MANS = ${MAN5_TXT:%.txt=%.5} ${MAN5_PREFORMATTED} + man8_MANS = ${MAN8_TXT:%.txt=%.8} + ++MAN_SOURCE = ++MAN_SOURCE = abrt-auto-reporting-authenticated.txt ++MAN_SOURCE = abrt-auto-reporting-unauthenticated.txt ++ ++if AUTHENTICATED_AUTOREPORTING ++abrt-auto-reporting.txt: abrt-auto-reporting-authenticated.txt ++else ++abrt-auto-reporting.txt: abrt-auto-reporting-unauthenticated.txt ++endif ++ cp $< $@ ++ + %.1 %.5 %.8: %.xml + $(XMLTO_SILENT) xmlto man $< 2>&1 | sed '/Note/d' + +@@ -86,6 +97,6 @@ man8_MANS = ${MAN8_TXT:%.txt=%.8} + --conf-file ../asciidoc.conf \ + -aabrt_version=$(PACKAGE_VERSION) -o $@ $< + +-EXTRA_DIST = $(MAN1_TXT) $(MAN5_TXT) $(MAN8_TXT) $(MAN5_PREFORMATTED) ++EXTRA_DIST = $(MAN1_TXT) $(MAN5_TXT) $(MAN8_TXT) $(MAN5_PREFORMATTED) $(MAN_SOURCE) + + CLEANFILES = ${MAN1_TXT:%.txt=%.1} ${MAN5_TXT:%.txt=%.5} ${MAN8_TXT:%.txt=%.8} +diff --git a/doc/abrt-auto-reporting-authenticated.txt b/doc/abrt-auto-reporting-authenticated.txt +new file mode 100644 +index 0000000..2a27945 +--- /dev/null ++++ b/doc/abrt-auto-reporting-authenticated.txt +@@ -0,0 +1,106 @@ ++abrt-auto-reporting(1) ++====================== ++ ++NAME ++---- ++abrt-auto-reporting - Get or modify the auto reporting option values ++ ++SYNOPSIS ++-------- ++'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ] ++ [ [--anonymous] | ++ [--username USERNAME [--password PASSWORD] ] | ++ [--certificate SOURCE] ] ++ ++DESCRIPTION ++----------- ++Reads the configuration from abrt.conf and saves the changes to the same file. ++ ++The changes will take effect immediately without necessity to restart any ABRT ++process and will be persistent. ++ ++'disabled':: ++ User have to report the detect problems manually ++ ++'enabled':: ++ ABRT uploads an uReport which was generated for a detected problem ++ immediately after the detection phase. ++ ++Reads and saves the authentication configuration options in ++/etc/libreport/plugins/ureport.conf and /etc/libreport/plugins/rhtsupport.conf ++ ++uReport description ++~~~~~~~~~~~~~~~~~~~ ++ABRT supports uReports for four types of crashes: crashes of C/C++ programs ++that result in a core dump, uncaught Python exceptions, uncaught Java ++exceptions and kernel oopses. ++ ++Each uReport generally contains a stack trace, or multiple stack traces in the ++case of multi-threaded C/C++ and Java programs. The stack trace only describes ++the call stack of the program at the time of the crash and does not contain ++contents of any variables. ++ ++Every uReport also contains identification of the operating system, versions of ++the RPM packages involved in the crash, and whether the program ran under a ++root user. ++ ++There are also items specific to each crash type: ++ ++C/C++ crashes:: ++ these are path to the executable and signal delivered to the program, ++ ++Python exceptions:: ++ there is the type of the exception (without the error message, which may ++ contain sensitive data), ++ ++for kernel oopses:: ++ these are list of loaded kernel modules, list of taint flags, and full text ++ of the kernel oops. ++ ++The authenticated uReports also contains *hostname* and *machineid* to enable a ++server side filtering at https://access.redhat.com/. ++ ++The authenticated uReports have the benefit of rich server replies which may ++include a solution for the submitted crash. The authentication is done using ++either Red Hat Subscription Certificates or Red Hat Customer Portal ++credentials. ++ ++'Warning': ++The full text of a kernel oops might contain information like the ++identification of the host hardware type. You should disable the autoreporting ++feature if you do not want to share this information with Red Hat. ++ ++ ++OPTIONS ++------- ++-v, --verbose:: ++ Be more verbose. Can be given multiple times. ++ ++-a, --anonymous:: ++ Turns the authentication off by clearing both 'SSLClientAuth' and 'HTTPAuth' ++ configuration options in /etc/libreport/plugins/ureport.conf ++ ++-u, --username USERNAME:: ++ Turns HTTP Authentication on by setting 'HTTPAuth' configuration option to ++ *rhts-credentials* in /etc/libreport/plugins/ureport.conf and storing ++ USERNAME and PASSWORD in /etc/libreport/plugins/rhtsupport.conf ++ Also turns the SSL Client Authentication off, because these methods cannot ++ be used together. ++ ++-p, --password PASSWORD:: ++ Password for HTTP Authentication. If not provided, a prompt asking for it ++ will be issued. ++ ++-c, --certificate SOURCE:: ++ Turns SSL Client Authentication on by setting 'SSLClientAuth' configuration ++ option to SOURCE in /etc/libreport/plugins/ureport.conf. ++ Also turns the HTTP Authentication off, because these methods cannot ++ be used together. ++ ++SEE ALSO ++-------- ++abrt.conf(5), ureport.conf(5), rhtsupport.conf(5) ++ ++AUTHORS ++------- ++* ABRT team +diff --git a/doc/abrt-auto-reporting-unauthenticated.txt b/doc/abrt-auto-reporting-unauthenticated.txt +new file mode 100644 +index 0000000..320c803 +--- /dev/null ++++ b/doc/abrt-auto-reporting-unauthenticated.txt +@@ -0,0 +1,71 @@ ++abrt-auto-reporting(1) ++====================== ++ ++NAME ++---- ++abrt-auto-reporting - Get or modify the auto reporting option values ++ ++SYNOPSIS ++-------- ++'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ] ++ ++DESCRIPTION ++----------- ++Reads the configuration from abrt.conf and saves the changes to the same file. ++ ++The changes will take effect immediately without necessity to restart any ABRT ++process and will be persistent. ++ ++'disabled':: ++ User have to report the detect problems manually ++ ++'enabled':: ++ ABRT uploads an uReport which was generated for a detected problem ++ immediately after the detection phase. ++ ++uReport description ++~~~~~~~~~~~~~~~~~~~ ++ABRT supports uReports for four types of crashes: crashes of C/C++ programs ++that result in a core dump, uncaught Python exceptions, uncaught Java ++exceptions and kernel oopses. ++ ++Each uReport generally contains a stack trace, or multiple stack traces in the ++case of multi-threaded C/C++ and Java programs. The stack trace only describes ++the call stack of the program at the time of the crash and does not contain ++contents of any variables. ++ ++Every uReport also contains identification of the operating system, versions of ++the RPM packages involved in the crash, and whether the program ran under a ++root user. ++ ++There are also items specific to each crash type: ++ ++C/C++ crashes:: ++ these are path to the executable and signal delivered to the program, ++ ++Python exceptions:: ++ there is the type of the exception (without the error message, which may ++ contain sensitive data), ++ ++for kernel oopses:: ++ these are list of loaded kernel modules, list of taint flags, and full text ++ of the kernel oops. ++ ++'Warning': ++The full text of a kernel oops might contain information like the ++identification of the host hardware type. You should disable the autoreporting ++feature if you do not want to share this information with Red Hat. ++ ++ ++OPTIONS ++------- ++-v, --verbose:: ++ Be more verbose. Can be given multiple times. ++ ++SEE ALSO ++-------- ++abrt.conf(5) ++ ++AUTHORS ++------- ++* ABRT team +diff --git a/doc/abrt-auto-reporting.txt b/doc/abrt-auto-reporting.txt +deleted file mode 100644 +index 2a27945..0000000 +--- a/doc/abrt-auto-reporting.txt ++++ /dev/null +@@ -1,106 +0,0 @@ +-abrt-auto-reporting(1) +-====================== +- +-NAME +----- +-abrt-auto-reporting - Get or modify the auto reporting option values +- +-SYNOPSIS +--------- +-'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ] +- [ [--anonymous] | +- [--username USERNAME [--password PASSWORD] ] | +- [--certificate SOURCE] ] +- +-DESCRIPTION +------------ +-Reads the configuration from abrt.conf and saves the changes to the same file. +- +-The changes will take effect immediately without necessity to restart any ABRT +-process and will be persistent. +- +-'disabled':: +- User have to report the detect problems manually +- +-'enabled':: +- ABRT uploads an uReport which was generated for a detected problem +- immediately after the detection phase. +- +-Reads and saves the authentication configuration options in +-/etc/libreport/plugins/ureport.conf and /etc/libreport/plugins/rhtsupport.conf +- +-uReport description +-~~~~~~~~~~~~~~~~~~~ +-ABRT supports uReports for four types of crashes: crashes of C/C++ programs +-that result in a core dump, uncaught Python exceptions, uncaught Java +-exceptions and kernel oopses. +- +-Each uReport generally contains a stack trace, or multiple stack traces in the +-case of multi-threaded C/C++ and Java programs. The stack trace only describes +-the call stack of the program at the time of the crash and does not contain +-contents of any variables. +- +-Every uReport also contains identification of the operating system, versions of +-the RPM packages involved in the crash, and whether the program ran under a +-root user. +- +-There are also items specific to each crash type: +- +-C/C++ crashes:: +- these are path to the executable and signal delivered to the program, +- +-Python exceptions:: +- there is the type of the exception (without the error message, which may +- contain sensitive data), +- +-for kernel oopses:: +- these are list of loaded kernel modules, list of taint flags, and full text +- of the kernel oops. +- +-The authenticated uReports also contains *hostname* and *machineid* to enable a +-server side filtering at https://access.redhat.com/. +- +-The authenticated uReports have the benefit of rich server replies which may +-include a solution for the submitted crash. The authentication is done using +-either Red Hat Subscription Certificates or Red Hat Customer Portal +-credentials. +- +-'Warning': +-The full text of a kernel oops might contain information like the +-identification of the host hardware type. You should disable the autoreporting +-feature if you do not want to share this information with Red Hat. +- +- +-OPTIONS +-------- +--v, --verbose:: +- Be more verbose. Can be given multiple times. +- +--a, --anonymous:: +- Turns the authentication off by clearing both 'SSLClientAuth' and 'HTTPAuth' +- configuration options in /etc/libreport/plugins/ureport.conf +- +--u, --username USERNAME:: +- Turns HTTP Authentication on by setting 'HTTPAuth' configuration option to +- *rhts-credentials* in /etc/libreport/plugins/ureport.conf and storing +- USERNAME and PASSWORD in /etc/libreport/plugins/rhtsupport.conf +- Also turns the SSL Client Authentication off, because these methods cannot +- be used together. +- +--p, --password PASSWORD:: +- Password for HTTP Authentication. If not provided, a prompt asking for it +- will be issued. +- +--c, --certificate SOURCE:: +- Turns SSL Client Authentication on by setting 'SSLClientAuth' configuration +- option to SOURCE in /etc/libreport/plugins/ureport.conf. +- Also turns the HTTP Authentication off, because these methods cannot +- be used together. +- +-SEE ALSO +--------- +-abrt.conf(5), ureport.conf(5), rhtsupport.conf(5) +- +-AUTHORS +-------- +-* ABRT team +diff --git a/src/daemon/abrt-auto-reporting.c b/src/daemon/abrt-auto-reporting.c +index 0fffeb6..b608c9b 100644 +--- a/src/daemon/abrt-auto-reporting.c ++++ b/src/daemon/abrt-auto-reporting.c +@@ -64,6 +64,7 @@ set_abrt_reporting(map_string_t *conf, const char *opt_value) + return 1; + } + ++#if AUTHENTICATED_AUTOREPORTING != 0 + static int + set_ureport_http_auth(map_string_t *conf, const char *opt_value) + { +@@ -134,6 +135,7 @@ set_rhts_credentials(map_string_t *conf, const char *username, const char *passw + /* No changes needed -> success */ + return 1; + } ++#endif + + static const char * + get_abrt_reporting(map_string_t *conf) +@@ -143,6 +145,7 @@ get_abrt_reporting(map_string_t *conf) + return REPORTING_STATES[index][0]; + } + ++#if AUTHENTICATED_AUTOREPORTING != 0 + static const char * + get_ureport_http_auth(map_string_t *conf) + { +@@ -154,6 +157,7 @@ get_ureport_client_auth(map_string_t *conf) + { + return get_map_string_item_or_NULL(conf, UREPORT_CLIENT_AUTH_OPTION); + } ++#endif + + int main(int argc, char *argv[]) + { +@@ -171,57 +175,78 @@ int main(int argc, char *argv[]) + textdomain(PACKAGE); + #endif + ++#define PROGRAM_USAGE_MIDDLE_PART \ ++ "\n" \ ++ "Get or modify a value of the auto-reporting option. The changes will take\n" \ ++ "effect immediately and will be persistent.\n" \ ++ "\n" \ ++ ""STATE_MANUAL":\n" \ ++ "User have to report the detect problems manually\n" \ ++ "\n" \ ++ ""STATE_AUTO":\n" \ ++ "ABRT uploads an uReport which was generated for a detected problem\n" \ ++ "immediately after the detection phase. uReport generally contains a stack\n" \ ++ "trace which only describes the call stack of the program at the time of the\n" \ ++ "crash and does not contain contents of any variables. Every uReport also\n" \ ++ "contains identification of the operating system, versions of the RPM packages\n" \ ++ "involved in the crash, and whether the program ran under a root user.\n" \ ++ "\n" ++ + abrt_init(argv); ++#if AUTHENTICATED_AUTOREPORTING != 0 + const char *program_usage_string = _( + "& [ "STATE_MANUAL" | "STATE_AUTO" | yes | no | 1 | 0 ] \\\n" + " [[--anonymous] | [--username USERNAME [--password PASSWORD]] | [--certificate SOURCE]]\n" +- "\n" +- "Get or modify a value of the auto-reporting option. The changes will take\n" +- "effect immediately and will be persistent.\n" +- "\n" +- ""STATE_MANUAL":\n" +- "User have to report the detect problems manually\n" +- "\n" +- ""STATE_AUTO":\n" +- "ABRT uploads an uReport which was generated for a detected problem\n" +- "immediately after the detection phase. uReport generally contains a stack\n" +- "trace which only describes the call stack of the program at the time of the\n" +- "crash and does not contain contents of any variables. Every uReport also\n" +- "contains identification of the operating system, versions of the RPM packages\n" +- "involved in the crash, and whether the program ran under a root user.\n" +- "\n" ++ PROGRAM_USAGE_MIDDLE_PART + "See abrt-auto-reporting(1), reporter-ureport(1) and reporter-rhtsupport(1)\n" + "for more details.\n" + ); ++#else ++ const char *program_usage_string = _( ++ "& [ "STATE_MANUAL" | "STATE_AUTO" | yes | no | 1 | 0 ]\n" ++ PROGRAM_USAGE_MIDDLE_PART ++ "See abrt-auto-reporting(1) and reporter-ureport(1) for more details.\n" ++ ); ++#endif + + enum { + OPT_v = 1 << 0, ++#if AUTHENTICATED_AUTOREPORTING != 0 + OPT_a = 1 << 1, + OPT_u = 1 << 2, + OPT_p = 1 << 3, + OPT_c = 1 << 4, ++#endif + }; + ++#if AUTHENTICATED_AUTOREPORTING != 0 + int anonymous = 0; + const char *username = NULL; + const char *password = NULL; + const char *certificate = NULL; ++#endif + + /* Keep enum above and order of options below in sync! */ + struct options program_options[] = { + OPT__VERBOSE(&g_verbose), ++#if AUTHENTICATED_AUTOREPORTING != 0 + OPT_BOOL ( 'a', "anonymous", &anonymous, _("Turns the authentication off")), + OPT_STRING( 'u', "username", &username, "USERNAME", _("Red Hat Support user name")), + OPT_STRING( 'p', "password", &password, "PASSWORD", _("Red Hat Support password, if not given, a prompt for it will be issued")), + OPT_STRING( 'c', "certificate", &certificate, "SOURCE", _("uReport SSL certificate paths or certificate type")), ++#endif + OPT_END() + }; + +- const unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); ++#if AUTHENTICATED_AUTOREPORTING != 0 ++ const unsigned opts = ++#endif ++ parse_opts(argc, argv, program_options, program_usage_string); + + argv += optind; + argc -= optind; + ++#if AUTHENTICATED_AUTOREPORTING != 0 + if ((opts & OPT_p) && !(opts & OPT_u)) + { + error_msg(_("You also need to specify --username for --password")); +@@ -246,6 +271,7 @@ int main(int argc, char *argv[]) + show_usage_and_die(program_usage_string, program_options); + } + ++#endif + if (argc > 1) + { + error_msg(_("Invalid number of arguments")); +@@ -275,20 +301,25 @@ int main(int argc, char *argv[]) + int exit_code = EXIT_FAILURE; + + map_string_t *conf = new_map_string(); ++#if AUTHENTICATED_AUTOREPORTING != 0 + map_string_t *rhts_conf = new_map_string(); + map_string_t *rhts_conf_bck = NULL; ++#endif + map_string_t *ureport_conf = new_map_string(); + map_string_t *ureport_conf_bck = NULL; + + if (!load_abrt_conf_file(CONF_NAME, conf)) + goto finito; + ++#if AUTHENTICATED_AUTOREPORTING != 0 + if (!load_plugin_conf_file(RHTS_NAME, rhts_conf, false)) + goto finito; ++#endif + + if (!load_plugin_conf_file(UREPORT_NAME, ureport_conf, false)) + goto finito; + ++#if AUTHENTICATED_AUTOREPORTING != 0 + if ((opts & OPT_a)) + { + ureport_conf_bck = clone_map_string(ureport_conf); +@@ -334,11 +365,13 @@ int main(int argc, char *argv[]) + goto finito; + } + ++#endif + if (argc == 0) + { + printf("%s", get_abrt_reporting(conf)); + exit_code = EXIT_SUCCESS; + ++#if AUTHENTICATED_AUTOREPORTING != 0 + if (g_verbose >= 1) + { + const char *tmp = get_ureport_http_auth(ureport_conf); +@@ -350,7 +383,7 @@ int main(int argc, char *argv[]) + else + printf(" %s", _("anonymous auto reporting")); + } +- ++#endif + putchar('\n'); + + goto finito; +@@ -363,16 +396,20 @@ int main(int argc, char *argv[]) + if (ureport_conf_bck != NULL) + save_plugin_conf_file(UREPORT_NAME, ureport_conf_bck); + ++#if AUTHENTICATED_AUTOREPORTING != 0 + if (rhts_conf_bck != NULL) + save_plugin_conf_file(RHTS_NAME, rhts_conf_bck); ++#endif + } + + + finito: + free_map_string(ureport_conf); + free_map_string(ureport_conf_bck); ++#if AUTHENTICATED_AUTOREPORTING != 0 + free_map_string(rhts_conf); + free_map_string(rhts_conf_bck); ++#endif + free_map_string(conf); + return exit_code; + } +-- +2.4.1 + diff --git a/0015-abrt-action-list-dsos-do-not-decode-not-existing-obj.patch b/0015-abrt-action-list-dsos-do-not-decode-not-existing-obj.patch new file mode 100644 index 0000000..c1a15f4 --- /dev/null +++ b/0015-abrt-action-list-dsos-do-not-decode-not-existing-obj.patch @@ -0,0 +1,37 @@ +From c17cb1999357d9be51b8118661a8f35569c66dd0 Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Thu, 14 May 2015 16:27:02 +0200 +Subject: [PATCH] abrt-action-list-dsos: do not decode not existing object + +If you build a package using 'make rpm', there is no vendor param in it. +So this is the reason why the Decode method was called on None object. + +Signed-off-by: Matej Habrnal +--- + src/plugins/abrt-action-list-dsos | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/abrt-action-list-dsos b/src/plugins/abrt-action-list-dsos +index f4a1536..a3078a5 100644 +--- a/src/plugins/abrt-action-list-dsos ++++ b/src/plugins/abrt-action-list-dsos +@@ -82,10 +82,15 @@ if __name__ == "__main__": + if outname: + outfile = xopen(outname, "w") + outname = None ++ ++ vendor = h[rpm.RPMTAG_VENDOR] ++ if vendor != None: ++ verdor = vendor.decode('utf-8') ++ + outfile.write("%s %s (%s) %s\n" % + (path, + h[rpm.RPMTAG_NEVRA].decode('utf-8'), +- h[rpm.RPMTAG_VENDOR].decode('utf-8'), ++ verdor, + h[rpm.RPMTAG_INSTALLTIME]) + ) + +-- +2.4.1 + diff --git a/0016-doc-polkit-Spelling-grammar-fixes.patch b/0016-doc-polkit-Spelling-grammar-fixes.patch new file mode 100644 index 0000000..ef8b8a4 --- /dev/null +++ b/0016-doc-polkit-Spelling-grammar-fixes.patch @@ -0,0 +1,143 @@ +From e3df315b18f833bb44eb8aadeefc2ad932f39f97 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Tue, 19 May 2015 09:29:28 +0300 +Subject: [PATCH] doc, polkit: Spelling/grammar fixes + +--- + doc/design | 6 +++--- + doc/problems-service/org.freedesktop.Problems.xml.in | 4 ++-- + doc/project/abrt.tex | 14 +++++++------- + src/dbus/abrt_polkit.policy | 4 ++-- + 4 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/doc/design b/doc/design +index a9ce040..f214caf 100644 +--- a/doc/design ++++ b/doc/design +@@ -37,7 +37,7 @@ to a dedicated server(s) for processing (backtrace, etc). + + Design + +-Abrt design should be flexible enough to accomodate all ++Abrt design should be flexible enough to accommodate all + of the above usage scenarios. + + Since currently we do not know how to dump oops on demand, +@@ -70,7 +70,7 @@ uses inotify to watch for crashes. Instead the programs which create crashes + can trigger their initial ("post-create") processing themselves] + + Crashes conceptually go through "events" in their lives. +-Apart from "post-create" event decribed above, they may have ++Apart from "post-create" event described above, they may have + "analyze" event, "report[_FOO]" events, + and arbitrarily-named other events. + abrt-handle-crashdump tool can be used to "run" an event on a directory, +@@ -124,7 +124,7 @@ Done: + * Make abrt-gui start abrtd on demand, so that abrt-gui can be started + even if abrtd does not run at the moment. + * make kerneloops plugin into separate daemon (convert it to a hook +- and get rid of "cron plugins" which are wrong idea since the begining) ++ and get rid of "cron plugins" which are wrong idea since the beginning) + * make C/C++ hook to be started by init script + * add "include FILE" feature to abrt_event.conf + +diff --git a/doc/problems-service/org.freedesktop.Problems.xml.in b/doc/problems-service/org.freedesktop.Problems.xml.in +index 118d4b2..b791bdb 100644 +--- a/doc/problems-service/org.freedesktop.Problems.xml.in ++++ b/doc/problems-service/org.freedesktop.Problems.xml.in +@@ -53,7 +53,7 @@ + + uid + +- Only a user with root priviledges can pass this field. For all other users the field is filled by caller's uid. ++ Only a user with root privileges can pass this field. For all other users the field is filled by caller's uid. + + + +@@ -309,7 +309,7 @@ for prblmid in problems.GetProblems(): + + + +- Beginnig of required time range. ++ Beginning of required time range. + + + +diff --git a/doc/project/abrt.tex b/doc/project/abrt.tex +index 9e7724e..03b5705 100644 +--- a/doc/project/abrt.tex ++++ b/doc/project/abrt.tex +@@ -194,7 +194,7 @@ information regarding their interests, involvement. + {\textbf{Package Maintainers} + \nodepart{second} \vspace{-5mm} + \begin{itemize} \itemsep1pt \parskip0pt \parsep0pt +- \item Fixing most frequently occured bugs ++ \item Fixing most frequently occurred bugs + \item Fixing bugs where the bug is well described + \end{itemize} + }; +@@ -265,7 +265,7 @@ Highlight important reports + In-depth bug fixing + ------------------- + +-Collect core-dump for frequently occured reports ++Collect core-dump for frequently occurred reports + + Retrace coredumps on demand + +@@ -570,7 +570,7 @@ components. + Red Hat Bugzilla. + \end{description} + \item[Data Storage] Database and file storage for data required for +- the analysis, evaluation, adn processing of reports and problems. ++ the analysis, evaluation, and processing of reports and problems. + \begin{description} + \item[LLVM bitcode] We store LLVM bitcode of every binary and + dynamic library compiled from C/C++ source code. +@@ -582,8 +582,8 @@ components. + \begin{tikzpicture} + \umlclass[x=-4,y=0]{problem}{ + id : PRIMARY KEY \\ +-first occurence : TIMESTAMP NOT NULL \\ +-last occurence : TIMESTAMP NOT NULL \\ ++first occurrence : TIMESTAMP NOT NULL \\ ++last occurrence : TIMESTAMP NOT NULL \\ + }{} + + \umlclass[x=4,y=-2]{problem report}{ +@@ -616,8 +616,8 @@ Part of reports is populated from $\mu$reports. + \umlclass[x=-4,y=0]{report}{ + id : PRIMARY KEY AUTOINCREMENT \\ + type : ENUM (USERSPACE, KERNEL, PYTHON, SELINUX) \\ +-first occurence : TIMESTAMP \\ +-last occurence : TIMESTAMP \\ ++first occurrence : TIMESTAMP \\ ++last occurrence : TIMESTAMP \\ + count : INT \\ + component id : FOREIGN KEY \\ + problem id : FOREIGN KEY +diff --git a/src/dbus/abrt_polkit.policy b/src/dbus/abrt_polkit.policy +index a3425d9..2c75233 100644 +--- a/src/dbus/abrt_polkit.policy ++++ b/src/dbus/abrt_polkit.policy +@@ -17,7 +17,7 @@ Copyright (c) 2012 ABRT Team + + + Get problems from all users +- Reading others problems requires authentication ++ Reading other users' problems requires authentication + + auth_admin + auth_admin_keep +@@ -28,7 +28,7 @@ Copyright (c) 2012 ABRT Team + + + Set value of configuration properties +- Update configuration values reuquires authentication ++ Updating configuration values requires authentication + + auth_admin + auth_admin_keep +-- +2.4.1 + diff --git a/0018-applet-migrate-Autoreporting-options-to-GSettings.patch b/0018-applet-migrate-Autoreporting-options-to-GSettings.patch new file mode 100644 index 0000000..db67e55 --- /dev/null +++ b/0018-applet-migrate-Autoreporting-options-to-GSettings.patch @@ -0,0 +1,123 @@ +From 70b2e6981b667d5cfb31f894527e16f3eeed14c9 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Fri, 15 May 2015 14:45:40 +0200 +Subject: [PATCH] applet: migrate Autoreporting options to GSettings + +Read the option's value from the app's configuration file, update the +gnome setting if needed and remove the option from the app's +configuration file in order to skip the migration at next start. + +Related to #966 + +Signed-off-by: Jakub Filak +--- + src/applet/applet.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 55 insertions(+), 5 deletions(-) + +diff --git a/src/applet/applet.c b/src/applet/applet.c +index 4df69fc..b534839 100644 +--- a/src/applet/applet.c ++++ b/src/applet/applet.c +@@ -36,6 +36,10 @@ + #include "libabrt.h" + #include "problem_api.h" + ++#define APP_NAME "abrt-applet" ++#define GS_SCHEMA_ID_PRIVACY "org.gnome.desktop.privacy" ++#define GS_PRIVACY_OPT_AUTO_REPORTING "report-technical-problems" ++ + /* libnotify action keys */ + #define A_REPORT_REPORT "REPORT" + #define A_RESTART_APPLICATION "RESTART" +@@ -55,15 +59,60 @@ static bool is_autoreporting_enabled(void) + GSettings *settings; + gboolean ret; + +- settings = g_settings_new ("org.gnome.desktop.privacy"); +- ret = g_settings_get_boolean (settings, "report-technical-problems"); ++ settings = g_settings_new (GS_SCHEMA_ID_PRIVACY); ++ ret = g_settings_get_boolean (settings, GS_PRIVACY_OPT_AUTO_REPORTING); + g_object_unref (settings); + return ret; + } + ++static void migrate_auto_reporting_to_gsettings(void) ++{ ++#define OPT_NAME "AutoreportingEnabled" ++ map_string_t *settings = new_map_string(); ++ if (!load_app_conf_file(APP_NAME, settings)) ++ goto finito; ++ ++ /* Silently ignore not configured options */ ++ int sv_logmode = logmode; ++ /* but only if we run in silent mode (no -v on command line) */ ++ logmode = g_verbose == 0 ? 0 : sv_logmode; ++ ++ int auto_reporting = 0; ++ int configured = try_get_map_string_item_as_bool(settings, OPT_NAME, &auto_reporting); ++ ++ logmode = sv_logmode; ++ ++ if (!configured) ++ goto finito; ++ ++ /* Enable the GS option if AutoreportingEnabled is true because the user ++ * turned the Autoreporting in abrt-applet in a before GS. ++ * ++ * Do not disable the GS option if AutoreportingEvent is false because the ++ * GS option is false by default, thus disabling would revert the user's ++ * decision to automatically report technical problems. ++ */ ++ if (auto_reporting) ++ { ++ GSettings *settings = g_settings_new(GS_SCHEMA_ID_PRIVACY); ++ g_settings_set_boolean(settings, GS_PRIVACY_OPT_AUTO_REPORTING, TRUE); ++ g_object_unref(settings); ++ } ++ ++ remove_map_string_item(settings, OPT_NAME); ++ save_app_conf_file(APP_NAME, settings); ++ ++ log("Successfully migrated "APP_NAME":"OPT_NAME" to "GS_SCHEMA_ID_PRIVACY":"GS_PRIVACY_OPT_AUTO_REPORTING); ++ ++#undef OPT_NAME ++finito: ++ free_map_string(settings); ++ return; ++} ++ + static const char *get_autoreport_event_name(void) + { +- load_user_settings("abrt-applet"); ++ load_user_settings(APP_NAME); + const char *configured = get_user_setting("AutoreportingEvent"); + return configured ? configured : g_settings_autoreporting_event; + } +@@ -554,7 +603,7 @@ static NotifyNotification *new_warn_notification(const char *body) + + notify_notification_set_urgency(notification, NOTIFY_URGENCY_NORMAL); + notify_notification_set_timeout(notification, NOTIFY_EXPIRES_DEFAULT); +- notify_notification_set_hint(notification, "desktop-entry", g_variant_new_string("abrt-applet")); ++ notify_notification_set_hint(notification, "desktop-entry", g_variant_new_string(APP_NAME)); + + return notification; + } +@@ -1147,13 +1196,14 @@ int main(int argc, char** argv) + /*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string); + + migrate_to_xdg_dirs(); ++ migrate_auto_reporting_to_gsettings(); + + export_abrt_envvars(0); + msg_prefix = g_progname; + + load_abrt_conf(); + load_event_config_data(); +- load_user_settings("abrt-applet"); ++ load_user_settings(APP_NAME); + + /* Initialize our (dbus_abrt) machinery by filtering + * for signals: +-- +2.4.1 + diff --git a/0019-config-UI-read-glade-from-a-local-file-first.patch b/0019-config-UI-read-glade-from-a-local-file-first.patch new file mode 100644 index 0000000..4381744 --- /dev/null +++ b/0019-config-UI-read-glade-from-a-local-file-first.patch @@ -0,0 +1,39 @@ +From eb1e45a1e8070bee6ba44f325f7dd0ca8900dc77 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Sat, 16 May 2015 06:46:17 +0200 +Subject: [PATCH] config UI: read glade from a local file first + +If you read the system file first, you won't be able to the application +from a development directory. + +Signed-off-by: Jakub Filak +--- + src/configuration-gui/abrt-config-widget.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/configuration-gui/abrt-config-widget.c b/src/configuration-gui/abrt-config-widget.c +index 664180d..2c75429 100644 +--- a/src/configuration-gui/abrt-config-widget.c ++++ b/src/configuration-gui/abrt-config-widget.c +@@ -221,14 +221,14 @@ abrt_config_widget_init(AbrtConfigWidget *self) + self->priv->builder = gtk_builder_new(); + gtk_builder_set_translation_domain(self->priv->builder, GETTEXT_PACKAGE); + +- gtk_builder_add_from_file(self->priv->builder, ABRT_UI_DIR "/" UI_FILE_NAME, &error); ++ gtk_builder_add_from_file(self->priv->builder, UI_FILE_NAME, &error); + if(error != NULL) { +- g_warning("Failed to load '%s': %s", ABRT_UI_DIR "/" UI_FILE_NAME, error->message); ++ log_debug("Failed to load '%s': %s", UI_FILE_NAME, error->message); + g_error_free(error); + error = NULL; +- gtk_builder_add_from_file(self->priv->builder, UI_FILE_NAME, &error); ++ gtk_builder_add_from_file(self->priv->builder, ABRT_UI_DIR "/" UI_FILE_NAME, &error); + if(error != NULL) { +- g_warning("Failed to load '%s': %s", UI_FILE_NAME, error->message); ++ g_warning("Failed to load '%s': %s", ABRT_UI_DIR "/" UI_FILE_NAME, error->message); + g_error_free(error); + return; + } +-- +2.4.1 + diff --git a/0020-config-UI-enable-options-without-config-files.patch b/0020-config-UI-enable-options-without-config-files.patch new file mode 100644 index 0000000..5dd83fd --- /dev/null +++ b/0020-config-UI-enable-options-without-config-files.patch @@ -0,0 +1,55 @@ +From 5d544028c3dd3f4af9d4da83a4c57d2c05c09014 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Sat, 16 May 2015 06:51:09 +0200 +Subject: [PATCH] config UI: enable options without config files + +Signed-off-by: Jakub Filak +--- + src/configuration-gui/abrt-config-widget.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/configuration-gui/abrt-config-widget.c b/src/configuration-gui/abrt-config-widget.c +index 2c75429..8bfc269 100644 +--- a/src/configuration-gui/abrt-config-widget.c ++++ b/src/configuration-gui/abrt-config-widget.c +@@ -175,10 +175,13 @@ on_switch_activate(GObject *object, + GParamSpec *spec, + AbrtConfigWidget *config) + { ++ AbrtConfigWidgetOption *option = g_object_get_data(G_OBJECT(object), "abrt-option"); ++ if (option->config == NULL) ++ return; ++ + const gboolean state = gtk_switch_get_active(GTK_SWITCH(object)); + const char *const val = state ? "yes" : "no"; + +- AbrtConfigWidgetOption *option = g_object_get_data(G_OBJECT(object), "abrt-option"); + log_debug("%s : %s", option->name, val); + abrt_app_configuration_set_value(option->config, option->name, val); + abrt_app_configuration_save(option->config); +@@ -191,7 +194,11 @@ update_option_current_value(AbrtConfigWidget *self, enum AbrtOptions opid) + assert((opid >= _ABRT_OPT_BEGIN_ && opid < _ABRT_OPT_END_) || !"Out of range Option ID value"); + + AbrtConfigWidgetOption *option = &(self->priv->options[opid]); +- const char *val = abrt_app_configuration_get_value(option->config, option->name); ++ ++ const char *val = NULL; ++ if (option->config != NULL) ++ val = abrt_app_configuration_get_value(option->config, option->name); ++ + option->current_value = val ? string_to_bool(val) : option->default_value; + } + +@@ -209,6 +216,9 @@ connect_switch_with_option(AbrtConfigWidget *self, enum AbrtOptions opid, const + g_object_set_data(G_OBJECT(gsw), "abrt-option", option); + g_signal_connect(G_OBJECT(gsw), "notify::active", + G_CALLBACK(on_switch_activate), self); ++ ++ if (option->config == NULL) ++ gtk_widget_set_sensitive(GTK_WIDGET(gsw), FALSE); + } + + static void +-- +2.4.1 + diff --git a/0021-config-UI-Automatic-reporting-from-GSettings.patch b/0021-config-UI-Automatic-reporting-from-GSettings.patch new file mode 100644 index 0000000..29a8abd --- /dev/null +++ b/0021-config-UI-Automatic-reporting-from-GSettings.patch @@ -0,0 +1,602 @@ +From abdedafd3a530ad4baa992010a3cfc87645d98d1 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Sat, 16 May 2015 06:51:37 +0200 +Subject: [PATCH] config UI: Automatic reporting from GSettings + +If Privacy panels exists: + Make the widget insensitive because the user can only read its value. + Add a button launching Privacy panel. +Else: + Read/write the GSettings and show a warning about modifying the + GSettings. + +Signed-off-by: Jakub Filak +--- + po/POTFILES.in | 1 + + src/configuration-gui/abrt-config-widget.c | 201 +++++++++++++++++++++++-- + src/configuration-gui/abrt-config-widget.glade | 82 ++++------ + 3 files changed, 217 insertions(+), 67 deletions(-) + +diff --git a/po/POTFILES.in b/po/POTFILES.in +index 0da1396..8c31438 100644 +--- a/po/POTFILES.in ++++ b/po/POTFILES.in +@@ -3,6 +3,7 @@ + # Please keep this file sorted alphabetically. + src/applet/abrt-applet.desktop.in + src/applet/applet.c ++src/configuration-gui/abrt-config-widget.c + src/configuration-gui/abrt-config-widget.glade + src/configuration-gui/system-config-abrt.c + src/configuration-gui/main.c +diff --git a/src/configuration-gui/abrt-config-widget.c b/src/configuration-gui/abrt-config-widget.c +index 8bfc269..c9b0b02 100644 +--- a/src/configuration-gui/abrt-config-widget.c ++++ b/src/configuration-gui/abrt-config-widget.c +@@ -21,6 +21,8 @@ + #endif + + #include "abrt-config-widget.h" ++#include ++#include + + #include "libabrt.h" + #include +@@ -32,19 +34,36 @@ + + #define UI_FILE_NAME "abrt-config-widget.glade" + ++/* AbrtConfigWidgetPrivate: ++ * + AbrtConfigWidgetOption == "abrt-option" of GtkSwitch ++ * + AbrtConfigWidgetOption == "abrt-option" of GtkSwitch ++ * + ... ++ * ++ * + AbrtAppConfiguration == config of AbrtConfigWidgetOption ++ * + AbrtAppConfiguration == config of AbrtConfigWidgetOption ++ * + ... ++ */ ++ ++/* This structure represents either an ABRT configuration file or a GSettings ++ * schema. ++ */ + typedef struct { +- char *app_name; +- map_string_t *settings; ++ char *app_name; ///< e.g abrt-applet, org.gnome.desktop.privacy ++ map_string_t *settings; ///< ABRT configuration file ++ GSettings *glib_settings; ///< GSettings + } AbrtAppConfiguration; + ++/* This structure represents a single switch. ++ */ + typedef struct { +- const char *name; ++ const char *name; ///< e.g. ask_steal_dir, report-technical-problems + GtkSwitch *widget; + gboolean default_value; + gboolean current_value; + AbrtAppConfiguration *config; + } AbrtConfigWidgetOption; + ++/* Each configuration option has its own number. */ + enum AbrtOptions + { + _ABRT_OPT_BEGIN_, +@@ -60,11 +79,15 @@ enum AbrtOptions + _ABRT_OPT_END_, + }; + ++/* This structure holds private data of AbrtConfigWidget ++ */ + struct AbrtConfigWidgetPrivate { + GtkBuilder *builder; + AbrtAppConfiguration *report_gtk_conf; + AbrtAppConfiguration *abrt_applet_conf; ++ AbrtAppConfiguration *privacy_gsettings; + ++ /* Static array for all switches */ + AbrtConfigWidgetOption options[_ABRT_OPT_END_]; + }; + +@@ -79,6 +102,8 @@ static guint s_signals[SN_LAST_SIGNAL] = { 0 }; + + static void abrt_config_widget_finalize(GObject *object); + ++/* New ABRT configuration file wrapper ++ */ + static AbrtAppConfiguration * + abrt_app_configuration_new(const char *app_name) + { +@@ -86,6 +111,7 @@ abrt_app_configuration_new(const char *app_name) + + conf->app_name = xstrdup(app_name); + conf->settings = new_map_string(); ++ conf->glib_settings = NULL; + + if(!load_app_conf_file(conf->app_name, conf->settings)) { + g_warning("Failed to load config for '%s'", conf->app_name); +@@ -94,22 +120,50 @@ abrt_app_configuration_new(const char *app_name) + return conf; + } + ++/* New GSettings wrapper ++ */ ++static AbrtAppConfiguration * ++abrt_app_configuration_new_glib(const char *schema) ++{ ++ AbrtAppConfiguration *conf = xmalloc(sizeof(*conf)); ++ ++ conf->app_name = xstrdup(schema); ++ conf->settings = NULL; ++ conf->glib_settings = g_settings_new(conf->app_name); ++ ++ return conf; ++} ++ + static void + abrt_app_configuration_set_value(AbrtAppConfiguration *conf, const char *name, const char *value) + { +- set_app_user_setting(conf->settings, name, value); ++ if (conf->settings) ++ set_app_user_setting(conf->settings, name, value); ++ else if (conf->glib_settings) ++ g_settings_set_boolean(conf->glib_settings, name, string_to_bool(value)); ++ else ++ assert(!"BUG: not properly initialized AbrtAppConfiguration"); + } + + static const char * + abrt_app_configuration_get_value(AbrtAppConfiguration *conf, const char *name) + { +- return get_app_user_setting(conf->settings, name); ++ if (conf->settings) ++ return get_app_user_setting(conf->settings, name); ++ ++ if (conf->glib_settings) ++ return g_settings_get_boolean(conf->glib_settings, name) ? "yes" : "no"; ++ ++ assert(!"BUG: not properly initialized AbrtAppConfiguration"); + } + + static void + abrt_app_configuration_save(AbrtAppConfiguration *conf) + { +- save_app_conf_file(conf->app_name, conf->settings); ++ if (conf->settings) ++ save_app_conf_file(conf->app_name, conf->settings); ++ ++ /* No need to save GSettings because changes are applied instantly */ + } + + static void +@@ -121,8 +175,17 @@ abrt_app_configuration_free(AbrtAppConfiguration *conf) + free(conf->app_name); + conf->app_name = (void *)0xDEADBEAF; + +- free_map_string(conf->settings); +- conf->settings = (void *)0xDEADBEAF; ++ if (conf->settings) ++ { ++ free_map_string(conf->settings); ++ conf->settings = (void *)0xDEADBEAF; ++ } ++ ++ if (conf->glib_settings) ++ { ++ g_object_unref(conf->glib_settings); ++ conf->glib_settings = (void *)0xDEADBEAF; ++ } + } + + static void +@@ -161,6 +224,9 @@ abrt_config_widget_finalize(GObject *object) + abrt_app_configuration_free(self->priv->abrt_applet_conf); + self->priv->abrt_applet_conf = NULL; + ++ abrt_app_configuration_free(self->priv->privacy_gsettings); ++ self->priv->privacy_gsettings = NULL; ++ + G_OBJECT_CLASS(abrt_config_widget_parent_class)->finalize(object); + } + +@@ -217,8 +283,31 @@ connect_switch_with_option(AbrtConfigWidget *self, enum AbrtOptions opid, const + g_signal_connect(G_OBJECT(gsw), "notify::active", + G_CALLBACK(on_switch_activate), self); + +- if (option->config == NULL) +- gtk_widget_set_sensitive(GTK_WIDGET(gsw), FALSE); ++ /* If the option has no config, make the corresponding insensitive. */ ++ gtk_widget_set_sensitive(GTK_WIDGET(gsw), option->config != NULL); ++} ++ ++static void ++pp_launcher_clicked(GtkButton *launcher, gpointer *unused_data) ++{ ++ GDesktopAppInfo *app = g_object_get_data(G_OBJECT(launcher), "launched-app"); ++ GError *err = NULL; ++ if (!g_app_info_launch(G_APP_INFO(app), NULL, NULL, &err)) ++ { ++ perror_msg("Could not launch '%s': %s", ++ g_desktop_app_info_get_filename(G_DESKTOP_APP_INFO (app)), ++ err->message); ++ } ++} ++ ++static void ++os_release_callback(char *key, char *value, void *data) ++{ ++ if (strcmp(key, "PRIVACY_POLICY") == 0) ++ *(char **)data = value; ++ else ++ free(value); ++ free(key); + } + + static void +@@ -249,6 +338,7 @@ abrt_config_widget_init(AbrtConfigWidget *self) + + self->priv->report_gtk_conf = abrt_app_configuration_new("report-gtk"); + self->priv->abrt_applet_conf = abrt_app_configuration_new("abrt-applet"); ++ self->priv->privacy_gsettings = abrt_app_configuration_new_glib("org.gnome.desktop.privacy"); + + /* Initialize options */ + /* report-gtk */ +@@ -259,15 +349,98 @@ abrt_config_widget_init(AbrtConfigWidget *self) + self->priv->options[ABRT_OPT_UPLOAD_COREDUMP].name = "abrt_analyze_smart_ask_upload_coredump"; + self->priv->options[ABRT_OPT_UPLOAD_COREDUMP].default_value = TRUE; + self->priv->options[ABRT_OPT_UPLOAD_COREDUMP].config = self->priv->report_gtk_conf; +- + self->priv->options[ABRT_OPT_PRIVATE_TICKET].name = CREATE_PRIVATE_TICKET; + self->priv->options[ABRT_OPT_PRIVATE_TICKET].default_value = FALSE; + self->priv->options[ABRT_OPT_PRIVATE_TICKET].config = self->priv->report_gtk_conf; + + /* abrt-applet */ +- self->priv->options[ABRT_OPT_SEND_UREPORT].name = "AutoreportingEnabled"; +- self->priv->options[ABRT_OPT_SEND_UREPORT].default_value = g_settings_autoreporting; +- self->priv->options[ABRT_OPT_SEND_UREPORT].config = self->priv->abrt_applet_conf; ++ self->priv->options[ABRT_OPT_SEND_UREPORT].name = "report-technical-problems"; ++ self->priv->options[ABRT_OPT_SEND_UREPORT].default_value = ++ string_to_bool(abrt_app_configuration_get_value(self->priv->privacy_gsettings, ++ "report-technical-problems")); ++ { ++ /* Get the container widget for the lauch button and warnings */ ++ GtkWidget *hbox_auto_reporting = WID("hbox_auto_reporting"); ++ assert(hbox_auto_reporting); ++ ++ /* Be able to use another desktop file while debugging */ ++ const char *gpp_app = getenv("ABRT_PRIVACY_APP_DESKTOP"); ++ if (gpp_app == NULL) ++ gpp_app = "gnome-privacy-panel.desktop"; ++ ++ GDesktopAppInfo *app = g_desktop_app_info_new(gpp_app); ++ char *message = NULL; ++ char *markup = NULL; ++ if (!app) ++ { ++ /* Make the switch editable */ ++ self->priv->options[ABRT_OPT_SEND_UREPORT].config = self->priv->privacy_gsettings; ++ ++ char *os_release = xmalloc_open_read_close("/etc/os-release", /*no size limit*/NULL); ++ char *privacy_policy = NULL; ++ ++ /* Try to get the value of PRIVACY_POLICY from /etc/os-release */ ++ sr_parse_os_release(os_release, os_release_callback, (void *)&privacy_policy); ++ ++ message = xasprintf(_("The configuration option above has been moved to GSettings and " ++ "the switch is linked to the value of the setting 'report-technical-problems' " ++ "from the schema 'org.gnome.desktop.privacy'.")); ++ ++ /* Do not add Privacy Policy link if /etc/os-release does not contain PRIVACY_POLICY */ ++ if (privacy_policy != NULL) ++ markup = xasprintf("%s\n\nPrivacy Policy", message, privacy_policy); ++ else ++ markup = xasprintf("%s", message); ++ ++ free(privacy_policy); ++ free(os_release); ++ } ++ else ++ { ++ /* Make the switch read-only */ ++ self->priv->options[ABRT_OPT_SEND_UREPORT].config = NULL; ++ ++ message = xasprintf(_("The configuration option above can be configured in")); ++ markup = xasprintf("%s", message); ++ ++ GtkWidget *launcher = gtk_button_new_with_label(g_app_info_get_display_name(G_APP_INFO(app))); ++ ++ /* Here we could pass the launcher to pp_launcher_clicked() as the ++ * 4th argument of g_signal_connect() but we would leek the ++ * launcher's memory. Therefore we need to find a way how to free ++ * the launcher when it is not needed anymore. GtkWidget inherits ++ * from GObject which offers a functionality for attaching an ++ * arbitrary data to its instances. The last argument is a function ++ * called to destroy the arbirarty data when the instance is being ++ * destoryed. */ ++ g_object_set_data_full(G_OBJECT(launcher), "launched-app", app, g_object_unref); ++ g_signal_connect(launcher, "clicked", G_CALLBACK(pp_launcher_clicked), NULL); ++ ++ /* Make the launcher button narrow, otherwise it would expand to ++ * the width of the warninig. */ ++ gtk_widget_set_hexpand(launcher, FALSE); ++ gtk_widget_set_vexpand(launcher, FALSE); ++ ++ /* Make the launcher button alligned on center of the warning. */ ++ gtk_widget_set_halign(launcher, GTK_ALIGN_CENTER); ++ gtk_widget_set_valign(launcher, GTK_ALIGN_CENTER); ++ ++ gtk_box_pack_end(GTK_BOX(hbox_auto_reporting), launcher, false, false, 0); ++ } ++ ++ ++ GtkWidget *lbl = gtk_label_new(message); ++ gtk_label_set_markup(GTK_LABEL(lbl), markup); ++ /* Do not expand the window by too long warning. */ ++ gtk_label_set_line_wrap(GTK_LABEL(lbl), TRUE); ++ /* Let users to copy the warning. */ ++ gtk_label_set_selectable(GTK_LABEL(lbl), TRUE); ++ ++ free(markup); ++ free(message); ++ ++ gtk_box_pack_start(GTK_BOX(hbox_auto_reporting), lbl, false, false, 0); ++ } + + self->priv->options[ABRT_OPT_SHORTENED_REPORTING].name = "ShortenedReporting"; + self->priv->options[ABRT_OPT_SHORTENED_REPORTING].default_value = g_settings_shortenedreporting; +diff --git a/src/configuration-gui/abrt-config-widget.glade b/src/configuration-gui/abrt-config-widget.glade +index 3aa566c..7f613c7 100644 +--- a/src/configuration-gui/abrt-config-widget.glade ++++ b/src/configuration-gui/abrt-config-widget.glade +@@ -1,6 +1,7 @@ + ++ + +- ++ + + False + +@@ -11,7 +12,6 @@ + 10 + 10 + 10 +- True + + + True +@@ -26,8 +26,6 @@ + + 0 + 1 +- 1 +- 1 + + + +@@ -44,8 +42,6 @@ + + 0 + 3 +- 1 +- 1 + + + +@@ -59,8 +55,6 @@ + + 1 + 0 +- 1 +- 1 + + + +@@ -74,13 +68,12 @@ + + 1 + 1 +- 1 +- 1 + + + + + True ++ False + True + end + center +@@ -89,8 +82,6 @@ + + 1 + 3 +- 1 +- 1 + + + +@@ -106,9 +97,7 @@ + + + 0 +- 4 +- 1 +- 1 ++ 5 + + + +@@ -121,9 +110,7 @@ + + + 1 +- 4 +- 1 +- 1 ++ 5 + + + +@@ -136,9 +123,7 @@ + + + 1 +- 5 +- 1 +- 1 ++ 6 + + + +@@ -154,9 +139,7 @@ + + + 0 +- 5 +- 1 +- 1 ++ 6 + + + +@@ -172,8 +155,6 @@ + + 2 + 0 +- 1 +- 1 + + + +@@ -188,8 +169,6 @@ + + 2 + 1 +- 1 +- 1 + + + +@@ -204,8 +183,6 @@ + + 2 + 3 +- 1 +- 1 + + + +@@ -219,9 +196,7 @@ + + + 2 +- 4 +- 1 +- 1 ++ 5 + + + +@@ -235,9 +210,7 @@ + + + 2 +- 5 +- 1 +- 1 ++ 6 + + + +@@ -254,8 +227,6 @@ + + 0 + 0 +- 1 +- 1 + + + +@@ -270,8 +241,6 @@ + + 2 + 2 +- 1 +- 1 + + + +@@ -286,8 +255,6 @@ + + 0 + 2 +- 1 +- 1 + + + +@@ -301,8 +268,6 @@ + + 1 + 2 +- 1 +- 1 + + + +@@ -316,9 +281,7 @@ + + + 0 +- 6 +- 1 +- 1 ++ 7 + + + +@@ -331,9 +294,7 @@ + + + 1 +- 6 +- 1 +- 1 ++ 7 + + + +@@ -347,11 +308,26 @@ + + + 2 +- 6 +- 1 +- 1 ++ 7 + + ++ ++ ++ True ++ False ++ ++ ++ ++ ++ ++ 0 ++ 4 ++ 2 ++ ++ ++ ++ ++ + + + +-- +2.4.1 + diff --git a/abrt.spec b/abrt.spec index a45b174..011013a 100644 --- a/abrt.spec +++ b/abrt.spec @@ -46,7 +46,7 @@ Summary: Automatic bug detection and reporting tool Name: abrt Version: 2.5.1 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: Applications/System URL: https://github.com/abrt/abrt/wiki/ABRT-Project @@ -56,6 +56,28 @@ Patch0: disable-OpenGPGCheck-in-Fedora-Rawhide.patch # git format-patch %%{Version} --topo-order -N -M; # i=1; for p in `ls 0*.patch`; do printf "Patch%04d: %s\n" $i $p; ((i++)); done +#Patch0001: 0001-testsuite-grab-beakerlib-stored-log-files-from-var-t.patch +#Patch0002: 0002-testsuite-add-the-machineid-test-case-to-rhel6.patch +#Patch0003: 0003-testsuite-add-test-for-abrt-cli-report-via-reporter-.patch +Patch0004: 0004-applet-switch-to-D-Bus-methods.patch +Patch0005: 0005-lib-add-new-kernel-taint-flags.patch +Patch0006: 0006-upload-validate-and-sanitize-uploaded-dump-directori.patch +#Patch0007: 0007-testsuite-don-t-run-whole-test-if-reporter-mantisbt-.patch +Patch0008: 0008-a-a-s-p-d-add-new-known-interpreter-to-conf-file.patch +#Patch0009: 0009-abrt-detect-DumpLocation-from-abrt.conf-instead-of-u.patch +Patch0010: 0010-applet-fix-problem-info-double-free.patch +Patch0011: 0011-cli-do-not-exit-with-segfault-if-dbus-fails.patch +#Patch0012: 0012-spec-add-a-dependency-on-abrt-dbus-to-abrt-cli.patch +Patch0013: 0013-abrt-auto-reporting-require-rhtsupport.conf-file-onl.patch +#Patch0014: 0014-spec-add-AUTHENTICATED_AUTOREPORTING-conditional.patch +Patch0015: 0015-abrt-action-list-dsos-do-not-decode-not-existing-obj.patch +Patch0016: 0016-doc-polkit-Spelling-grammar-fixes.patch +#Patch0017: 0017-testsuite-add-new-version-of-python-interpreters.patch +Patch0018: 0018-applet-migrate-Autoreporting-options-to-GSettings.patch +Patch0019: 0019-config-UI-read-glade-from-a-local-file-first.patch +Patch0020: 0020-config-UI-enable-options-without-config-files.patch +Patch0021: 0021-config-UI-Automatic-reporting-from-GSettings.patch +#Patch0022: 0022-testsuite-test-safeness-of-creating-user-cores.patch # '%%autosetup -S git' -> git BuildRequires: git @@ -291,6 +313,7 @@ Group: User Interface/Desktops Requires: %{name} = %{version}-%{release} Requires: libreport-cli >= %{libreport_ver} Requires: abrt-libs = %{version}-%{release} +Requires: abrt-dbus %description tui This package contains a simple command line client for processing abrt reports @@ -459,8 +482,8 @@ to the shell # Default '__scm_apply_git' is 'git apply && git commit' but this workflow # doesn't allow us to create a new file within a patch, so we have to use # 'git am' (see /usr/lib/rpm/macros for more details) -%define __scm_apply_git(qp:m:) %{__git} am -#%%define __scm_apply_git(qp:m:) %%{__git} am --exclude libreport.spec.in --exclude .gitignore +#%%define __scm_apply_git(qp:m:) %%{__git} am +%define __scm_apply_git(qp:m:) %{__git} am --exclude doc/design --exclude doc/project/abrt.tex %autosetup -S git %build @@ -1022,6 +1045,18 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh %changelog +* Wed May 20 2015 Matej Habrnal 2.5.1-3 +- applet: switch to D-Bus methods +- upload: validate and sanitize uploaded dump directories +- applet: switch to D-Bus methods +- lib: add new kernel taint flags +- abrt-auto-reporting: require rhtsupport.conf file only on RHEL +- doc, polkit: Spelling/grammar fixes +- applet: migrate Autoreporting options to GSettings +- config UI: read glade from a local file first +- config UI: Automatic reporting from GSettings +- Resolves: #1217901 + * Mon Apr 13 2015 Jakub Filak 2.5.1-2 - Remove no longer needed posttrans scriptlet copying analyzer to type