diff options
Diffstat (limited to 'rdiff-backup')
-rw-r--r-- | rdiff-backup/rdiff_backup/Main.py | 10 | ||||
-rw-r--r-- | rdiff-backup/testing/securitytest.py | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index b25f1ad..4122d17 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -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 diff --git a/rdiff-backup/testing/securitytest.py b/rdiff-backup/testing/securitytest.py index c9ae86b..e816b97 100644 --- a/rdiff-backup/testing/securitytest.py +++ b/rdiff-backup/testing/securitytest.py @@ -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', |