diff options
author | joshn <joshn@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2009-05-16 03:00:57 +0000 |
---|---|---|
committer | joshn <joshn@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2009-05-16 03:00:57 +0000 |
commit | ab3ba4a1778e57cd6aaba4feee6f9c534a39b52e (patch) | |
tree | ecc9ed3bf8c78f6a68011b6b36197ed979b34fed | |
parent | e4ee35cf4556f20f0be75474b3c57b14beae965d (diff) | |
download | rdiff-backup-ab3ba4a1778e57cd6aaba4feee6f9c534a39b52e.tar.gz |
Provide backwards compatibility with non-unicode version of Windows ACL file.
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@1055 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r-- | rdiff-backup/rdiff_backup/win_acls.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/rdiff-backup/rdiff_backup/win_acls.py b/rdiff-backup/rdiff_backup/win_acls.py index 603a5fe..91f17d8 100644 --- a/rdiff-backup/rdiff_backup/win_acls.py +++ b/rdiff-backup/rdiff_backup/win_acls.py @@ -28,6 +28,11 @@ except ImportError: OWNER_SECURITY_INFORMATION = 0 DACL_SECURITY_INFORMATION = 0 +def encode(str_): + if type(str_) == unicode: + return str_.encode('utf-8') + return str_ + class ACL: flags = (GROUP_SECURITY_INFORMATION| OWNER_SECURITY_INFORMATION| @@ -181,7 +186,8 @@ class ACL: def __str__(self): return '# file: %s\n%s\n' % \ - (self.get_indexpath(), unicode(self.__acl)) + (C.acl_quote(encode(self.get_indexpath())), + unicode(self.__acl)) def from_string(self, acl_str): lines = acl_str.splitlines() @@ -189,7 +195,7 @@ class ACL: raise metadata.ParsingError("Bad record beginning: " + lines[0][:8]) filename = lines[0][8:] if filename == '.': self.index = () - else: self.index = tuple(filename.split('/')) + else: self.index = tuple(unicode(C.acl_unquote(filename)).split('/')) self.__acl = lines[1] def Record2WACL(record): |