Commit 403a4978 authored by bescoto's avatar bescoto

Final changes for 0.13.3


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@474 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent ed425d54
New in v0.13.3 (??????????) New in v0.13.3 (2003/10/14)
--------------------------- ---------------------------
Fixed some of the --restrict options which would cause spurious Fixed some of the --restrict options which would cause spurious
......
Figure out why files getting unnecessarily incremented when upgrading
from 0.12.x.
Consider adding --datadir option (Jean-Sébastien GOETSCHY) Consider adding --datadir option (Jean-Sébastien GOETSCHY)
See if regressing takes too much memory (large directories). See if regressing takes too much memory (large directories).
......
...@@ -579,6 +579,9 @@ def restore_set_root(rpin): ...@@ -579,6 +579,9 @@ def restore_set_root(rpin):
parent_dir = rpath.RPath(rpin.conn, "/".join(pathcomps[:i])) parent_dir = rpath.RPath(rpin.conn, "/".join(pathcomps[:i]))
if (parent_dir.isdir() and if (parent_dir.isdir() and
"rdiff-backup-data" in parent_dir.listdir()): break "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 i = i-1
else: return None else: return None
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"""Functions to make sure remote requests are kosher""" """Functions to make sure remote requests are kosher"""
import sys, tempfile import sys, tempfile
import Globals, Main, rpath import Globals, Main, rpath, log
class Violation(Exception): class Violation(Exception):
"""Exception that indicates an improper request has been received""" """Exception that indicates an improper request has been received"""
...@@ -125,6 +125,7 @@ def set_allowed_requests(sec_level): ...@@ -125,6 +125,7 @@ def set_allowed_requests(sec_level):
["C.make_file_dict", ["C.make_file_dict",
"rpath.ea_get", "rpath.ea_get",
"rpath.acl_get", "rpath.acl_get",
"rpath.setdata_local",
"log.Log.log_to_file", "log.Log.log_to_file",
"os.getuid", "os.getuid",
"os.listdir", "os.listdir",
...@@ -182,7 +183,7 @@ def vet_request(request, arglist): ...@@ -182,7 +183,7 @@ def vet_request(request, arglist):
if isinstance(arg, rpath.RPath): vet_rpath(arg) if isinstance(arg, rpath.RPath): vet_rpath(arg)
if security_level == "all": return if security_level == "all": return
if request.function_string in allowed_requests: 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: if Globals.server and arglist[0] not in disallowed_server_globals:
return return
raise Violation("\nWarning Security Violation!\n" raise Violation("\nWarning Security Violation!\n"
...@@ -204,7 +205,3 @@ def vet_rpath(rpath): ...@@ -204,7 +205,3 @@ def vet_rpath(rpath):
"Request to handle path %s\n" "Request to handle path %s\n"
"which doesn't appear to be within " "which doesn't appear to be within "
"restrict path %s.\n" % (normalized, restrict)) "restrict path %s.\n" % (normalized, restrict))
...@@ -170,10 +170,10 @@ class ExtendedAttributesFile(metadata.FlatFile): ...@@ -170,10 +170,10 @@ class ExtendedAttributesFile(metadata.FlatFile):
yield rorp yield rorp
ea_iter = cls.get_objects_at_time(rbdir, time, restrict_index) ea_iter = cls.get_objects_at_time(rbdir, time, restrict_index)
if ea_iter: return helper(rorp_iter, ea_iter) if not ea_iter:
else: log.Log("Warning: Extended attributes file not found", 2)
log.Log("Warning: Extended attributes file not found",2) ea_iter = iter([])
return rorp_iter return helper(rorp_iter, ea_iter)
static.MakeClass(ExtendedAttributesFile) static.MakeClass(ExtendedAttributesFile)
...@@ -501,10 +501,10 @@ class AccessControlListFile(metadata.FlatFile): ...@@ -501,10 +501,10 @@ class AccessControlListFile(metadata.FlatFile):
yield rorp yield rorp
acl_iter = cls.get_objects_at_time(rbdir, time, restrict_index) acl_iter = cls.get_objects_at_time(rbdir, time, restrict_index)
if acl_iter: return helper(rorp_iter, acl_iter) if not acl_iter:
else:
log.Log("Warning: Access Control List file not found", 2) 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) static.MakeClass(AccessControlListFile)
......
...@@ -296,13 +296,18 @@ class RORPath: ...@@ -296,13 +296,18 @@ class RORPath:
elif key == 'acl' and not Globals.acls_active: pass elif key == 'acl' and not Globals.acls_active: pass
elif key == 'resourcefork' and not Globals.resource_forks_active: elif key == 'resourcefork' and not Globals.resource_forks_active:
pass 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 elif (key == 'inode' and
(not self.isreg() or self.getnumlinks() == 1 or (not self.isreg() or self.getnumlinks() == 1 or
not Globals.compare_inode or not Globals.compare_inode or
not Globals.preserve_hardlinks)): pass not Globals.preserve_hardlinks)):
elif (not other.data.has_key(key) or pass
self.data[key] != other.data[key]): else:
return None try: other_val = other.data[key]
except KeyError: return None
if self.data[key] != other.data[key]: return None
return 1 return 1
def equal_loose(self, other): def equal_loose(self, other):
......
...@@ -8,7 +8,7 @@ user_group.init_group_mapping() ...@@ -8,7 +8,7 @@ user_group.init_group_mapping()
tempdir = rpath.RPath(Globals.local_connection, "testfiles/output") tempdir = rpath.RPath(Globals.local_connection, "testfiles/output")
restore_dir = rpath.RPath(Globals.local_connection, restore_dir = rpath.RPath(Globals.local_connection,
"testfiles/restore_out") "testfiles/restore_out")
log.Log.setverbosity(7) log.Log.setverbosity(3)
class EATest(unittest.TestCase): class EATest(unittest.TestCase):
"""Test extended attributes""" """Test extended attributes"""
......
...@@ -12,7 +12,7 @@ class SecurityTest(unittest.TestCase): ...@@ -12,7 +12,7 @@ class SecurityTest(unittest.TestCase):
problem. problem.
""" """
assert isinstance(exc, Security.Violation) assert isinstance(exc, Security.Violation), exc
#assert str(exc).find("Security") >= 0, "%s\n%s" % (exc, repr(exc)) #assert str(exc).find("Security") >= 0, "%s\n%s" % (exc, repr(exc))
def test_vet_request_ro(self): def test_vet_request_ro(self):
...@@ -45,10 +45,10 @@ class SecurityTest(unittest.TestCase): ...@@ -45,10 +45,10 @@ class SecurityTest(unittest.TestCase):
conn.Globals.set("TEST_var", rp) conn.Globals.set("TEST_var", rp)
assert conn.Globals.get("TEST_var").path == rp.path assert conn.Globals.get("TEST_var").path == rp.path
for rp in [RPath(conn, "foobar"), for path in ["foobar", "/usr/local", "foo/../bar"]:
RPath(conn, "/usr/local"), try:
RPath(conn, "foo/../bar")]: rp = rpath.RPath(conn, path)
try: conn.Globals.set("TEST_var", rp) conn.Globals.set("TEST_var", rp)
except Exception, e: except Exception, e:
self.assert_exc_sec(e) self.assert_exc_sec(e)
continue continue
......
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