summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2004-01-31 21:04:32 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2004-01-31 21:04:32 +0000
commit0958a91ccf875897146d77b4bdcf8b51bb59bf70 (patch)
treeafd4bee5d5518db0068f9755a5db268be67c304a
parent09eb29b0b50deef8bba24dcb0b534b59e24724fb (diff)
downloadrdiff-backup-0958a91ccf875897146d77b4bdcf8b51bb59bf70.tar.gz
Fix bug in --restrict path normalization
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@515 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/Main.py10
-rw-r--r--rdiff-backup/testing/securitytest.py3
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',