Commit 4bf2ff49 authored by bescoto's avatar bescoto

Fix bug in --restrict path normalization


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@515 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent ad1505c5
......@@ -48,6 +48,10 @@ def parse_cmdlineoptions(arglist):
try: return open(filename, "r")
except IOError: Log.FatalError("Error opening file %s" % filename)
def normalize_path(path):
"""Used below to normalize the security paths before setting"""
return rpath.RPath(Globals.local_connection, path).normalize().path
try: optlist, args = getopt.getopt(arglist, "blr:sv:V",
["backup-mode", "calculate-average", "check-destination-dir",
"compare", "compare-at-time=", "current-time=", "exclude=",
......@@ -138,13 +142,13 @@ def parse_cmdlineoptions(arglist):
action = "remove-older-than"
elif opt == "--no-resource-forks":
Globals.set('resource_forks_active', 0)
elif opt == "--restrict": Globals.restrict_path = arg
elif opt == "--restrict": Globals.restrict_path = normalize_path(arg)
elif opt == "--restrict-read-only":
Globals.security_level = "read-only"
Globals.restrict_path = arg
Globals.restrict_path = normalize_path(arg)
elif opt == "--restrict-update-only":
Globals.security_level = "update-only"
Globals.restrict_path = arg
Globals.restrict_path = normalize_path(arg)
elif opt == "-s" or opt == "--server":
action = "server"
Globals.server = 1
......
......@@ -86,9 +86,10 @@ class SecurityTest(unittest.TestCase):
'testfiles/output', 1,
'--restrict testfiles/output',
current_time = 10000)
# Note the backslash below -- test for bug in path normalization
self.secure_rdiff_backup('testfiles/various_file_types',
'testfiles/output', 1,
'--restrict testfiles/output')
'--restrict testfiles/output/')
Myrm("testfiles/restore_out")
self.secure_rdiff_backup('testfiles/output',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment