Commit 661f82f2 authored by bescoto's avatar bescoto

Fix for when 64 bit uids read from FS, but only 16 bit ones supported


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@582 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent c46abe40
New in v0.13.7 (????/??/??)
---------------------------
Handle cases of junk uid/gids better on 64bit systems. (Bug report by
Nick Bailey)
New in v0.13.6 (2005/04/07)
---------------------------
......
......@@ -47,7 +47,7 @@ def uid2uname(uid):
try: return uid2uname_dict[uid]
except KeyError:
try: uname = pwd.getpwuid(uid)[0]
except KeyError: uname = None
except (KeyError, OverflowError), e: uname = None
uid2uname_dict[uid] = uname
return uname
......@@ -56,7 +56,7 @@ def gid2gname(gid):
try: return gid2gname_dict[gid]
except KeyError:
try: gname = grp.getgrgid(gid)[0]
except KeyError: gname = None
except (KeyError, OverflowError), e: gname = None
gid2gname_dict[gid] = gname
return gname
......
......@@ -49,7 +49,12 @@ sync:0"""
assert user_group.UserMap.get_id(123, 'daemon') == daemonid
if 0: code.InteractiveConsole(globals()).interact()
def test_overflow(self):
"""Make sure querying large uids/gids doesn't raise exception"""
large_num = 4000000000
assert user_group.uid2uname(large_num) is None
assert user_group.gid2gname(large_num) is None
if __name__ == "__main__": unittest.main()
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