]> git.e2factory.org Git - e2factory.git/commitdiff
bugfix: global tools: catch invalid location in command line
authorGordon Hecker <gh@emlix.com>
Thu, 11 Feb 2010 10:43:36 +0000 (11:43 +0100)
committerGordon Hecker <gh@emlix.com>
Fri, 12 Feb 2010 13:54:55 +0000 (14:54 +0100)
Signed-off-by: Gordon Hecker <gh@emlix.com>
generic/e2lib.lua

index 7aede66d109b6489cfe0613fed0a61735fd1cb47..3faeb8fdc7bbebb5c46862d6c3dddd15a8f8efed 100644 (file)
@@ -1766,15 +1766,18 @@ end
 function parse_server_location(arg, default_server)
        local sl = {}
        sl.server, sl.location = arg:match("(%S+):(%S+)")
-       if sl.server and sl.location then
-               return sl
-       end
-       sl.location = arg:match("(%S+)")
-       if sl.location and default_server then
+       if not (sl.server and sl.location) then
+               sl.location = arg:match("(%S+)")
+               if not (sl.location and default_server) then
+                       return nil, "can't parse location"
+               end
                sl.server = default_server
-               return sl
        end
-       return nil, "can't parse location"
+       if sl.location:match("[.][.]") or
+          sl.location:match("^/") then
+               return nil, "invalid location"
+       end
+       return sl
 end
 
 --- setup cache from the global server configuration