Commit fe8a7d82 authored by bescoto's avatar bescoto

Tweaks to get around spurious security exception


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@649 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 62064cf7
...@@ -3,7 +3,7 @@ import os, sys, code ...@@ -3,7 +3,7 @@ import os, sys, code
from rdiff_backup.log import Log from rdiff_backup.log import Log
from rdiff_backup.rpath import RPath from rdiff_backup.rpath import RPath
from rdiff_backup import Globals, Hardlink, SetConnections, Main, \ from rdiff_backup import Globals, Hardlink, SetConnections, Main, \
selection, lazy, Time, rpath, eas_acls, rorpiter selection, lazy, Time, rpath, eas_acls, rorpiter, Security
RBBin = "../rdiff-backup" RBBin = "../rdiff-backup"
SourceDir = "../rdiff_backup" SourceDir = "../rdiff_backup"
...@@ -72,15 +72,6 @@ def rdiff_backup(source_local, dest_local, src_dir, dest_dir, ...@@ -72,15 +72,6 @@ def rdiff_backup(source_local, dest_local, src_dir, dest_dir,
print "Executing: ", cmdline print "Executing: ", cmdline
assert not os.system(cmdline) assert not os.system(cmdline)
def cmd_schemas2rps(schema_list, remote_schema):
"""Input list of file descriptions and the remote schema, return rps
File descriptions should be strings of the form 'hostname.net::foo'
"""
return map(SetConnections.cmdpair2rp,
SetConnections.get_cmd_pairs(schema_list, remote_schema))
def InternalBackup(source_local, dest_local, src_dir, dest_dir, def InternalBackup(source_local, dest_local, src_dir, dest_dir,
current_time = None, eas = None, acls = None): current_time = None, eas = None, acls = None):
"""Backup src to dest internally """Backup src to dest internally
...@@ -103,7 +94,9 @@ def InternalBackup(source_local, dest_local, src_dir, dest_dir, ...@@ -103,7 +94,9 @@ def InternalBackup(source_local, dest_local, src_dir, dest_dir,
dest_dir = "cd test2/tmp; python ../../server.py ../../%s::../../%s" \ dest_dir = "cd test2/tmp; python ../../server.py ../../%s::../../%s" \
% (SourceDir, dest_dir) % (SourceDir, dest_dir)
rpin, rpout = cmd_schemas2rps([src_dir, dest_dir], remote_schema) cmdpairs = SetConnections.get_cmd_pairs([src_dir, dest_dir], remote_schema)
Security.initialize("backup", cmdpairs)
rpin, rpout = map(SetConnections.cmdpair2rp, cmdpairs)
for attr in ('eas_active', 'eas_write', 'eas_conn'): for attr in ('eas_active', 'eas_write', 'eas_conn'):
SetConnections.UpdateGlobal(attr, eas) SetConnections.UpdateGlobal(attr, eas)
for attr in ('acls_active', 'acls_write', 'acls_conn'): for attr in ('acls_active', 'acls_write', 'acls_conn'):
...@@ -151,7 +144,10 @@ def InternalRestore(mirror_local, dest_local, mirror_dir, dest_dir, time, ...@@ -151,7 +144,10 @@ def InternalRestore(mirror_local, dest_local, mirror_dir, dest_dir, time,
dest_dir = "cd test2/tmp; python ../../server.py ../../%s::../../%s" \ dest_dir = "cd test2/tmp; python ../../server.py ../../%s::../../%s" \
% (SourceDir, dest_dir) % (SourceDir, dest_dir)
mirror_rp, dest_rp = cmd_schemas2rps([mirror_dir, dest_dir], remote_schema) cmdpairs = SetConnections.get_cmd_pairs([mirror_dir, dest_dir],
remote_schema)
Security.initialize("restore", cmdpairs)
mirror_rp, dest_rp = map(SetConnections.cmdpair2rp, cmdpairs)
for attr in ('eas_active', 'eas_write', 'eas_conn'): for attr in ('eas_active', 'eas_write', 'eas_conn'):
SetConnections.UpdateGlobal(attr, eas) SetConnections.UpdateGlobal(attr, eas)
for attr in ('acls_active', 'acls_write', 'acls_conn'): for attr in ('acls_active', 'acls_write', 'acls_conn'):
......
...@@ -88,6 +88,7 @@ class PathSetter(unittest.TestCase): ...@@ -88,6 +88,7 @@ class PathSetter(unittest.TestCase):
self.dest_prefix, self.dest_conn = \ self.dest_prefix, self.dest_conn = \
self.get_prefix_and_conn(dest_path, dest_return) self.get_prefix_and_conn(dest_path, dest_return)
SetConnections.BackupInitConnections(self.src_conn, self.dest_conn) SetConnections.BackupInitConnections(self.src_conn, self.dest_conn)
Globals.restrict_path = "/" # we aren't testing security here
assert not os.system("rm -rf testfiles/output* " assert not os.system("rm -rf testfiles/output* "
"testfiles/restoretarget* " "testfiles/restoretarget* "
......
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