Codebase list lightdm-gtk-greeter-settings / afd914a
file_is_readable_by_greeter(): logic fixed Andrew P. 9 years ago
1 changed file(s) with 5 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
118118 def readable(st, uid, gids):
119119 if stat.S_ISDIR(st.st_mode) and not stat.S_IREAD:
120120 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)
128126
129127 return all(readable(os.stat(os.path.join(*parts[:i+1])), uid, groups)
130128 for i in range(len(parts)))