mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix password lookup when password file exists and the password is not encrypted
This commit is contained in:
parent
cd2cb178ae
commit
8277747a04
1 changed files with 4 additions and 5 deletions
|
@ -135,20 +135,19 @@ class LookupModule(LookupBase):
|
|||
else:
|
||||
content = open(path).read().rstrip()
|
||||
|
||||
password = content
|
||||
salt = None
|
||||
if params['encrypt'] is not None:
|
||||
try:
|
||||
sep = content.rindex(' ')
|
||||
except ValueError:
|
||||
password = content
|
||||
salt = None
|
||||
# No salt
|
||||
pass
|
||||
else:
|
||||
salt_field = content[sep + 1:]
|
||||
if salt_field.startswith('salt='):
|
||||
password = content[:sep]
|
||||
salt = salt_field[len('salt='):]
|
||||
else:
|
||||
password = content
|
||||
salt = None
|
||||
|
||||
# crypt requested, add salt if missing
|
||||
if not salt:
|
||||
|
|
Loading…
Reference in a new issue