whoopsie-preferences-0.18/0000775000000000000000000000000012574312353012473 5ustar whoopsie-preferences-0.18/debian/0000775000000000000000000000000012574312354013716 5ustar whoopsie-preferences-0.18/debian/libwhoopsie-preferences-dev.install0000664000000000000000000000005712574252303022704 0ustar usr/include usr/lib/*/pkgconfig usr/lib/*/*.so whoopsie-preferences-0.18/debian/whoopsie-preferences.install0000664000000000000000000000002612574252303021435 0ustar etc usr/share usr/bin whoopsie-preferences-0.18/debian/compat0000664000000000000000000000000212574252303015111 0ustar 9 whoopsie-preferences-0.18/debian/rules0000775000000000000000000000026012574252303014771 0ustar #!/usr/bin/make -f %: dh "$@" --with autoreconf,translations override_dh_autoreconf: NOCONFIGURE=1 dh_autoreconf ./autogen.sh override_dh_makeshlibs: dh_makeshlibs -- -c4 whoopsie-preferences-0.18/debian/control0000664000000000000000000000341412574252303015320 0ustar Source: whoopsie-preferences Section: utils Priority: optional Build-Depends: debhelper (>= 9), dh-autoreconf, dh-translations, python, intltool (>= 0.35.0), libglib2.0-dev, libpolkit-gobject-1-dev, libgcrypt11-dev, libwhoopsie-dev Maintainer: Evan Dandrea Homepage: http://launchpad.net/whoopsie-preferences Vcs-Bzr: https://code.launchpad.net/~daisy-pluckers/whoopsie-preferences/trunk Standards-Version: 3.9.6 Package: whoopsie-preferences Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, libwhoopsie-preferences0 (= ${binary:Version}) Breaks: activity-log-manager-control-center (<< 0.9.6), activity-log-manager (<< 0.9.7-0ubuntu4), whoopsie (<< 0.2.47), Replaces: activity-log-manager-control-center (<< 0.9.6), activity-log-manager (<< 0.9.7-0ubuntu4) Description: System preferences for error reporting This package provides an interface for system preferences dialogs to control error reporting. Package: libwhoopsie-preferences0 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Breaks: whoopsie (<< 0.2.47), Description: Ubuntu error tracker submission settings - shared library This library provides convenience DBus methods for interfacing with the error tracker submission settings daemon. Package: libwhoopsie-preferences-dev Section: libdevel Architecture: any Depends: libwhoopsie-preferences0 (= ${binary:Version}), ${misc:Depends} Replaces: libwhoopsie-preferences0 (<< 0.7) Description: Ubuntu error tracker submission settings - library development files This library provides convenience DBus methods for interfacing with the error tracker submission settings daemon. whoopsie-preferences-0.18/debian/copyright0000664000000000000000000000111212574252303015641 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Contact: Evan Dandrea Source: https://launchpad.net/whoopsie-preferences Files: * Copyright: Copyright (C) 2012-2013 Canonical Ltd. License: GPL-3 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; version 3 of the License. . On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-3'. whoopsie-preferences-0.18/debian/libwhoopsie-preferences0.install0000664000000000000000000000004712574252303022207 0ustar usr/lib/*/libwhoopsie-preferences.so.* whoopsie-preferences-0.18/debian/changelog0000664000000000000000000001045012574306422015567 0ustar whoopsie-preferences (0.18) wily; urgency=medium * Truncate the file manually if update-rc.d fails (e.g. on an r/o phone). * Build with -Werror=implicit-function-declarations -- Iain Lane Thu, 10 Sep 2015 12:11:37 +0100 whoopsie-preferences (0.17) wily; urgency=medium * Fall back to /etc/writable for /etc/whoopsie if we need to. Thanks seb128 for the initial patch! (LP: #1437633) -- Iain Lane Fri, 22 May 2015 12:58:03 +0100 whoopsie-preferences (0.16) vivid; urgency=medium * Only report that we don't report crashes under upstart if the override file contains "manual" instead of existence detection. -- Didier Roche Thu, 02 Apr 2015 11:42:21 +0200 whoopsie-preferences (0.15) vivid; urgency=medium [ Iain Lane ] * Use g_* functions more consistently, including g_file_test which is a bit clearer than access(). -- Brian Murray Fri, 13 Mar 2015 14:18:54 -0700 whoopsie-preferences (0.14) vivid; urgency=medium * Now use service status (upstart and systemd) to notify if crash reporting is enabled (LP: #1412719) * Default file for whoopsie settings (only used for report_metrics currently) is now /etc/whoopsie (LP: #1431432) * debian/control: add Breaks to ensure we dep on the right whoopsie version * Update Standards-Version. -- Didier Roche Thu, 12 Mar 2015 17:39:30 +0100 whoopsie-preferences (0.13) utopic; urgency=medium * g_mkdir_with_parents returns 0 on success. Fix a check for its return code, unbreaking the creation of the automatic reporting state file. * Check the autoreport status at startup too. -- Iain Lane Thu, 15 May 2014 12:12:15 +0100 whoopsie-preferences (0.12) trusty; urgency=medium * Add Breaks:/Replaces: for activity-log-manager-control-center to cover upgrades from Precise to Trusty, upgrades from later releases are already covered. Mirrors Breaks:/Replaces: used in activity-log-manager for these packages. (LP: #1306122) -- Andy Whitcroft Thu, 10 Apr 2014 17:59:47 +0100 whoopsie-preferences (0.11) trusty; urgency=low [ Evan Dandrea ] * Signal to policykit that we'd like a password dialog, if one is needed. [ Iain Lane ] * Try to create /var/lib/apport/ to avoid crashing when we attempt to access a file in there. (LP: #1289097) -- Iain Lane Wed, 02 Apr 2014 10:50:18 +0100 whoopsie-preferences (0.10) trusty; urgency=low * Change location of file indicating that automatic crash reporting is enabled. (LP: #1239811) -- Brian Murray Mon, 06 Jan 2014 12:11:36 -0800 whoopsie-preferences (0.9) saucy; urgency=low * Provide a method for setting automatic crash reporting. -- Evan Dandrea Mon, 29 Jul 2013 10:15:52 +0100 whoopsie-preferences (0.8) saucy; urgency=low * activity-log-manager 0.9.7-0ubuntu4 uses whoopsie-preferences. -- Evan Dandrea Thu, 25 Jul 2013 11:12:34 +0100 whoopsie-preferences (0.7) saucy; urgency=low * Fix file conflicts on unpack. Thanks Sebastien Bacher. -- Evan Dandrea Tue, 23 Jul 2013 10:39:46 +0100 whoopsie-preferences (0.6) saucy; urgency=low * Depend on libwhoopsie-preferences0 in whoopsie-preferences. * Move the .so file from libwhoopsie-preferences0 to libwhoopsie- preferences-dev. * Apply symbols file to libwhoopsie-preferences0, not whoopsie- preferences. -- Evan Dandrea Tue, 23 Jul 2013 10:00:39 +0100 whoopsie-preferences (0.5) saucy; urgency=low * Break and replace on activity-log-manager earlier than 0.9.8. -- Evan Dandrea Fri, 19 Jul 2013 15:45:39 +0100 whoopsie-preferences (0.4) saucy; urgency=low * Generate a symbols file. -- Evan Dandrea Fri, 19 Jul 2013 14:38:45 +0100 whoopsie-preferences (0.3) saucy; urgency=low * Fix build failure. -- Evan Dandrea Fri, 19 Jul 2013 11:08:40 +0100 whoopsie-preferences (0.2) saucy; urgency=low * Provide libwhoopsie0 and libwhoopsie-dev. -- Evan Dandrea Thu, 18 Jul 2013 17:58:03 +0100 whoopsie-preferences (0.1) saucy; urgency=low * Initial release. -- Evan Dandrea Thu, 18 Jul 2013 13:57:42 +0100 whoopsie-preferences-0.18/debian/libwhoopsie-preferences0.symbols0000664000000000000000000000363112574252303022233 0ustar libwhoopsie-preferences.so.0 libwhoopsie-preferences0 #MINVER# whoopsie_preferences_call_get_identifier@Base 0.9 whoopsie_preferences_call_get_identifier_finish@Base 0.9 whoopsie_preferences_call_get_identifier_sync@Base 0.9 whoopsie_preferences_call_set_automatically_report_crashes@Base 0.9 whoopsie_preferences_call_set_automatically_report_crashes_finish@Base 0.9 whoopsie_preferences_call_set_automatically_report_crashes_sync@Base 0.9 whoopsie_preferences_call_set_report_crashes@Base 0.9 whoopsie_preferences_call_set_report_crashes_finish@Base 0.9 whoopsie_preferences_call_set_report_crashes_sync@Base 0.9 whoopsie_preferences_call_set_report_metrics@Base 0.9 whoopsie_preferences_call_set_report_metrics_finish@Base 0.9 whoopsie_preferences_call_set_report_metrics_sync@Base 0.9 whoopsie_preferences_complete_get_identifier@Base 0.9 whoopsie_preferences_complete_set_automatically_report_crashes@Base 0.9 whoopsie_preferences_complete_set_report_crashes@Base 0.9 whoopsie_preferences_complete_set_report_metrics@Base 0.9 whoopsie_preferences_get_automatically_report_crashes@Base 0.9 whoopsie_preferences_get_report_crashes@Base 0.9 whoopsie_preferences_get_report_metrics@Base 0.9 whoopsie_preferences_get_type@Base 0.9 whoopsie_preferences_interface_info@Base 0.9 whoopsie_preferences_override_properties@Base 0.9 whoopsie_preferences_proxy_get_type@Base 0.9 whoopsie_preferences_proxy_new@Base 0.9 whoopsie_preferences_proxy_new_finish@Base 0.9 whoopsie_preferences_proxy_new_for_bus@Base 0.9 whoopsie_preferences_proxy_new_for_bus_finish@Base 0.9 whoopsie_preferences_proxy_new_for_bus_sync@Base 0.9 whoopsie_preferences_proxy_new_sync@Base 0.9 whoopsie_preferences_set_automatically_report_crashes@Base 0.9 whoopsie_preferences_set_report_crashes@Base 0.9 whoopsie_preferences_set_report_metrics@Base 0.9 whoopsie_preferences_skeleton_get_type@Base 0.9 whoopsie_preferences_skeleton_new@Base 0.9 whoopsie-preferences-0.18/autogen.sh0000775000000000000000000000227612574252303014501 0ustar #!/bin/sh # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. PKG_NAME="whoopsie-preferences" (test -f $srcdir/configure.ac \ && test -f $srcdir/autogen.sh) || { echo -n "**Error**: Directory \`$srcdir' does not look like the" echo " top-level $PKG_NAME directory" exit 1 } if which gnome-autogen.sh ; then REQUIRED_AUTOMAKE_VERSION=1.13 . gnome-autogen.sh else if which intltoolize && which autoreconf ; then intltoolize --copy --force --automake || \ (echo "There was an error in running intltoolize." > /dev/stderr; exit 1) autoreconf --force --install || \ (echo "There was an error in running autoreconf." > /dev/stderr; exit 1) else echo "No build script available. You have two choices:" echo "1. You need to install the gnome-common module and make" echo " sure the gnome-autogen.sh script is in your \$PATH." echo "2. You need to install the following scripts:" echo " * intltool" echo " * libtool" echo " * automake" echo " * autoconf" echo " Additionally, you need to make" echo " sure that they are in your \$PATH." exit 1 fi fi whoopsie-preferences-0.18/src/0000775000000000000000000000000012574312353013262 5ustar whoopsie-preferences-0.18/src/whoopsie-preferences.c0000664000000000000000000004673412574301546017602 0ustar /* whoopsie-preferences * * Copyright © 2011-2013 Canonical Ltd. * Author: Evan Dandrea * * 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 3 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, see . */ #define _XOPEN_SOURCE 500 #include #include #include #include #include #include #include #include #include #include #include #include #include "libwhoopsie-preferences.h" #define CONFIG_PATH "/etc/whoopsie" static GMainLoop* loop = NULL; static guint loop_shutdown = 0; static GKeyFile* key_file = NULL; static PolkitAuthority* authority = NULL; /* Hack for Ubuntu phone: check if path is an existing symlink to * /etc/writable; if it is, update that instead */ static const char* writable_filename (const char *config) { const char *result = config; struct stat sb; char *linkname = NULL; char *dirname = NULL; char *resolved_path = NULL; ssize_t r; static char realfile_buf[PATH_MAX]; g_assert (config); g_assert (g_path_is_absolute (config)); if (lstat (config, &sb) == -1) { goto out; } linkname = g_malloc (sb.st_size + 1); if (linkname == NULL) { goto out; } r = readlink (config, linkname, sb.st_size + 1); if (r < 0 || r > sb.st_size) { goto out; } linkname[sb.st_size] = '\0'; /* Make absolute if relative */ if (!g_path_is_absolute (linkname)) { dirname = g_path_get_dirname (config); resolved_path = g_build_filename ( dirname, linkname, NULL); g_free (linkname); linkname = resolved_path; } if (g_str_has_prefix (linkname, "/etc/writable")) { g_snprintf (realfile_buf, sizeof (realfile_buf), "%s", linkname); result = realfile_buf; } out: g_debug ("Writable path for %s is %s", config, result); g_free (linkname); g_free (dirname); return result; } gboolean whoopsie_preferences_load_configuration (void) { char* data; gsize data_size; gboolean ret = TRUE; GError* error = NULL; if (g_key_file_load_from_file (key_file, writable_filename(CONFIG_PATH), G_KEY_FILE_KEEP_COMMENTS, NULL)) { return TRUE; } g_key_file_set_boolean (key_file, "General", "report_metrics", TRUE); data = g_key_file_to_data (key_file, &data_size, &error); if (error) { g_print ("Could not process configuration: %s\n", error->message); ret = FALSE; goto out; } if (!g_file_set_contents (writable_filename(CONFIG_PATH), data, data_size, &error)) { g_print ("Could not write configuration: %s\n", error->message); ret = FALSE; goto out; } out: if (data) g_free (data); if (error) g_error_free (error); return ret; } static gboolean is_systemd() { return g_file_test ("/run/systemd/system", G_FILE_TEST_IS_DIR); } static gboolean whoopsie_preferences_whoopsie_enabled (GError **error) { char* systemd_check_command[] = { "/bin/systemctl", "-q", "is-enabled", "whoopsie.service", NULL }; gchar* upstart_override_content = NULL; gboolean report_crashes = FALSE; int exit_code = 0; /* systemd running */ if (is_systemd()) { if (g_spawn_sync (NULL, systemd_check_command, NULL, 0, NULL, NULL, NULL, NULL, &exit_code, error)) report_crashes = (exit_code == 0); } /* upstart running */ else { report_crashes = TRUE; if (!g_file_get_contents("/etc/init/whoopsie.override", &upstart_override_content, NULL, error)) { /* Only warn if the file exist but we couldn't access */ if (g_error_matches (*error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) g_clear_error (error); } else { if (g_strrstr(upstart_override_content, "manual") != NULL) report_crashes = FALSE; } g_free(upstart_override_content); } return report_crashes; } static void whoopsie_preferences_dbus_notify (WhoopsiePreferences* interface) { GError* error = NULL; gboolean report_crashes = FALSE; gboolean report_metrics = FALSE; gboolean automatically_report_crashes = FALSE; report_crashes = whoopsie_preferences_whoopsie_enabled (&error); if (error) { g_warning ("Could not get if whoopsie is enabled: %s", error->message); g_error_free (error); error = NULL; } report_metrics = g_key_file_get_boolean (key_file, "General", "report_metrics", &error); if (error) { g_warning ("Could not get metrics: %s", error->message); g_error_free (error); } automatically_report_crashes = g_file_test ("/var/lib/apport/autoreport", G_FILE_TEST_EXISTS); whoopsie_preferences_set_report_crashes (interface, report_crashes); whoopsie_preferences_set_automatically_report_crashes ( interface, automatically_report_crashes); whoopsie_preferences_set_report_metrics (interface, report_metrics); } static void whoopsie_preferences_file_changed (GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data) { if (event_type == G_FILE_MONITOR_EVENT_CHANGED) { whoopsie_preferences_load_configuration (); whoopsie_preferences_dbus_notify (user_data); } } gboolean autoreport_file_changed (GFileMonitor* monitor, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer user_data) { WhoopsiePreferences* interface = user_data; if (g_file_test ("/var/lib/apport/autoreport", G_FILE_TEST_EXISTS)) { whoopsie_preferences_set_automatically_report_crashes (interface, TRUE); } else { whoopsie_preferences_set_automatically_report_crashes (interface, FALSE); } return TRUE; } void monitor_autoreport_file (WhoopsiePreferences* iface) { GFile* path = NULL; GError* err = NULL; GFileMonitor* monitor = NULL; path = g_file_new_for_path ("/var/lib/apport/autoreport"); monitor = g_file_monitor_file (path, G_FILE_MONITOR_NONE, NULL, &err); g_object_unref (path); if (err) { g_print ("Unable to monitor /var/lib/apport/autoreport: %s", err->message); g_error_free (err); } else { g_signal_connect (monitor, "changed", G_CALLBACK (autoreport_file_changed), iface); } } void whoopsie_preferences_load (WhoopsiePreferences* interface) { GError* error = NULL; GFile* fp = NULL; GFileMonitor* file_monitor = NULL; fp = g_file_new_for_path (CONFIG_PATH); file_monitor = g_file_monitor_file (fp, G_FILE_MONITOR_NONE, NULL, &error); g_signal_connect (file_monitor, "changed", G_CALLBACK (whoopsie_preferences_file_changed), interface); if (error) { g_print ("Could not set up file monitor: %s\n", error->message); g_error_free (error); } g_object_unref (fp); key_file = g_key_file_new (); whoopsie_preferences_load_configuration (); } void whoopsie_preferences_notify_init (gboolean run_whoopsie) { GError* error = NULL; char* command[] = { "/usr/sbin/invoke-rc.d", "whoopsie", run_whoopsie ? "start" : "stop", NULL }; if (!g_spawn_sync (NULL, command, NULL, 0, NULL, NULL, NULL, NULL, NULL, &error)) g_print ("Could not run invoke-rc.d: %s\n", error->message); } void increase_shutdown_timeout (void) { if (loop_shutdown) g_source_remove (loop_shutdown); loop_shutdown = g_timeout_add_seconds (60, (GSourceFunc) g_main_loop_quit, loop); } gboolean whoopsie_automatic_reporting_changed (WhoopsiePreferences* object, GParamSpec* pspec, gpointer user_data) { WhoopsiePreferencesIface* iface = WHOOPSIE_PREFERENCES_GET_IFACE (object); increase_shutdown_timeout (); /* I'm aware this is usually a race, but it's really just to guard against * writing the file when it already exists. */ if (iface->get_automatically_report_crashes (object)) { if ((g_mkdir_with_parents("/var/lib/apport/", 0755) == 0) && !g_file_test ("/var/lib/apport/autoreport", G_FILE_TEST_EXISTS)) { fclose (g_fopen ("/var/lib/apport/autoreport", "w")); } } else { if (g_file_test ("/var/lib/apport/autoreport", G_FILE_TEST_EXISTS)) { g_unlink ("/var/lib/apport/autoreport"); } } return TRUE; } gboolean whoopsie_preferences_changed (WhoopsiePreferences* object, GParamSpec* pspec, gpointer user_data) { WhoopsiePreferencesIface* iface; gboolean saved_value, new_value; GError* error = NULL; char* data; char* errstr; gsize data_size; gboolean crashes = !g_strcmp0(user_data, "report_crashes"); char* crash_enable_command[] = { "/usr/sbin/update-rc.d", "whoopsie", NULL, NULL }; char* initctl_reload_command[] = { "/sbin/initctl", "reload-configuration", NULL }; gboolean spawn_ok; gint exit_status; FILE* f = NULL; increase_shutdown_timeout (); iface = WHOOPSIE_PREFERENCES_GET_IFACE (object); if (crashes) { saved_value = whoopsie_preferences_whoopsie_enabled (&error); new_value = iface->get_report_crashes (object); crash_enable_command[2] = new_value ? "enable" : "disable"; } else { new_value = iface->get_report_metrics (object); saved_value = g_key_file_get_boolean (key_file, "General", user_data, &error); } if (error) { g_print ("Could not process configuration: %s\n", error->message); } if (error || (saved_value != new_value)) { if (error) g_error_free (error); error = NULL; if (crashes) { spawn_ok = g_spawn_sync (NULL, crash_enable_command, NULL, 0, NULL, NULL, NULL, NULL, &exit_status, &error); if (!spawn_ok || exit_status != 0) { if (error) { errstr = g_strdup (error->message); g_error_free (error); } else errstr = g_strdup_printf ("exited with code %d", exit_status); g_print ("Could not run update-rc.d: %s\n", errstr); g_free (errstr); /* It's a real error for systemd */ if (is_systemd()) return FALSE; /* Works for enabling (truncating) on upstart only atm */ if (new_value) { g_debug ("Truncating the override file manually"); f = fopen ("/etc/init/whoopsie.override", "w"); if (f) { fclose (f); if (!g_spawn_sync (NULL, initctl_reload_command, NULL, 0, NULL, NULL, NULL, NULL, &exit_status, &error)) g_print ("Could not run initctl reload-configuration: %s\n", errstr); } else { g_warning ("Couldn't open override file: %s", strerror(errno)); return FALSE; } } } } else { g_key_file_set_boolean (key_file, "General", user_data, new_value); data = g_key_file_to_data (key_file, &data_size, &error); if (error) { g_print ("Could not process configuration: %s\n", error->message); return FALSE; } if (!g_file_set_contents (writable_filename(CONFIG_PATH), data, data_size, &error)) { g_print ("Could not write configuration: %s\n", error->message); return FALSE; } } } if (crashes) whoopsie_preferences_notify_init (new_value); return TRUE; } static gboolean whoopsie_preferences_on_set_report_crashes (WhoopsiePreferences* object, GDBusMethodInvocation* invocation, gboolean report, gpointer user_data) { whoopsie_preferences_set_report_crashes (object, report); whoopsie_preferences_complete_set_report_crashes (object, invocation); return TRUE; } static gboolean whoopsie_preferences_on_set_report_metrics (WhoopsiePreferences* object, GDBusMethodInvocation* invocation, gboolean report, gpointer user_data) { whoopsie_preferences_set_report_metrics (object, report); whoopsie_preferences_complete_set_report_metrics (object, invocation); return TRUE; } static gboolean whoopsie_preferences_on_set_automatically_report_crashes ( WhoopsiePreferences* object, GDBusMethodInvocation* invocation, gboolean report, gpointer user_data) { whoopsie_preferences_set_automatically_report_crashes (object, report); whoopsie_preferences_complete_set_automatically_report_crashes (object, invocation); return TRUE; } static gboolean whoopsie_preferences_on_get_identifier (WhoopsiePreferences* object, GDBusMethodInvocation* invocation) { char* identifier = NULL; GError* error = NULL; whoopsie_identifier_generate (&identifier, &error); if (error) { g_printerr ("Error getting identifier: %s\n", error->message); g_error_free (error); } whoopsie_preferences_complete_get_identifier (object, invocation, identifier); return TRUE; } static gboolean whoopsie_preferences_authorize_method (GDBusInterfaceSkeleton* interface, GDBusMethodInvocation* invocation, gpointer user_data) { PolkitSubject* subject = NULL; PolkitAuthorizationResult* result = NULL; GError* error = NULL; const char* sender = NULL; gboolean ret = FALSE; sender = g_dbus_method_invocation_get_sender (invocation); subject = polkit_system_bus_name_new (sender); result = polkit_authority_check_authorization_sync (authority, subject, "com.ubuntu.whoopsiepreferences.change", NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, NULL, &error); if (result == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_AUTH_FAILED, "Could not authorize: %s", error->message); g_error_free (error); goto out; } if (!polkit_authorization_result_get_is_authorized (result)) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_AUTH_FAILED, "Not authorized."); goto out; } ret = TRUE; out: if (result != NULL) g_object_unref (result); g_object_unref (subject); return ret; } static void on_bus_acquired (GDBusConnection* connection, const gchar* name, gpointer user_data) { WhoopsiePreferences* interface; GError* error = NULL; interface = whoopsie_preferences_skeleton_new (); if (!g_dbus_interface_skeleton_export ( G_DBUS_INTERFACE_SKELETON (interface), connection, "/com/ubuntu/WhoopsiePreferences", &error)) { g_print ("Could not export path: %s\n", error->message); g_error_free (error); g_main_loop_quit (loop); return; } authority = polkit_authority_get_sync (NULL, &error); if (authority == NULL) { g_print ("Could not get authority: %s\n", error->message); g_error_free (error); g_main_loop_quit (loop); return; } loop_shutdown = g_timeout_add_seconds (60, (GSourceFunc) g_main_loop_quit, loop); g_signal_connect (interface, "notify::report-crashes", G_CALLBACK (whoopsie_preferences_changed), "report_crashes"); g_signal_connect (interface, "notify::report-metrics", G_CALLBACK (whoopsie_preferences_changed), "report_metrics"); g_signal_connect (interface, "notify::automatically-report-crashes", G_CALLBACK (whoopsie_automatic_reporting_changed), NULL); g_signal_connect (interface, "handle-set-report-crashes", G_CALLBACK (whoopsie_preferences_on_set_report_crashes), NULL); g_signal_connect (interface, "handle-set-report-metrics", G_CALLBACK (whoopsie_preferences_on_set_report_metrics), NULL); g_signal_connect (interface, "handle-set-automatically-report-crashes", G_CALLBACK (whoopsie_preferences_on_set_automatically_report_crashes), NULL); g_signal_connect (interface, "handle-get-identifier", G_CALLBACK (whoopsie_preferences_on_get_identifier), NULL); g_signal_connect (interface, "g-authorize-method", G_CALLBACK (whoopsie_preferences_authorize_method), authority); monitor_autoreport_file (interface); whoopsie_preferences_load (interface); whoopsie_preferences_dbus_notify (interface); } static void on_name_acquired (GDBusConnection* connection, const gchar* name, gpointer user_data) { g_print ("Acquired the name: %s\n", name); } static void on_name_lost (GDBusConnection* connection, const gchar* name, gpointer user_data) { g_print ("Lost the name: %s\n", name); } int main (int argc, char** argv) { guint owner_id; if (getuid () != 0) { g_print ("This program must be run as root.\n"); return 1; } g_type_init(); owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, "com.ubuntu.WhoopsiePreferences", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_bus_unown_name (owner_id); g_main_loop_unref (loop); if (key_file) g_key_file_free (key_file); return 0; } whoopsie-preferences-0.18/src/libwhoopsie-preferences.pc.in0000664000000000000000000000041312574252303021032 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ libdir=@libdir@ Name: libwhoopsie-preferences Description: The libwhoopsie-preferences library Version: @VERSION@ Cflags: -I${includedir}/whoopsie-preferences Libs: -L${libdir} -lwhoopsie-preferences whoopsie-preferences-0.18/src/com.ubuntu.WhoopsiePreferences.conf0000664000000000000000000000164112574252303022206 0ustar whoopsie-preferences-0.18/src/whoopsie-preferences.xml0000664000000000000000000000123512574252303020137 0ustar whoopsie-preferences-0.18/src/com.ubuntu.WhoopsiePreferences.service0000664000000000000000000000014112574252303022713 0ustar [D-BUS Service] Name=com.ubuntu.WhoopsiePreferences Exec=/usr/bin/whoopsie-preferences User=root whoopsie-preferences-0.18/src/com.ubuntu.whoopsiepreferences.policy.in0000664000000000000000000000134412574252303023265 0ustar Ubuntu crash reporting https://launchpad.net/whoopsie stock_lock <_description>Privacy settings <_message>To change your privacy settings you need to authenticate. auth_admin auth_admin auth_admin_keep whoopsie-preferences-0.18/src/Makefile.am0000664000000000000000000000334012574262225015320 0ustar bin_PROGRAMS = whoopsie-preferences lib_LTLIBRARIES = libwhoopsie-preferences.la AM_CFLAGS = -Werror=implicit-function-declaration pkgconfigdir = $(libdir)/pkgconfig policykitdir = $(datadir)/polkit-1/actions/ dbussystemdir = $(sysconfdir)/dbus-1/system.d/ dbusservicedir = $(datadir)/dbus-1/system-services/ pkgconfig_DATA = libwhoopsie-preferences.pc libwhoopsie_preferences_la_LDFLAGS = \ -export-symbols-regex '^whoopsie_' \ -version-info 0:0:0 libwhoopsie_preferences_la_CFLAGS = \ -Wall \ -g \ $(POLKIT_CFLAGS) $(GIO_UNIX_CFLAGS) \ $(LIBWHOOPSIE_CFLAGS) \ $(AM_CFLAGS) libwhoopsie_preferences_la_SOURCES = \ libwhoopsie-preferences.c \ libwhoopsie-preferences.h pkginclude_HEADERS = libwhoopsie-preferences.h libwhoopsie_preferences_la_LIBADD = \ $(POLKIT_LIBS) \ $(GIO_UNIX_LIBS) \ $(LIBWHOOPSIE_LIBS) whoopsie_preferences_CFLAGS = \ -Wall \ -g \ $(POLKIT_CFLAGS) $(GIO_UNIX_CFLAGS) \ $(LIBWHOOPSIE_CFLAGS) \ $(AM_CFLAGS) whoopsie_preferences_SOURCES = \ whoopsie-preferences.c whoopsie_preferences_LDADD = \ -lwhoopsie-preferences \ $(POLKIT_LIBS) \ $(GIO_UNIX_LIBS) \ $(LIBWHOOPSIE_LIBS) policykit_in_files = com.ubuntu.whoopsiepreferences.policy.in EXTRA_DIST = \ whoopsie-preferences.xml \ com.ubuntu.WhoopsiePreferences.service \ com.ubuntu.WhoopsiePreferences.conf \ $(policykit_in_files) policykit_DATA = \ $(policykit_in_files:.policy.in=.policy) dbussystem_DATA = \ com.ubuntu.WhoopsiePreferences.conf dbusservice_DATA = \ com.ubuntu.WhoopsiePreferences.service libwhoopsie-preferences.c: whoopsie-preferences.xml gdbus-codegen --interface-prefix com.ubuntu. \ --generate-c-code libwhoopsie-preferences \ $< CLEANFILES = libwhoopsie-preferences.[ch] \ $(policykit_DATA) @INTLTOOL_POLICY_RULE@ whoopsie-preferences-0.18/Makefile.am0000664000000000000000000000007012574262217014527 0ustar ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = src whoopsie-preferences-0.18/configure.ac0000664000000000000000000000273512574252303014766 0ustar AC_INIT([whoopsie-preferences], [0.11], [http://launchpad.net/whoopsie-preferences]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_PREREQ([2.65]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([configure.ac]) AM_INIT_AUTOMAKE([1.13 foreign tar-ustar dist-xz no-dist-gzip -Wno-portability]) AM_MAINTAINER_MODE AC_PROG_CC AM_PROG_CC_C_O LT_INIT PKG_PROG_PKG_CONFIG([0.21]) AC_SUBST([CFLAGS]) AC_SUBST([CPPFLAGS]) AC_SUBST([LDFLAGS]) AC_DEFINE_UNQUOTED(LOCALE_DIR, "${PREFIX}/${DATADIRNAME}/locale",[Locale directory]) AC_DEFINE_UNQUOTED(PKG_DATA_DIR, "${PREFIX}/${DATADIRNAME}/${PACKAGE}",[Package data directory]) IT_PROG_INTLTOOL([0.35.0]) GETTEXT_PACKAGE=AC_PACKAGE_NAME AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [The domain to use with gettext]) AM_GLIB_GNU_GETTEXT PROGRAMNAME_LOCALEDIR=[${datadir}/locale] AC_SUBST(PROGRAMNAME_LOCALEDIR) PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0) PKG_CHECK_MODULES(POLKIT, polkit-gobject-1) PKG_CHECK_MODULES(LIBWHOOPSIE, libwhoopsie) PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0) AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_CFLAGS) AC_CONFIG_FILES([ Makefile src/Makefile po/Makefile.in src/libwhoopsie-preferences.pc ]) AC_OUTPUT cat <