summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Daemon/PluginManager.cpp30
-rw-r--r--src/Daemon/PluginManager.h16
-rw-r--r--src/Daemon/org.fedoraproject.abrt.policy20
3 files changed, 66 insertions, 0 deletions
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>