fix home dir searching

This commit is contained in:
Martinez 2015-12-26 16:23:30 +01:00
parent d5d5376e47
commit 83c5127414

View file

@ -206,11 +206,15 @@ class LoginPart(Part):
self.fragments.append(style_reset()) self.fragments.append(style_reset())
def list_homes(): def list_homes():
already_listed = set()
with open("/etc/passwd") as f: with open("/etc/passwd") as f:
for line in f: for line in f:
tokens = line.split(":") tokens = line.split(":")
if tokens[5] != "/dev/null": if tokens[5] != "/dev/null":
if tokens[5] not in already_listed:
already_listed.add(tokens[5])
yield (tokens[5], tokens[0]) yield (tokens[5], tokens[0])
class Dir: class Dir: