]> arthur.barton.de Git - bup.git/commitdiff
save-cmd.py: disallow backup set names containing "/".
authorRob Browning <rlb@defaultvalue.org>
Mon, 27 Jan 2014 20:51:47 +0000 (14:51 -0600)
committerRob Browning <rlb@defaultvalue.org>
Mon, 27 Jan 2014 21:03:40 +0000 (15:03 -0600)
There's no way to refer to them via the VFS, because the VFS (as
expected) treats all forward slashes as path separators.

Before this change, it was possible to create backup sets with names
like "x/y/z" that were inaccessible via ls, restore, etc.

Thanks to Laura Morrissey <laura.morrissey@gmail.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/save-cmd.py

index 5031edb690801e229dbfe9808a36c442f4a0c73e..bb683f5c704491dc4ae2bb027da187a4362b0823 100755 (executable)
@@ -67,8 +67,11 @@ is_reverse = os.environ.get('BUP_SERVER_REVERSE')
 if is_reverse and opt.remote:
     o.fatal("don't use -r in reverse mode; it's automatic")
 
-if opt.name and opt.name.startswith('.'):
-    o.fatal("'%s' is not a valid branch name" % opt.name)
+if opt.name:
+    if opt.name.startswith('.'):
+        o.fatal('backup set names cannot start with "."')
+    if '/' in opt.name:
+        o.fatal('backup set names cannot contain "/"')
 refname = opt.name and 'refs/heads/%s' % opt.name or None
 if opt.remote or is_reverse:
     cli = client.Client(opt.remote)