Skip to content
Snippets Groups Projects
Commit 36e348b6 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix a bug in get_passworded_users

parent 2a79684d
No related branches found
Tags 0.7.2
No related merge requests found
......@@ -19,14 +19,14 @@ class Unix(OSBase):
users = []
regexp = re.compile('(\S+):((?:!\S+)|(?:[^!*]\S+)|):(?:\S*:){6}')
for line in open('/etc/shadow', 'r').readlines():
for line in self.g.cat('/etc/shadow').splitlines():
match = regexp.match(line)
if not match:
continue
user, passwd = match.groups()
if len(passwd) > 0 and passwd[0] == '!':
print "Warning: %s is locked" % user
print "Warning: Ignoring locked %s account." % user
else:
users.append(user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment