1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix python3 problem in user module cve fix

This commit is contained in:
Toshio Kuratomi 2018-10-22 18:19:53 -07:00
parent 8d00afc013
commit 9088671c4e

View file

@ -891,16 +891,16 @@ class User(object):
chunk = os.read(master_out_fd, 10240) chunk = os.read(master_out_fd, 10240)
out_buffer += chunk out_buffer += chunk
if prompt in out_buffer: if prompt in out_buffer:
os.write(master_in_fd, self.ssh_passphrase + b'\r') os.write(master_in_fd, to_bytes(self.ssh_passphrase, errors='strict') + b'\r')
prompt = second_prompt prompt = second_prompt
else: else:
chunk = os.read(master_err_fd, 10240) chunk = os.read(master_err_fd, 10240)
err_buffer += chunk err_buffer += chunk
if prompt in err_buffer: if prompt in err_buffer:
os.write(master_in_fd, self.ssh_passphrase + b'\r') os.write(master_in_fd, to_bytes(self.ssh_passphrase, errors='strict') + b'\r')
prompt = second_prompt prompt = second_prompt
if b'Overwrite (y/n)?' in out_buffer or b'Overwrite (y/n)?' in err_buffer: if b'Overwrite (y/n)?' in out_buffer or b'Overwrite (y/n)?' in err_buffer:
# This created between us checking for existence and now # The key was created between us checking for existence and now
return (None, 'Key already exists', '') return (None, 'Key already exists', '')
rc = p.returncode rc = p.returncode