fix interface and path patterns to match D-Bus specification
The old regex checks did not account for all the requirements,
namely empty paths and two-part names.
Tested: This rejects poorly-named interfaces and paths as expected.
Tested interfaces:
""
"xyz.openbmc_project.some-interface"
"xyz.openbmc_project.some/interface"
"bob"
Tested paths:
""
"/xyz/openbmc_project/some-interface"
"/xyz/openbmc_project/some.interface"
"xyz/openbmc_project/some/interface"
"bob"
Change-Id: I3d8979c9eb19680c66a5031efd334a574f8f7be3
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index 1e344b1..b7e161e 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -28,8 +28,8 @@
{
constexpr const char* PropertyNamePattern = "[a-zA-Z0-9_]+";
-constexpr const char* PathPattern = "[a-zA-Z0-9_/]+";
-constexpr const char* InterfaceNamePattern = "[a-zA-Z0-9_\\.]*";
+constexpr const char* PathPattern = "(/[a-zA-Z0-9_]+)+";
+constexpr const char* InterfaceNamePattern = "[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)+";
class callback
{