]> arthur.barton.de Git - bup.git/commitdiff
restore-cmd.py: make sure restore paths have at least two components.
authorRob Browning <rlb@defaultvalue.org>
Sat, 16 Mar 2013 21:50:18 +0000 (16:50 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 18 Mar 2013 01:26:09 +0000 (20:26 -0500)
Reported-by: Tim Riemenschneider <t.riemenschneider@detco.de>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/restore-cmd.py

index 43209b3a3112d563e35c6c7440bac2076306c5ba..750b82f0d8ff2242ec88ef4b53befe6416d9b061 100755 (executable)
@@ -31,6 +31,14 @@ def plog(s):
     qprogress(s)
 
 
+def valid_restore_path(path):
+    path = os.path.normpath(path)
+    if path.startswith('/'):
+        path = path[1:]
+    if '/' in path:
+        return True
+
+
 def print_info(n, fullname):
     if stat.S_ISDIR(n.mode):
         verbose1('%s/' % fullname)
@@ -231,6 +239,9 @@ if opt.outdir:
 
 ret = 0
 for d in extra:
+    if not valid_restore_path(d):
+        add_error("ERROR: path %r doesn't include a branch and revision" % d)
+        continue
     path,name = os.path.split(d)
     try:
         n = top.lresolve(d)