From: Aleksy Barcz Date: Wed, 21 Mar 2018 15:24:57 +0000 (+0100) Subject: fixed loading incorrect files as configuration X-Git-Tag: accepted/tizen/unified/20180619.142100~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F173459%2F4;p=platform%2Fcore%2Fsystem%2Flibdbuspolicy.git fixed loading incorrect files as configuration Bugfix. libdbuspolicy should load only files with names ending with ".conf", as dbus-daemon does. Added an incorrect configuration file as regression test. Change-Id: I868c04d6475101abfe2ffcd551b8eb9ce9bf4305 --- diff --git a/src/internal/xml_parser.hpp b/src/internal/xml_parser.hpp index 6eea72b..82480f3 100755 --- a/src/internal/xml_parser.hpp +++ b/src/internal/xml_parser.hpp @@ -22,6 +22,7 @@ #define _XML_PARSER_HPP #include +#include #include #include #include @@ -100,7 +101,7 @@ namespace ldp_xml_parser if ((dir = opendir(dname.c_str())) != NULL) { while ((ent = readdir(dir)) != NULL) { std::string s(ent->d_name); - if (s.find(".conf") != std::string::npos) { + if (boost::algorithm::ends_with(s, ".conf")) { files.push_back(dname + std::string("/") + s); } } diff --git a/tests/default_deny/system.d/error.conf.a b/tests/default_deny/system.d/error.conf.a new file mode 100644 index 0000000..a76952c --- /dev/null +++ b/tests/default_deny/system.d/error.conf.a @@ -0,0 +1,9 @@ + + + + + + +