Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com --- abrt.spec | 2 - configure.ac | 1 - 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 - 10 files changed, 1 insertions(+), 207 deletions(-) delete mode 100644 src/daemon/org.fedoraproject.abrt.policy delete mode 100644 src/lib/Polkit.cpp delete mode 100644 src/lib/Polkit.h
diff --git a/abrt.spec b/abrt.spec index 8406be6..e1dbdc0 100644 --- a/abrt.spec +++ b/abrt.spec @@ -42,7 +42,6 @@ BuildRequires: file-devel BuildRequires: python-devel BuildRequires: gettext BuildRequires: libxml2-devel -BuildRequires: polkit-devel BuildRequires: libtar-devel, bzip2-devel, zlib-devel BuildRequires: intltool BuildRequires: bison @@ -346,7 +345,6 @@ fi %{_mandir}/man5/%{name}.conf.5.gz # {_mandir}/man5/pyhook.conf.5.gz %{_mandir}/man7/%{name}-plugins.7.gz -%{_datadir}/polkit-1/actions/org.fedoraproject.abrt.policy %{_datadir}/dbus-1/system-services/com.redhat.abrt.service %config(noreplace) %{_sysconfdir}/%{name}/plugins/SQLite3.conf %{_libdir}/%{name}/libSQLite3.so* diff --git a/configure.ac b/configure.ac index 85d9d6a..8af0906 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,6 @@ PKG_CHECK_MODULES([LIBNOTIFY], [libnotify]) #PKG_CHECK_MODULES([NSS], [nss]) PKG_CHECK_MODULES([XMLRPC], [xmlrpc]) PKG_CHECK_MODULES([XMLRPC_CLIENT], [xmlrpc_client]) -PKG_CHECK_MODULES([POLKIT], [polkit-gobject-1])
PKG_PROG_PKG_CONFIG AC_ARG_WITH([systemdsystemunitdir], diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 86c8b3b..c53af01 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 e54f8bc..d5c86c0 100644 --- a/src/daemon/PluginManager.cpp +++ b/src/daemon/PluginManager.cpp @@ -21,7 +21,6 @@ #include <dlfcn.h> #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 d1cd271..d0c44c2 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 9261acd..0000000 --- a/src/daemon/org.fedoraproject.abrt.policy +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE policyconfig PUBLIC - "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" - "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"> - -<!-- -PolicyKit policy definitions for ABRT - -Copyright (c) 2009 Daniel Novotny dnovotny@redhat.com -Copyright (c) 2009 Red Hat inc. - ---> - -<policyconfig> - <vendor>The ABRT Team</vendor> - <vendor_url>https://fedorahosted.org/abrt/</vendor_url> - - <action id="org.fedoraproject.abrt.change-daemon-settings"> - <description>Manage settings</description> - <message>Changing the global settings requires authentication</message> - <defaults> - <allow_any>no</allow_any> - <allow_active>auth_admin_keep</allow_active> - <allow_inactive>no</allow_inactive> - </defaults> - </action> - - <!-- install-debuginfos: default yes, administrator can change this --> - <action id="org.fedoraproject.abrt.install-debuginfos"> - <description>Install debuginfos</description> - <message>Installing debuginfos requires authentication</message> - <defaults> - <allow_any>yes</allow_any> - <allow_active>yes</allow_active> - <allow_inactive>yes</allow_inactive> - </defaults> - </action> -</policyconfig> diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 055d99f..cb42abe 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 a5e0776..0000000 --- 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 <polkit/polkit.h> -#include <glib-object.h> -#include <sys/types.h> -#include <unistd.h> - -#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 d9e097a..0000000 --- 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 <sys/types.h> -#include <unistd.h> - -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 fad9cf6..9f03d94 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;
it contains polkit
Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com --- 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, 0 insertions(+), 129 deletions(-)
diff --git a/src/daemon/CommLayerServerDBus.cpp b/src/daemon/CommLayerServerDBus.cpp index ecff092..28d6ee0 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 d5c86c0..0f7b983 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 ed2818b..1d2b4bd 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 c3e8f0a..b983d14 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 aba65d1..55e82ec 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
This also seems ok, please apply.
On 11/19/2010 04:35 PM, Nikola Pajkovsky wrote:
it contains polkit
Signed-off-by: Nikola Pajkovskynpajkovs@redhat.com
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, 0 insertions(+), 129 deletions(-)
diff --git a/src/daemon/CommLayerServerDBus.cpp b/src/daemon/CommLayerServerDBus.cpp index ecff092..28d6ee0 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 d5c86c0..0f7b983 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 ed2818b..1d2b4bd 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 c3e8f0a..b983d14 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 aba65d1..55e82ec 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
Works fine, please apply.
Thx.
On 11/19/2010 04:35 PM, Nikola Pajkovsky wrote:
Signed-off-by: Nikola Pajkovskynpajkovs@redhat.com
abrt.spec | 2 - configure.ac | 1 - 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 - 10 files changed, 1 insertions(+), 207 deletions(-) delete mode 100644 src/daemon/org.fedoraproject.abrt.policy delete mode 100644 src/lib/Polkit.cpp delete mode 100644 src/lib/Polkit.h
diff --git a/abrt.spec b/abrt.spec index 8406be6..e1dbdc0 100644 --- a/abrt.spec +++ b/abrt.spec @@ -42,7 +42,6 @@ BuildRequires: file-devel BuildRequires: python-devel BuildRequires: gettext BuildRequires: libxml2-devel -BuildRequires: polkit-devel BuildRequires: libtar-devel, bzip2-devel, zlib-devel BuildRequires: intltool BuildRequires: bison @@ -346,7 +345,6 @@ fi %{_mandir}/man5/%{name}.conf.5.gz # {_mandir}/man5/pyhook.conf.5.gz %{_mandir}/man7/%{name}-plugins.7.gz -%{_datadir}/polkit-1/actions/org.fedoraproject.abrt.policy %{_datadir}/dbus-1/system-services/com.redhat.abrt.service %config(noreplace) %{_sysconfdir}/%{name}/plugins/SQLite3.conf %{_libdir}/%{name}/libSQLite3.so* diff --git a/configure.ac b/configure.ac index 85d9d6a..8af0906 100644 --- a/configure.ac +++ b/configure.ac @@ -48,7 +48,6 @@ PKG_CHECK_MODULES([LIBNOTIFY], [libnotify]) #PKG_CHECK_MODULES([NSS], [nss]) PKG_CHECK_MODULES([XMLRPC], [xmlrpc]) PKG_CHECK_MODULES([XMLRPC_CLIENT], [xmlrpc_client]) -PKG_CHECK_MODULES([POLKIT], [polkit-gobject-1])
PKG_PROG_PKG_CONFIG AC_ARG_WITH([systemdsystemunitdir], diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 86c8b3b..c53af01 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 e54f8bc..d5c86c0 100644 --- a/src/daemon/PluginManager.cpp +++ b/src/daemon/PluginManager.cpp @@ -21,7 +21,6 @@ #include<dlfcn.h> #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 d1cd271..d0c44c2 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 9261acd..0000000 --- a/src/daemon/org.fedoraproject.abrt.policy +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd%22%3E
-<!-- -PolicyKit policy definitions for ABRT
-Copyright (c) 2009 Daniel Novotnydnovotny@redhat.com -Copyright (c) 2009 Red Hat inc.
--->
-<policyconfig> -<vendor>The ABRT Team</vendor> -<vendor_url>https://fedorahosted.org/abrt/</vendor_url>
-<action id="org.fedoraproject.abrt.change-daemon-settings"> -<description>Manage settings</description> -<message>Changing the global settings requires authentication</message> -<defaults> -<allow_any>no</allow_any> -<allow_active>auth_admin_keep</allow_active> -<allow_inactive>no</allow_inactive> -</defaults> -</action>
-<!-- install-debuginfos: default yes, administrator can change this --> -<action id="org.fedoraproject.abrt.install-debuginfos"> -<description>Install debuginfos</description> -<message>Installing debuginfos requires authentication</message> -<defaults> -<allow_any>yes</allow_any> -<allow_active>yes</allow_active> -<allow_inactive>yes</allow_inactive> -</defaults> -</action> -</policyconfig> diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 055d99f..cb42abe 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 a5e0776..0000000 --- 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<polkit/polkit.h> -#include<glib-object.h> -#include<sys/types.h> -#include<unistd.h>
-#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 d9e097a..0000000 --- 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<sys/types.h> -#include<unistd.h>
-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 fad9cf6..9f03d94 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;
crash-catcher@lists.fedorahosted.org