From b0e2e3bc6c82626c978620a27b1c8a713a7fcbdc Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Fri, 19 Nov 2010 16:22:51 +0100 Subject: remove polkit Signed-off-by: Nikola Pajkovsky --- src/daemon/Makefile.am | 4 -- src/daemon/PluginManager.cpp | 1 - src/daemon/Settings.cpp | 12 ---- src/daemon/org.fedoraproject.abrt.policy | 38 ------------ src/lib/Makefile.am | 5 +- src/lib/Polkit.cpp | 102 ------------------------------- src/lib/Polkit.h | 42 ------------- src/plugins/CCpp.cpp | 1 - 8 files changed, 1 insertion(+), 204 deletions(-) delete mode 100644 src/daemon/org.fedoraproject.abrt.policy delete mode 100644 src/lib/Polkit.cpp delete mode 100644 src/lib/Polkit.h (limited to 'src') diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 86c8b3b2..c53af01b 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -93,7 +93,6 @@ abrt_action_save_package_data_CPPFLAGS = \ $(GLIB_CFLAGS) \ -D_GNU_SOURCE \ -Wall -Werror -# polkit_check_authorization is in libABRTdUtils abrt_action_save_package_data_LDADD = \ $(RPM_LIBS) \ ../lib/libABRTdUtils.la \ @@ -108,9 +107,6 @@ dist_daemonconf_DATA = \ abrt_event.conf \ gpg_keys -polkitconfdir = ${datadir}/polkit-1/actions -dist_polkitconf_DATA = org.fedoraproject.abrt.policy - comredhatabrtservicedir = ${datadir}/dbus-1/system-services dist_comredhatabrtservice_DATA = com.redhat.abrt.service diff --git a/src/daemon/PluginManager.cpp b/src/daemon/PluginManager.cpp index e54f8bc0..d5c86c09 100644 --- a/src/daemon/PluginManager.cpp +++ b/src/daemon/PluginManager.cpp @@ -21,7 +21,6 @@ #include #include "abrtlib.h" #include "abrt_exception.h" -#include "Polkit.h" #include "PluginManager.h" using namespace std; diff --git a/src/daemon/Settings.cpp b/src/daemon/Settings.cpp index d1cd271a..d0c44c20 100644 --- a/src/daemon/Settings.cpp +++ b/src/daemon/Settings.cpp @@ -18,7 +18,6 @@ */ #include "abrtlib.h" #include "Settings.h" -#include "Polkit.h" #define SECTION_COMMON "Common" #define SECTION_CRON "Cron" @@ -432,17 +431,6 @@ map_abrt_settings_t GetSettings() /* dbus call to change some .conf file data */ void SetSettings(const map_abrt_settings_t& pSettings, const char *dbus_sender) { - int polkit_result; - - polkit_result = polkit_check_authorization(dbus_sender, - "org.fedoraproject.abrt.change-daemon-settings"); - if (polkit_result != PolkitYes) - { - error_msg("user %s not authorized, returned %d", dbus_sender, polkit_result); - return; - } - log("user %s succesfully authorized", dbus_sender); - map_abrt_settings_t::const_iterator it = pSettings.find(SECTION_COMMON); map_abrt_settings_t::const_iterator end = pSettings.end(); if (it != end) diff --git a/src/daemon/org.fedoraproject.abrt.policy b/src/daemon/org.fedoraproject.abrt.policy deleted file mode 100644 index 9261acdc..00000000 --- a/src/daemon/org.fedoraproject.abrt.policy +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - The ABRT Team - https://fedorahosted.org/abrt/ - - - Manage settings - Changing the global settings requires authentication - - no - auth_admin_keep - no - - - - - - Install debuginfos - Installing debuginfos requires authentication - - yes - yes - yes - - - diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 055d99f4..cb42abe7 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -62,8 +62,7 @@ libABRTdUtils_la_SOURCES = \ parse_release.cpp \ make_descr.cpp \ $(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \ - $(HEADER_DIR)/plugin.h Plugin.cpp \ - Polkit.h Polkit.cpp + $(HEADER_DIR)/plugin.h Plugin.cpp libABRTdUtils_la_CPPFLAGS = \ -Wall \ -I$(srcdir)/../include \ @@ -72,12 +71,10 @@ libABRTdUtils_la_CPPFLAGS = \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ -DCONF_DIR=\"$(CONF_DIR)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ - $(POLKIT_CFLAGS) \ -D_GNU_SOURCE libABRTdUtils_la_LDFLAGS = \ -version-info 0:1:0 libABRTdUtils_la_LIBADD = \ - $(POLKIT_LIBS) \ -ldl libABRT_web_utils_la_SOURCES = \ diff --git a/src/lib/Polkit.cpp b/src/lib/Polkit.cpp deleted file mode 100644 index a5e07760..00000000 --- a/src/lib/Polkit.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - Polkit.cpp - PolicyKit integration for ABRT - - Copyright (C) 2009 Daniel Novotny (dnovotny@redhat.com) - Copyright (C) 2009 RedHat inc. - - 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 2 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, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include -#include -#include -#include - -#include "Polkit.h" -#include "abrtlib.h" - -/*number of seconds: timeout for the authorization*/ -#define POLKIT_TIMEOUT 20 - -static gboolean do_cancel(GCancellable* cancellable) -{ - log("Timer has expired; cancelling authorization check\n"); - g_cancellable_cancel(cancellable); - return FALSE; -} - - -static PolkitResult do_check(PolkitSubject *subject, const char *action_id) -{ - PolkitAuthority *authority; - PolkitAuthorizationResult *result; - GError *error = NULL; - GCancellable * cancellable; - - authority = polkit_authority_get(); - cancellable = g_cancellable_new(); - - guint cancel_timeout = g_timeout_add(POLKIT_TIMEOUT * 1000, - (GSourceFunc) do_cancel, - cancellable); - - result = polkit_authority_check_authorization_sync(authority, - subject, - action_id, - NULL, - POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, - cancellable, - &error); - g_object_unref(authority); - g_source_remove(cancel_timeout); - if (error) - { - g_error_free(error); - return PolkitUnknown; - } - - if (result) - { - if (polkit_authorization_result_get_is_challenge(result)) - { - /* Can't happen (happens only with - * POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE flag) */ - g_object_unref(result); - return PolkitChallenge; - } - if (polkit_authorization_result_get_is_authorized(result)) - { - g_object_unref(result); - return PolkitYes; - } - g_object_unref(result); - return PolkitNo; - } - - return PolkitUnknown; -} - -PolkitResult polkit_check_authorization(const char *dbus_name, const char *action_id) -{ - g_type_init(); - PolkitSubject *subject = polkit_system_bus_name_new(dbus_name); - return do_check(subject, action_id); -} - -PolkitResult polkit_check_authorization(pid_t pid, const char *action_id) -{ - g_type_init(); - PolkitSubject *subject = polkit_unix_process_new(pid); - return do_check(subject, action_id); -} diff --git a/src/lib/Polkit.h b/src/lib/Polkit.h deleted file mode 100644 index d9e097ac..00000000 --- a/src/lib/Polkit.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Polkit.h - header file for PolicyKit integration - - Copyright (C) 2009 Daniel Novotny (dnovotny@redhat.com) - Copyright (C) 2009 RedHat inc. - - 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 2 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, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef ABRT_POLKIT_H -#define ABRT_POLKIT_H - -#include -#include - -typedef enum { -/* Authorization status is unknown */ - PolkitUnknown = 0x0, - /* Subject is authorized for the action */ - PolkitYes = 0x01, - /* Subject is not authorized for the action */ - PolkitNo = 0x02, - /* Challenge is needed for this action, only when flag is - * POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE */ - PolkitChallenge = 0x03 -} PolkitResult; - -PolkitResult polkit_check_authorization(const char *dbus_name, const char *action_id); -PolkitResult polkit_check_authorization(pid_t pid, const char *action_id); - -#endif diff --git a/src/plugins/CCpp.cpp b/src/plugins/CCpp.cpp index fad9cf62..9f03d947 100644 --- a/src/plugins/CCpp.cpp +++ b/src/plugins/CCpp.cpp @@ -23,7 +23,6 @@ #include "CCpp.h" #include "abrt_exception.h" #include "comm_layer_inner.h" -#include "Polkit.h" using namespace std; -- cgit From ed9efa9366add566a20be6132c70df08dc50673a Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Fri, 19 Nov 2010 16:34:04 +0100 Subject: remove PLUGIN_DYNAMIC_LOAD_UNLOAD it contains polkit Signed-off-by: Nikola Pajkovsky --- src/daemon/CommLayerServerDBus.cpp | 48 -------------------------------------- src/daemon/PluginManager.cpp | 29 ----------------------- src/daemon/PluginManager.h | 14 ----------- src/gui/CCDBusBackend.py | 7 ------ src/gui/PluginsSettingsDialog.py | 31 ------------------------ 5 files changed, 129 deletions(-) (limited to 'src') diff --git a/src/daemon/CommLayerServerDBus.cpp b/src/daemon/CommLayerServerDBus.cpp index ecff0920..28d6ee05 100644 --- a/src/daemon/CommLayerServerDBus.cpp +++ b/src/daemon/CommLayerServerDBus.cpp @@ -350,48 +350,6 @@ static int handle_GetPluginSettings(DBusMessage* call, DBusMessage* reply) return 0; } -#ifdef PLUGIN_DYNAMIC_LOAD_UNLOAD -static int handle_RegisterPlugin(DBusMessage* call, DBusMessage* reply) -{ - int r; - DBusMessageIter in_iter; - dbus_message_iter_init(call, &in_iter); - const char* PluginName; - r = load_val(&in_iter, PluginName); - if (r != ABRT_DBUS_LAST_FIELD) - { - error_msg("dbus call %s: parameter type mismatch", __func__ + 7); - return -1; - } - - const char * sender = dbus_message_get_sender(call); - g_pPluginManager->RegisterPluginDBUS(PluginName, sender); - - send_flush_and_unref(reply); - return 0; -} - -static int handle_UnRegisterPlugin(DBusMessage* call, DBusMessage* reply) -{ - int r; - DBusMessageIter in_iter; - dbus_message_iter_init(call, &in_iter); - const char* PluginName; - r = load_val(&in_iter, PluginName); - if (r != ABRT_DBUS_LAST_FIELD) - { - error_msg("dbus call %s: parameter type mismatch", __func__ + 7); - return -1; - } - - const char * sender = dbus_message_get_sender(call); - g_pPluginManager->UnRegisterPluginDBUS(PluginName, sender); - - send_flush_and_unref(reply); - return 0; -} -#endif - static int handle_GetSettings(DBusMessage* call, DBusMessage* reply) { map_abrt_settings_t result = GetSettings(); @@ -453,12 +411,6 @@ static DBusHandlerResult message_received(DBusConnection* conn, DBusMessage* msg r = handle_GetPluginsInfo(msg, reply); else if (strcmp(member, "GetPluginSettings") == 0) r = handle_GetPluginSettings(msg, reply); -#ifdef PLUGIN_DYNAMIC_LOAD_UNLOAD - else if (strcmp(member, "RegisterPlugin") == 0) - r = handle_RegisterPlugin(msg, reply); - else if (strcmp(member, "UnRegisterPlugin") == 0) - r = handle_UnRegisterPlugin(msg, reply); -#endif else if (strcmp(member, "GetSettings") == 0) r = handle_GetSettings(msg, reply); else if (strcmp(member, "SetSettings") == 0) diff --git a/src/daemon/PluginManager.cpp b/src/daemon/PluginManager.cpp index d5c86c09..0f7b983d 100644 --- a/src/daemon/PluginManager.cpp +++ b/src/daemon/PluginManager.cpp @@ -230,35 +230,6 @@ void CPluginManager::UnLoadPlugin(const char *pName) } } -#ifdef PLUGIN_DYNAMIC_LOAD_UNLOAD -void CPluginManager::RegisterPluginDBUS(const char *pName, const char *pDBUSSender) -{ - int polkit_result = polkit_check_authorization(pDBUSSender, - "org.fedoraproject.abrt.change-daemon-settings"); - if (polkit_result == PolkitYes) - { -//TODO: report success/failure - LoadPlugin(pName); - } else - { - log("User %s not authorized, returned %d", pDBUSSender, polkit_result); - } -} - -void CPluginManager::UnRegisterPluginDBUS(const char *pName, const char *pDBUSSender) -{ - int polkit_result = polkit_check_authorization(pDBUSSender, - "org.fedoraproject.abrt.change-daemon-settings"); - if (polkit_result == PolkitYes) - { - UnLoadPlugin(pName); - } else - { - log("user %s not authorized, returned %d", pDBUSSender, polkit_result); - } -} -#endif - CAction* CPluginManager::GetAction(const char *pName, bool silent) { CPlugin *plugin = LoadPlugin(pName); diff --git a/src/daemon/PluginManager.h b/src/daemon/PluginManager.h index ed2818b3..1d2b4bd3 100644 --- a/src/daemon/PluginManager.h +++ b/src/daemon/PluginManager.h @@ -83,20 +83,6 @@ class CPluginManager * @param pName A plugin name. */ void UnLoadPlugin(const char *pName); -#ifdef PLUGIN_DYNAMIC_LOAD_UNLOAD - /** - * A method, which registers particular plugin. - * @param pName A plugin name. - */ - void RegisterPluginDBUS(const char *pName, const char *pDBUSSender); - /** - * A method, which unregister particular plugin, - * called via DBUS - * @param pName A plugin name. - * @param pDBUSSender DBUS user identification - */ - void UnRegisterPluginDBUS(const char *pName, const char *pDBUSSender); -#endif /** * A method, which returns instance of particular action plugin. * @param pName A plugin name. diff --git a/src/gui/CCDBusBackend.py b/src/gui/CCDBusBackend.py index c3e8f0ab..b983d141 100644 --- a/src/gui/CCDBusBackend.py +++ b/src/gui/CCDBusBackend.py @@ -208,13 +208,6 @@ class DBusManager(gobject.GObject): settings = self.daemon().GetPluginSettings(plugin_name) return settings -# "Enable" toggling in GUI is disabled for now. Grep for PLUGIN_DYNAMIC_LOAD_UNLOAD -# def registerPlugin(self, plugin_name): -# return self.daemon().RegisterPlugin(plugin_name) -# -# def unRegisterPlugin(self, plugin_name): -# return self.daemon().UnRegisterPlugin(plugin_name) - def getSettings(self): return self.daemon().GetSettings() diff --git a/src/gui/PluginsSettingsDialog.py b/src/gui/PluginsSettingsDialog.py index aba65d19..55e82ec3 100644 --- a/src/gui/PluginsSettingsDialog.py +++ b/src/gui/PluginsSettingsDialog.py @@ -54,43 +54,12 @@ class PluginsSettingsDialog: column.set_resizable(True) self.pluginlist.append_column(column) -# "Enable" toggle column is disabled for now. Grep for PLUGIN_DYNAMIC_LOAD_UNLOAD -# column = gtk.TreeViewColumn(_("Enabled")) -# # column "enabled" has one kind of cells: -# cell_toggle_enable = gtk.CellRendererToggle() -# cell_toggle_enable.set_property("activatable", True) -# cell_toggle_enable.connect("toggled", self.on_enabled_toggled, self.pluginsListStore) -# column.pack_start(cell_toggle_enable, True) -# column.add_attribute(cell_toggle_enable, "active", 1) -# column.add_attribute(cell_toggle_enable, "visible", 2) -# self.pluginlist.append_column(column) - #connect signals self.pluginlist.connect("cursor-changed", self.on_tvDumps_cursor_changed) self.builder.get_object("bConfigurePlugin").connect("clicked", self.on_bConfigurePlugin_clicked, self.pluginlist) self.builder.get_object("bClose").connect("clicked", self.on_bClose_clicked) self.builder.get_object("bConfigurePlugin").set_sensitive(False) -# "Enable" toggle column is disabled for now. Grep for PLUGIN_DYNAMIC_LOAD_UNLOAD -# def on_enabled_toggled(self,cell, path, model): -# plugin = model[path][model.get_n_columns()-1] -# if plugin: -# if model[path][1]: -# #print "self.ccdaemon.UnRegisterPlugin(%s)" % (plugin.getName()) -# self.ccdaemon.unRegisterPlugin(plugin.getName()) -# # FIXME: create class plugin and move this into method Plugin.Enable() -# plugin.Enabled = "no" -# plugin.Settings = None -# else: -# #print "self.ccdaemon.RegisterPlugin(%s)" % (model[path][model.get_n_columns()-1]) -# self.ccdaemon.registerPlugin(plugin.getName()) -# # FIXME: create class plugin and move this into method Plugin.Enable() -# plugin.Enabled = "yes" -# default_settings = self.ccdaemon.getPluginSettings(plugin.getName()) -# plugin.Settings = PluginSettings() -# plugin.Settings.load(plugin.getName(), default_settings) -# model[path][1] = not model[path][1] - def filter_plugins(self, model, miter, data): return True -- cgit