From d8cee73f6ab56d8ec6fb2b9969cefb9d9d521bb4 Mon Sep 17 00:00:00 2001 From: bescoto Date: Tue, 14 Oct 2003 07:33:12 +0000 Subject: Final changes for 0.13.3 git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@474 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 2 +- rdiff-backup/TODO | 3 --- rdiff-backup/rdiff_backup/Main.py | 3 +++ rdiff-backup/rdiff_backup/Security.py | 9 +++------ rdiff-backup/rdiff_backup/eas_acls.py | 14 +++++++------- rdiff-backup/rdiff_backup/rpath.py | 13 +++++++++---- rdiff-backup/testing/eas_aclstest.py | 2 +- rdiff-backup/testing/securitytest.py | 12 ++++++------ 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 5ad560f..22e8a91 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,4 +1,4 @@ -New in v0.13.3 (??????????) +New in v0.13.3 (2003/10/14) --------------------------- Fixed some of the --restrict options which would cause spurious diff --git a/rdiff-backup/TODO b/rdiff-backup/TODO index 9cd6ecf..0ddc302 100644 --- a/rdiff-backup/TODO +++ b/rdiff-backup/TODO @@ -1,6 +1,3 @@ -Figure out why files getting unnecessarily incremented when upgrading -from 0.12.x. - Consider adding --datadir option (Jean-Sébastien GOETSCHY) See if regressing takes too much memory (large directories). diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index dea570d..6553fdb 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -579,6 +579,9 @@ def restore_set_root(rpin): parent_dir = rpath.RPath(rpin.conn, "/".join(pathcomps[:i])) if (parent_dir.isdir() and "rdiff-backup-data" in parent_dir.listdir()): break + print "##########", parent_dir.path, Globals.restrict_path + if parent_dir.path == rpin.conn.Globals.get('restrict_path'): + return None i = i-1 else: return None diff --git a/rdiff-backup/rdiff_backup/Security.py b/rdiff-backup/rdiff_backup/Security.py index 1805703..a3cb798 100644 --- a/rdiff-backup/rdiff_backup/Security.py +++ b/rdiff-backup/rdiff_backup/Security.py @@ -20,7 +20,7 @@ """Functions to make sure remote requests are kosher""" import sys, tempfile -import Globals, Main, rpath +import Globals, Main, rpath, log class Violation(Exception): """Exception that indicates an improper request has been received""" @@ -125,6 +125,7 @@ def set_allowed_requests(sec_level): ["C.make_file_dict", "rpath.ea_get", "rpath.acl_get", + "rpath.setdata_local", "log.Log.log_to_file", "os.getuid", "os.listdir", @@ -182,7 +183,7 @@ def vet_request(request, arglist): if isinstance(arg, rpath.RPath): vet_rpath(arg) if security_level == "all": return if request.function_string in allowed_requests: return - if request.function_string == "Globals.set": + if request.function_string in ("Globals.set", "Globals.set_local"): if Globals.server and arglist[0] not in disallowed_server_globals: return raise Violation("\nWarning Security Violation!\n" @@ -204,7 +205,3 @@ def vet_rpath(rpath): "Request to handle path %s\n" "which doesn't appear to be within " "restrict path %s.\n" % (normalized, restrict)) - - - - diff --git a/rdiff-backup/rdiff_backup/eas_acls.py b/rdiff-backup/rdiff_backup/eas_acls.py index e8258ad..4cf14cc 100644 --- a/rdiff-backup/rdiff_backup/eas_acls.py +++ b/rdiff-backup/rdiff_backup/eas_acls.py @@ -170,10 +170,10 @@ class ExtendedAttributesFile(metadata.FlatFile): yield rorp ea_iter = cls.get_objects_at_time(rbdir, time, restrict_index) - if ea_iter: return helper(rorp_iter, ea_iter) - else: - log.Log("Warning: Extended attributes file not found",2) - return rorp_iter + if not ea_iter: + log.Log("Warning: Extended attributes file not found", 2) + ea_iter = iter([]) + return helper(rorp_iter, ea_iter) static.MakeClass(ExtendedAttributesFile) @@ -501,10 +501,10 @@ class AccessControlListFile(metadata.FlatFile): yield rorp acl_iter = cls.get_objects_at_time(rbdir, time, restrict_index) - if acl_iter: return helper(rorp_iter, acl_iter) - else: + if not acl_iter: log.Log("Warning: Access Control List file not found", 2) - return rorp_iter + acl_iter = iter([]) + return helper(rorp_iter, acl_iter) static.MakeClass(AccessControlListFile) diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py index b1f3d0b..6678a3d 100644 --- a/rdiff-backup/rdiff_backup/rpath.py +++ b/rdiff-backup/rdiff_backup/rpath.py @@ -296,13 +296,18 @@ class RORPath: elif key == 'acl' and not Globals.acls_active: pass elif key == 'resourcefork' and not Globals.resource_forks_active: pass + elif ((key == 'uname' or key == 'gname') and + not other.data.has_key(key)): + pass # legacy reasons - 0.12.x didn't store u/gnames elif (key == 'inode' and (not self.isreg() or self.getnumlinks() == 1 or not Globals.compare_inode or - not Globals.preserve_hardlinks)): pass - elif (not other.data.has_key(key) or - self.data[key] != other.data[key]): - return None + not Globals.preserve_hardlinks)): + pass + else: + try: other_val = other.data[key] + except KeyError: return None + if self.data[key] != other.data[key]: return None return 1 def equal_loose(self, other): diff --git a/rdiff-backup/testing/eas_aclstest.py b/rdiff-backup/testing/eas_aclstest.py index d27abe0..cc4602c 100644 --- a/rdiff-backup/testing/eas_aclstest.py +++ b/rdiff-backup/testing/eas_aclstest.py @@ -8,7 +8,7 @@ user_group.init_group_mapping() tempdir = rpath.RPath(Globals.local_connection, "testfiles/output") restore_dir = rpath.RPath(Globals.local_connection, "testfiles/restore_out") -log.Log.setverbosity(7) +log.Log.setverbosity(3) class EATest(unittest.TestCase): """Test extended attributes""" diff --git a/rdiff-backup/testing/securitytest.py b/rdiff-backup/testing/securitytest.py index 1c7bade..c9ae86b 100644 --- a/rdiff-backup/testing/securitytest.py +++ b/rdiff-backup/testing/securitytest.py @@ -12,7 +12,7 @@ class SecurityTest(unittest.TestCase): problem. """ - assert isinstance(exc, Security.Violation) + assert isinstance(exc, Security.Violation), exc #assert str(exc).find("Security") >= 0, "%s\n%s" % (exc, repr(exc)) def test_vet_request_ro(self): @@ -45,15 +45,15 @@ class SecurityTest(unittest.TestCase): conn.Globals.set("TEST_var", rp) assert conn.Globals.get("TEST_var").path == rp.path - for rp in [RPath(conn, "foobar"), - RPath(conn, "/usr/local"), - RPath(conn, "foo/../bar")]: - try: conn.Globals.set("TEST_var", rp) + for path in ["foobar", "/usr/local", "foo/../bar"]: + try: + rp = rpath.RPath(conn, path) + conn.Globals.set("TEST_var", rp) except Exception, e: self.assert_exc_sec(e) continue assert 0, "No violation raised by rp %s" % (rp,) - + SetConnections.CloseConnections() def secure_rdiff_backup(self, in_dir, out_dir, in_local, restrict_args, -- cgit v1.2.1