Remove dbus interface to UI
authorWilliam Douglas <william.douglas@intel.com>
Mon, 21 May 2012 21:32:32 +0000 (14:32 -0700)
committerWilliam Douglas <william.douglas@intel.com>
Mon, 21 May 2012 21:32:32 +0000 (14:32 -0700)
Signed-off-by: William Douglas <william.douglas@intel.com>
Makefile.am
configure.ac
corewatcher.conf
corewatcher.dbus [deleted file]
src/Makefile.am
src/coredump.c
src/corewatcher.c
src/corewatcher.h
src/submit.c

index 87e5848..bd86b0e 100644 (file)
@@ -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
index 132f70b..ff96b57 100644 (file)
@@ -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])
index d5c5e4e..a7adc05 100644 (file)
@@ -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 (file)
index 20373a4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<!-- This configuration file specifies the required security policies
-     for corewatcher service to work. -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-
-  <!-- ../system.conf have denied everything, so we just punch some holes -->
-
-  <policy user="root">
-    <allow own="org.corewatcher.submit"/>
-    <allow own="org.corewatcher.submit.ping"/>
-    <allow own="org.corewatcher.submit.permission"/>
-    <allow own="org.corewatcher.submit.sent"/>
-    <allow own="org.corewatcher.submit.url"/>
-  </policy>
-
-  <policy at_console="true">
-    <allow send_destination="org.corewatcher.submit"/>
-    <allow send_destination="org.corewatcher.submit.ping"/>
-  </policy>
-
-</busconfig>
index 2cae526..e3cb974 100644 (file)
@@ -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
index 72262a4..86d7cdb 100644 (file)
@@ -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;
index 91e1ac8..724fdc7 100644 (file)
@@ -37,9 +37,6 @@
 #include <curl/curl.h>
 
 #include <glib.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
 
 
 /* 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++)
index 623f5ee..df07944 100644 (file)
@@ -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;
index e18d0a5..bb404c7 100644 (file)
@@ -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);