diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-09-09 16:07:07 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-09-09 16:07:07 +0200 |
commit | 320b7eae1821cb3f92a8e19d6ea6fa70be552d29 (patch) | |
tree | f75b34f244fed4fabff8636ecaddeeb86c06df76 /src | |
parent | f6481dd5fb52b85fbb8c74ad3b3c476e7eba84fb (diff) | |
parent | 741de5ede91b74bb7bd4e8e23db96178056f5613 (diff) | |
download | abrt-320b7eae1821cb3f92a8e19d6ea6fa70be552d29.tar.gz abrt-320b7eae1821cb3f92a8e19d6ea6fa70be552d29.tar.xz abrt-320b7eae1821cb3f92a8e19d6ea6fa70be552d29.zip |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src')
-rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 6 | ||||
-rw-r--r-- | src/Daemon/PluginManager.cpp | 30 | ||||
-rw-r--r-- | src/Daemon/PluginManager.h | 16 | ||||
-rw-r--r-- | src/Daemon/org.fedoraproject.abrt.policy | 20 |
4 files changed, 70 insertions, 2 deletions
diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index 726c37af..d84a3345 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -672,7 +672,8 @@ static int handle_RegisterPlugin(DBusMessage* call, DBusMessage* reply) return -1; } - g_pPluginManager->RegisterPlugin(PluginName); + const char * sender = dbus_message_get_sender(call); + g_pPluginManager->RegisterPluginDBUS(PluginName, sender); send_flush_and_unref(reply); return 0; @@ -695,7 +696,8 @@ static int handle_UnRegisterPlugin(DBusMessage* call, DBusMessage* reply) return -1; } - g_pPluginManager->UnRegisterPlugin(PluginName); + const char * sender = dbus_message_get_sender(call); + g_pPluginManager->UnRegisterPluginDBUS(PluginName, sender); send_flush_and_unref(reply); return 0; diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index 5580cdf2..412a1868 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.cpp @@ -24,6 +24,7 @@ #include "abrtlib.h" #include "ABRTException.h" #include "CommLayerInner.h" +#include "Polkit.h" #include "PluginManager.h" /** @@ -228,6 +229,20 @@ void CPluginManager::RegisterPlugin(const std::string& pName) } } +void CPluginManager::RegisterPluginDBUS(const std::string& pName, + const char * pDBUSSender) +{ + int polkit_result = polkit_check_authorization(pDBUSSender, + "org.fedoraproject.abrt.register-plugin"); + if (polkit_result == PolkitYes) + { + RegisterPlugin(pName); + } else + { + log("user %s not authorized, returned %d", pDBUSSender, polkit_result); + } +} + void CPluginManager::UnRegisterPlugin(const std::string& pName) { map_abrt_plugins_t::iterator abrt_plugin = m_mapABRTPlugins.find(pName); @@ -244,6 +259,21 @@ void CPluginManager::UnRegisterPlugin(const std::string& pName) } } +void CPluginManager::UnRegisterPluginDBUS(const std::string& pName, + const char * pDBUSSender) +{ + int polkit_result = polkit_check_authorization(pDBUSSender, + "org.fedoraproject.abrt.unregister-plugin"); + if (polkit_result == PolkitYes) + { + UnRegisterPlugin(pName); + } else + { + log("user %s not authorized, returned %d", pDBUSSender, polkit_result); + } +} + + CAnalyzer* CPluginManager::GetAnalyzer(const std::string& pName) { map_plugins_t::iterator plugin = m_mapPlugins.find(pName); diff --git a/src/Daemon/PluginManager.h b/src/Daemon/PluginManager.h index 06d5f035..d4914db6 100644 --- a/src/Daemon/PluginManager.h +++ b/src/Daemon/PluginManager.h @@ -91,6 +91,22 @@ class CPluginManager */ void UnRegisterPlugin(const std::string& pName); /** + * A method, which registers particular plugin, + * called via DBUS + * @param pName A plugin name. + * @param pDBUSSender DBUS user identification + */ + void RegisterPluginDBUS(const std::string& 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 std::string& pName, + const char * pDBUSSender); + /** * A method, which returns instance of particular analyzer plugin. * @param pName A plugin name. * @return An analyzer plugin. diff --git a/src/Daemon/org.fedoraproject.abrt.policy b/src/Daemon/org.fedoraproject.abrt.policy index 9cf16a62..39b0ef21 100644 --- a/src/Daemon/org.fedoraproject.abrt.policy +++ b/src/Daemon/org.fedoraproject.abrt.policy @@ -23,4 +23,24 @@ Copyright (c) 2009 Red Hat inc. </defaults> </action> + <action id="org.fedoraproject.abrt.register-plugin"> + <description>Register plugin</description> + <message>Registering a plugin requires authentication</message> + <defaults> + <allow_any>auth_admin</allow_any> + <allow_active>auth_admin</allow_active> + <allow_inactive>auth_admin</allow_inactive> + </defaults> + </action> + + <action id="org.fedoraproject.abrt.unregister-plugin"> + <description>Unregister plugin</description> + <message>Unregistering a plugin requires authentication</message> + <defaults> + <allow_any>auth_admin</allow_any> + <allow_active>auth_admin</allow_active> + <allow_inactive>auth_admin</allow_inactive> + </defaults> + </action> + </policyconfig> |