[PATCH phosphor-rest-server 4/5] Check for path component length
OpenBMC Patches
patches at stwcx.xyz
Thu Nov 5 03:39:01 AEDT 2015
From: Brad Bishop <bradleyb at us.ibm.com>
If someone makes a call against '/org' for instance
we die checking for the attr action because there is
only path one component to the URL.
---
phosphor-rest | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phosphor-rest b/phosphor-rest
index 08065ed..4c13b08 100644
--- a/phosphor-rest
+++ b/phosphor-rest
@@ -275,10 +275,10 @@ class DBusRestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if path.parts[-1] == 'enumerate':
return EnumerateHandler(self, path.fq(last = -1), data)
- if path.parts[-2] == 'attr':
+ if path.depth() > 1 and path.parts[-2] == 'attr':
return AttrHandler(self, path.fq(last = -2), data)
- if path.parts[-2] == 'action':
+ if path.depth() > 1 and path.parts[-2] == 'action':
return MethodHandler(self, path.fq(last = -2), data)
# have to do an objectmapper query at this point
--
2.6.0
More information about the openbmc
mailing list