summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-03-26 01:06:56 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-03-26 01:06:56 +0000
commit5af17eb48fe948f93aa318224b82b4968a957ce1 (patch)
tree11f724916791903c081f706eb061e2409d3cbad4
parent9194e5c1efb9e8981bcaceca2910b4d8cfa50fce (diff)
downloadrdiff-backup-5af17eb48fe948f93aa318224b82b4968a957ce1.tar.gz
Dean Gaudet's patch fixes "--restrict /" option.
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@562 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG6
-rw-r--r--rdiff-backup/rdiff_backup/Security.py1
-rw-r--r--rdiff-backup/testing/securitytest.py10
3 files changed, 17 insertions, 0 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index fe3dbb7..23bfd24 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -1,3 +1,9 @@
+New in v0.12.8 (2005/??/??)
+---------------------------
+
+Dean Gaudet's patch fixes "--restrict /" option.
+
+
New in v0.12.7 (2004/05/31)
---------------------------
diff --git a/rdiff-backup/rdiff_backup/Security.py b/rdiff-backup/rdiff_backup/Security.py
index cff19c9..d95bee6 100644
--- a/rdiff-backup/rdiff_backup/Security.py
+++ b/rdiff-backup/rdiff_backup/Security.py
@@ -187,6 +187,7 @@ def vet_rpath(rpath):
"""Require rpath not to step outside retricted directory"""
if Globals.restrict_path and rpath.conn is Globals.local_connection:
normalized, restrict = rpath.normalize().path, Globals.restrict_path
+ if restrict == "/": return
components = normalized.split("/")
# 3 cases for restricted dir /usr/foo: /var, /usr/foobar, /usr/foo/..
if (not normalized.startswith(restrict) or
diff --git a/rdiff-backup/testing/securitytest.py b/rdiff-backup/testing/securitytest.py
index e47afa0..db1d59a 100644
--- a/rdiff-backup/testing/securitytest.py
+++ b/rdiff-backup/testing/securitytest.py
@@ -56,6 +56,16 @@ class SecurityTest(unittest.TestCase):
SetConnections.CloseConnections()
+ def test_vet_rpath_root(self):
+ """Test vetting when restricted to root"""
+ remote_cmd = "../rdiff-backup --server --restrict-update-only /"
+ conn = SetConnections.init_connection(remote_cmd)
+ for rp in [RPath(Globals.local_connection, "blahblah"),
+ RPath(conn, "foo/bar")]:
+ conn.Globals.set("TEST_var", rp)
+ assert conn.Globals.get("TEST_var").path == rp.path
+ SetConnections.CloseConnections()
+
def secure_rdiff_backup(self, in_dir, out_dir, in_local, restrict_args,
extra_args = "", success = 1, current_time = None):
"""Run rdiff-backup locally, with given restrict settings"""