file_is_readable_by_greeter(): logic fixed
Andrew P.
9 years ago
118 | 118 | def readable(st, uid, gids): |
119 | 119 | if stat.S_ISDIR(st.st_mode) and not stat.S_IREAD: |
120 | 120 | return False |
121 | if st.st_uid == uid and bool(st.st_mode & stat.S_IRUSR): | |
122 | return True | |
123 | if st.st_gid in groups and bool(st.st_mode & stat.S_IRGRP): | |
124 | return True | |
125 | if bool(st.st_mode & stat.S_IROTH): | |
126 | return True | |
127 | return False | |
121 | if st.st_uid == uid: | |
122 | return bool(st.st_mode & stat.S_IRUSR) | |
123 | if st.st_gid in groups: | |
124 | return bool(st.st_mode & stat.S_IRGRP) | |
125 | return bool(st.st_mode & stat.S_IROTH) | |
128 | 126 | |
129 | 127 | return all(readable(os.stat(os.path.join(*parts[:i+1])), uid, groups) |
130 | 128 | for i in range(len(parts))) |