From 8c582f7590ef91c1add0cd11a14944d75bd3542b Mon Sep 17 00:00:00 2001 From: William Douglas Date: Mon, 21 May 2012 14:32:32 -0700 Subject: [PATCH] Remove dbus interface to UI Signed-off-by: William Douglas --- Makefile.am | 6 +-- configure.ac | 2 - corewatcher.conf | 2 +- corewatcher.dbus | 23 --------- src/Makefile.am | 7 +-- src/coredump.c | 17 ------- src/corewatcher.c | 138 ------------------------------------------------------ src/corewatcher.h | 3 -- src/submit.c | 1 - 9 files changed, 3 insertions(+), 196 deletions(-) delete mode 100644 corewatcher.dbus diff --git a/Makefile.am b/Makefile.am index 87e5848..bd86b0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,6 @@ sysctldir = $(sysconfdir)/sysctl.d dist_sysctl_DATA = \ corewatcher-core.conf -dbusdir = $(sysconfdir)/dbus-1/system.d -dist_dbus_DATA = \ - corewatcher.dbus - corefileconfdir = $(sysconfdir)/security/limits.d dist_corefileconf_DATA = \ - 95-core.conf \ No newline at end of file + 95-core.conf diff --git a/configure.ac b/configure.ac index 132f70b..ff96b57 100644 --- a/configure.ac +++ b/configure.ac @@ -14,8 +14,6 @@ AC_PROG_INSTALL AC_CHECK_LIB([pthread], [pthread_mutex_unlock], , AC_MSG_ERROR([libpthread is required but was not found])) # PkgConfig tests -PKG_CHECK_MODULES([DBUS], [dbus-1]) -PKG_CHECK_MODULES([DBUSGLIB], [dbus-glib-1]) PKG_CHECK_MODULES([GLIB2], [glib-2.0]) PKG_CHECK_MODULES([LIBPROXY], [libproxy-1.0]) PKG_CHECK_MODULES([LIBNOTIFY], [libnotify]) diff --git a/corewatcher.conf b/corewatcher.conf index d5c5e4e..a7adc05 100644 --- a/corewatcher.conf +++ b/corewatcher.conf @@ -21,7 +21,7 @@ # # Default is "ask" which uses a UI application t ask the user for permission # -allow-submit=ask +allow-submit=yes # # Set the following variable to "yes" if you want to allow your diff --git a/corewatcher.dbus b/corewatcher.dbus deleted file mode 100644 index 20373a4..0000000 --- a/corewatcher.dbus +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Makefile.am b/src/Makefile.am index 2cae526..e3cb974 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,16 +13,11 @@ corewatcher_config_SOURCES = \ corewatcher-config.c corewatcher_CFLAGS = \ - $(DBUS_CFLAGS) \ - $(DBUSGLIB_CFLAGS) \ - $(GLIB2_CFLAGS) \ $(LIBPROXY_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ $(LIBCURL_CFLAGS) corewatcher_LDADD = \ - $(DBUS_LIBS) \ - $(DBUSGLIB_LIBS) \ $(GLIB2_LIBS) \ $(LIBPROXY_LIBS) \ $(LIBNOTIFY_LIBS) \ @@ -34,4 +29,4 @@ corewatcher_config_LDADD = \ $(GLIB2_LIBS) noinst_HEADERS = \ - corewatcher.h \ No newline at end of file + corewatcher.h diff --git a/src/coredump.c b/src/coredump.c index 72262a4..86d7cdb 100644 --- a/src/coredump.c +++ b/src/coredump.c @@ -692,24 +692,7 @@ static char *get_appfile(char *fullpath) return NULL; if (opted_in == 2) { - dbus_say_found(fullpath, appfile); move_core(fullpath, "to-process"); - } else if (opted_in == 1) { - char *fp = NULL, *af = NULL; - if (!(fp = strdup(fullpath))) { - free(appfile); - return NULL; - } - if (!(af = strdup(appfile))) { - free(fp); - free(appfile); - return NULL; - } - dbus_ask_permission(fullpath, appfile); - /* If we got here the oops wasn't in the hash so add it */ - pthread_mutex_lock(&core_status.asked_mtx); - g_hash_table_insert(core_status.asked_oops, fp, af); - pthread_mutex_unlock(&core_status.asked_mtx); } else { free(appfile); return NULL; diff --git a/src/corewatcher.c b/src/corewatcher.c index 91e1ac8..724fdc7 100644 --- a/src/corewatcher.c +++ b/src/corewatcher.c @@ -37,9 +37,6 @@ #include #include -#include -#include -#include /* see linux kernel doc Documentation/block/ioprio.txt */ @@ -63,9 +60,6 @@ static struct option opts[] = { struct core_status core_status; -static DBusConnection *bus; - -int pinged; int testmode = 0; static void usage(const char *name) @@ -78,129 +72,9 @@ static void usage(const char *name) fprintf(stderr, " -h, --help Display this help message\n"); } -static DBusHandlerResult got_message( - DBusConnection __unused *conn, - DBusMessage *message, - void __unused *user_data) -{ - char *fullpath = NULL, *appfile = NULL; - - if (dbus_message_is_signal(message, - "org.corewatcher.submit.ping", "ping")) { - pinged = 1; - return DBUS_HANDLER_RESULT_HANDLED; - } - - if (dbus_message_is_signal(message, - "org.corewatcher.submit.permission", "yes")) { - dbus_message_get_args(message, NULL, - DBUS_TYPE_STRING, &fullpath, - DBUS_TYPE_STRING, &appfile, - DBUS_TYPE_INVALID); - move_core(fullpath, "to-process"); - pthread_mutex_lock(&core_status.asked_mtx); - g_hash_table_remove(core_status.asked_oops, fullpath); - pthread_mutex_unlock(&core_status.asked_mtx); - return DBUS_HANDLER_RESULT_HANDLED; - } - if (dbus_message_is_signal(message, - "org.corewatcher.submit.permission", "always")) { - opted_in = 2; - dbus_message_get_args(message, NULL, - DBUS_TYPE_STRING, &fullpath, - DBUS_TYPE_STRING, &appfile, - DBUS_TYPE_INVALID); - move_core(fullpath, "to-process"); - pthread_mutex_lock(&core_status.asked_mtx); - g_hash_table_remove(core_status.asked_oops, fullpath); - pthread_mutex_unlock(&core_status.asked_mtx); - return DBUS_HANDLER_RESULT_HANDLED; - } - if (dbus_message_is_signal(message, - "org.corewatcher.submit.permission", "never")) { - opted_in = 0; - dbus_message_get_args(message, NULL, - DBUS_TYPE_STRING, &fullpath, - DBUS_TYPE_STRING, &appfile, - DBUS_TYPE_INVALID); - unlink(fullpath); - pthread_mutex_lock(&core_status.asked_mtx); - g_hash_table_remove(core_status.asked_oops, fullpath); - pthread_mutex_unlock(&core_status.asked_mtx); - return DBUS_HANDLER_RESULT_HANDLED; - } - if (dbus_message_is_signal(message, - "org.corewatcher.submit.permission", "no")) { - dbus_message_get_args(message, NULL, - DBUS_TYPE_STRING, &fullpath, - DBUS_TYPE_STRING, &appfile, - DBUS_TYPE_INVALID); - unlink(fullpath); - pthread_mutex_lock(&core_status.asked_mtx); - g_hash_table_remove(core_status.asked_oops, fullpath); - pthread_mutex_unlock(&core_status.asked_mtx); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -void dbus_ask_permission(char *fullpath, char *appfile) -{ - DBusMessage *message; - if (!bus || !fullpath || !appfile) - return; - - message = dbus_message_new_signal("/org/corewatcher/submit/permission", - "org.corewatcher.submit.permission", "ask"); - - dbus_message_append_args(message, - DBUS_TYPE_STRING, &fullpath, - DBUS_TYPE_STRING, &appfile, - DBUS_TYPE_INVALID); - - dbus_connection_send(bus, message, NULL); - dbus_message_unref(message); -} - - -void dbus_say_thanks(char *url) -{ - DBusMessage *message; - - if (!bus) - return; - if (url && strlen(url)) { - message = dbus_message_new_signal("/org/corewatcher/submit/url", - "org.corewatcher.submit.url", "url"); - dbus_message_append_args (message, DBUS_TYPE_STRING, &url, DBUS_TYPE_INVALID); - dbus_connection_send(bus, message, NULL); - dbus_message_unref(message); - syslog(LOG_WARNING, "corewatcher.org: oops is posted as %s", url); - } -} - -void dbus_say_found(char *fullpath, char *appfile) -{ - DBusMessage *message; - - if (!bus || !fullpath || !appfile) - return; - - message = dbus_message_new_signal("/org/corewatcher/submit/sent", - "org.corewatcher.submit.sent", "sent"); - dbus_message_append_args(message, DBUS_TYPE_STRING, &fullpath, - DBUS_TYPE_STRING, &appfile, - DBUS_TYPE_INVALID); - - dbus_connection_send(bus, message, NULL); - dbus_message_unref(message); -} - int main(int argc, char**argv) { GMainLoop *loop; - DBusError error; int godaemon = 1; int debug = 0; int j = 0; @@ -286,14 +160,6 @@ int main(int argc, char**argv) sched_yield(); loop = g_main_loop_new(NULL, FALSE); - dbus_error_init(&error); - bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error); - if (bus) { - dbus_connection_setup_with_g_main(bus, NULL); - dbus_bus_add_match(bus, "type='signal',interface='org.corewatcher.submit.ping'", &error); - dbus_bus_add_match(bus, "type='signal',interface='org.corewatcher.submit.permission'", &error); - dbus_connection_add_filter(bus, got_message, NULL, NULL); - } if (!debug) sleep(20); @@ -304,8 +170,6 @@ int main(int argc, char**argv) if (testmode) { g_main_loop_unref(loop); - dbus_bus_remove_match(bus, "type='signal',interface='org.corewatcher.submit.ping'", &error); - dbus_bus_remove_match(bus, "type='signal',interface='org.corewatcher.submit.permission'", &error); for (j = 0; j < url_count; j++) free(submit_url[j]); g_hash_table_destroy(core_status.asked_oops); @@ -323,8 +187,6 @@ int main(int argc, char**argv) g_timeout_add_seconds(10, scan_corefolders, NULL); g_main_loop_run(loop); - dbus_bus_remove_match(bus, "type='signal',interface='org.corewatcher.submit.ping'", &error); - dbus_bus_remove_match(bus, "type='signal',interface='org.corewatcher.submit.permission'", &error); g_main_loop_unref(loop); for (j = 0; j < url_count; j++) diff --git a/src/corewatcher.h b/src/corewatcher.h index 623f5ee..df07944 100644 --- a/src/corewatcher.h +++ b/src/corewatcher.h @@ -93,9 +93,6 @@ extern int do_unlink; extern int private_report; /* corewatcher.c */ -extern void dbus_ask_permission(char *fullpath, char *appfile); -extern void dbus_say_thanks(char *url); -extern void dbus_say_found(char *fullpath, char *appfile); extern int testmode; extern int pinged; extern struct core_status core_status; diff --git a/src/submit.c b/src/submit.c index e18d0a5..bb404c7 100644 --- a/src/submit.c +++ b/src/submit.c @@ -245,7 +245,6 @@ static void submit_queue_with_url(struct oops *queue, char *wsubmit_url, char *p } g_hash_table_remove(core_status.queued_oops, oops->filename); - dbus_say_thanks(result_url); count++; } else { g_hash_table_remove(core_status.queued_oops, oops->filename); -- 2.7.4