summaryrefslogtreecommitdiffstats
path: root/src/Daemon/MiddleWare.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-05-06 17:56:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-05-06 17:56:08 +0200
commit7b8e2407da1fc306d71baa4cb0089ca3b770eddd (patch)
tree99e947e2d0f750f6ad245e8aa1379d57f547a2ba /src/Daemon/MiddleWare.cpp
parent07e9179379f8e0c6d384a1fe10b155ce0fcf8cef (diff)
downloadabrt-7b8e2407da1fc306d71baa4cb0089ca3b770eddd.tar.gz
abrt-7b8e2407da1fc306d71baa4cb0089ca3b770eddd.tar.xz
abrt-7b8e2407da1fc306d71baa4cb0089ca3b770eddd.zip
Add BlackListedPaths option to abrt.conf. Fixes #582421
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/MiddleWare.cpp')
-rw-r--r--src/Daemon/MiddleWare.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 33052de1..436078ff 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <fnmatch.h>
+#include <algorithm>
#include "abrtlib.h"
#include "abrt_types.h"
#include "Daemon.h"
@@ -27,7 +29,6 @@
#include "ABRTException.h"
#include "CommLayerInner.h"
#include "MiddleWare.h"
-#include <algorithm>
using namespace std;
@@ -633,6 +634,21 @@ static char *get_argv1_if_full_path(const char* cmdline)
return NULL;
}
+static bool is_path_blacklisted(const char *path)
+{
+ set_string_t::iterator it = g_settings_setBlackListedPaths.begin();
+ while (it != g_settings_setBlackListedPaths.end())
+ {
+ if (fnmatch(it->c_str(), path, /*flags:*/ 0) == 0)
+ {
+ return true;
+ }
+ it++;
+ }
+ return false;
+}
+
+
/**
* Get a package name from executable name and save
* package description to particular debugdump directory of a crash.
@@ -656,6 +672,12 @@ static mw_result_t SavePackageDescriptionToDebugDump(
}
else
{
+ if (is_path_blacklisted(pExecutable))
+ {
+ log("Blacklisted executable '%s'", pExecutable);
+ return MW_BLACKLISTED;
+ }
+
char *rpm_pkg = GetPackage(pExecutable);
if (rpm_pkg == NULL)
{
@@ -718,6 +740,12 @@ static mw_result_t SavePackageDescriptionToDebugDump(
scriptName = script_name;
pExecutable = scriptName.c_str();
knownOrigin = true;
+ /* pExecutable has changed, check it again */
+ if (is_path_blacklisted(pExecutable))
+ {
+ log("Blacklisted executable '%s'", pExecutable);
+ return MW_BLACKLISTED;
+ }
}
free(script_name);
}