Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winrm: (backport) Fix kerberos auth encoding for Python 3 #36465

Merged
merged 1 commit into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Ansible Changes By Release
https://github.com/ansible/ansible/pull/36124
* Fix dependency in the deb package on Ubuntu-12.04:
https://github.com/ansible/ansible/pull/36407
* Fix WinRM Python 3 encoding when getting Kerberos ticket
(https://github.com/ansible/ansible/issues/36255)


<a id="2.4.3"></a
Expand Down
5 changes: 3 additions & 2 deletions lib/ansible/plugins/connection/winrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ def _kerb_auth(self, principal, password):
display.vvvvv("calling kinit for principal %s" % principal)
p = subprocess.Popen(kinit_cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=krbenv)

# TODO: unicode/py3
stdout, stderr = p.communicate(password + b'\n')
b_password = to_bytes(password, encoding='utf-8',
errors='surrogate_or_strict')
stdout, stderr = p.communicate(b_password + b'\n')

if p.returncode != 0:
raise AnsibleConnectionFailure("Kerberos auth failure: %s" % stderr.strip())
Expand Down