Commit fbf0acff authored by owsla's avatar owsla

Allow rdiff-backup to backup files which it cannot read, but can change

the permissions of.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@995 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 09b2f80f
New in v1.3.0 (????/??/??) New in v1.3.0 (????/??/??)
--------------------------- ---------------------------
Allow rdiff-backup to backup files which it cannot read, but can change
the permissions of. (Andrew Ferguson)
Take start and end times from same system so that the elapsed time printed in Take start and end times from same system so that the elapsed time printed in
the statistics is not affected by time zone. (Andrew Ferguson) the statistics is not affected by time zone. (Andrew Ferguson)
......
...@@ -110,8 +110,16 @@ class SourceStruct: ...@@ -110,8 +110,16 @@ class SourceStruct:
if dest_sig.isflaglinked(): if dest_sig.isflaglinked():
diff_rorp.flaglinked(dest_sig.get_link_flag()) diff_rorp.flaglinked(dest_sig.get_link_flag())
elif src_rp.isreg(): elif src_rp.isreg():
reset_perms = False
if (Globals.process_uid != 0 and not src_rp.readable() and
src_rp.isowner()):
reset_perms = True
src_rp.chmod(0400 | src_rp.getperms())
if dest_sig.isreg(): attach_diff(diff_rorp, src_rp, dest_sig) if dest_sig.isreg(): attach_diff(diff_rorp, src_rp, dest_sig)
else: attach_snapshot(diff_rorp, src_rp) else: attach_snapshot(diff_rorp, src_rp)
if reset_perms: src_rp.chmod(src_rp.getperms() & ~0400)
else: else:
dest_sig.close_if_necessary() dest_sig.close_if_necessary()
diff_rorp.set_attached_filetype('snapshot') diff_rorp.set_attached_filetype('snapshot')
......
...@@ -1491,6 +1491,11 @@ def setdata_local(rpath): ...@@ -1491,6 +1491,11 @@ def setdata_local(rpath):
""" """
assert rpath.conn is Globals.local_connection assert rpath.conn is Globals.local_connection
reset_perms = False
if (Globals.process_uid != 0 and not rpath.readable() and rpath.isowner()):
reset_perms = True
rpath.chmod(0400 | rpath.getperms())
rpath.data['uname'] = user_group.uid2uname(rpath.data['uid']) rpath.data['uname'] = user_group.uid2uname(rpath.data['uid'])
rpath.data['gname'] = user_group.gid2gname(rpath.data['gid']) rpath.data['gname'] = user_group.gid2gname(rpath.data['gid'])
if Globals.eas_conn: rpath.data['ea'] = ea_get(rpath) if Globals.eas_conn: rpath.data['ea'] = ea_get(rpath)
...@@ -1502,6 +1507,9 @@ def setdata_local(rpath): ...@@ -1502,6 +1507,9 @@ def setdata_local(rpath):
if Globals.carbonfile_conn and rpath.isreg(): if Globals.carbonfile_conn and rpath.isreg():
rpath.data['carbonfile'] = carbonfile_get(rpath) rpath.data['carbonfile'] = carbonfile_get(rpath)
if reset_perms: rpath.chmod(rpath.getperms() & ~0400)
def carbonfile_get(rpath): def carbonfile_get(rpath):
"""Return carbonfile value for local rpath""" """Return carbonfile value for local rpath"""
# Note, after we drop support for Mac OS X 10.0 - 10.3, it will no longer # Note, after we drop support for Mac OS X 10.0 - 10.3, it will no longer
......
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