|
|
@ -2501,12 +2501,15 @@ class AIX(User):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
b_name = to_bytes(self.name)
|
|
|
|
b_name = to_bytes(self.name)
|
|
|
|
|
|
|
|
b_passwd = b''
|
|
|
|
|
|
|
|
b_expires = b''
|
|
|
|
if os.path.exists(self.SHADOWFILE) and os.access(self.SHADOWFILE, os.R_OK):
|
|
|
|
if os.path.exists(self.SHADOWFILE) and os.access(self.SHADOWFILE, os.R_OK):
|
|
|
|
with open(self.SHADOWFILE, 'rb') as bf:
|
|
|
|
with open(self.SHADOWFILE, 'rb') as bf:
|
|
|
|
b_lines = bf.readlines()
|
|
|
|
b_lines = bf.readlines()
|
|
|
|
|
|
|
|
|
|
|
|
b_passwd_line = b''
|
|
|
|
b_passwd_line = b''
|
|
|
|
b_expires_line = b''
|
|
|
|
b_expires_line = b''
|
|
|
|
|
|
|
|
try:
|
|
|
|
for index, b_line in enumerate(b_lines):
|
|
|
|
for index, b_line in enumerate(b_lines):
|
|
|
|
# Get password and lastupdate lines which come after the username
|
|
|
|
# Get password and lastupdate lines which come after the username
|
|
|
|
if b_line.startswith(b'%s:' % b_name):
|
|
|
|
if b_line.startswith(b'%s:' % b_name):
|
|
|
@ -2517,13 +2520,12 @@ class AIX(User):
|
|
|
|
# Sanity check the lines because sometimes both are not present
|
|
|
|
# Sanity check the lines because sometimes both are not present
|
|
|
|
if b' = ' in b_passwd_line:
|
|
|
|
if b' = ' in b_passwd_line:
|
|
|
|
b_passwd = b_passwd_line.split(b' = ', 1)[-1].strip()
|
|
|
|
b_passwd = b_passwd_line.split(b' = ', 1)[-1].strip()
|
|
|
|
else:
|
|
|
|
|
|
|
|
b_passwd = b''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if b' = ' in b_expires_line:
|
|
|
|
if b' = ' in b_expires_line:
|
|
|
|
b_expires = b_expires_line.split(b' = ', 1)[-1].strip()
|
|
|
|
b_expires = b_expires_line.split(b' = ', 1)[-1].strip()
|
|
|
|
else:
|
|
|
|
|
|
|
|
b_expires = b''
|
|
|
|
except IndexError:
|
|
|
|
|
|
|
|
self.module.fail_json(msg='Failed to parse shadow file %s' % self.SHADOWFILE)
|
|
|
|
|
|
|
|
|
|
|
|
passwd = to_native(b_passwd)
|
|
|
|
passwd = to_native(b_passwd)
|
|
|
|
expires = to_native(b_expires) or -1
|
|
|
|
expires = to_native(b_expires) or -1
|
|
|
|