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

vault: piped input for ipa vault-add fails #747

Closed
wants to merge 1 commit into from

Conversation

flo-renaud
Copy link
Contributor

@flo-renaud flo-renaud commented Apr 27, 2017

An exception is raised when using echo "Secret123\n" | ipa vault-add myvault

This happens because the code is using (string).decode(sys.stdin.encoding)
and sys.stdin.encoding is None when the input is read from a pipe.
The fix is using the prompt_password method defined by Backend.textui,
which gracefully handles this issue.

https://bugzilla.redhat.com/show_bug.cgi?id=1445358

@@ -304,7 +279,8 @@ def forward(self, *args, **options):
password = password.rstrip('\n')

else:
password = get_new_password()
password = self.api.Backend.textui.prompt_password(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this LGTM meant for the whole patch or just this one-liner? If the prior, please, don't add your LGTMs to single lines, if the latter, please, do complete reviews.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM was for complete review. I tried the patch and worked for me, so add ACK and LGTM.

@Akasurde Akasurde added the ack Pull Request approved, can be merged label Apr 28, 2017
Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stlaz stlaz removed the ack Pull Request approved, can be merged label Apr 28, 2017
@stlaz
Copy link
Contributor

stlaz commented Apr 28, 2017

@Akasurde: Don't add ACK label when the PR is not OK!
@flo-renaud: You will need to specify a ticket for this PR.

An exception is raised when using echo "Secret123\n" | ipa vault-add myvault

This happens because the code is using (string).decode(sys.stdin.encoding)
and sys.stdin.encoding is None when the input is read from a pipe.
The fix is using the prompt_password method defined by Backend.textui,
which gracefully handles this issue.

https://pagure.io/freeipa/issue/6907
@flo-renaud
Copy link
Contributor Author

@stlaz
Thank you for the reminder. Commit msg updated with issue 6907

@stlaz
Copy link
Contributor

stlaz commented Apr 28, 2017

Thank you for the brief action taken. Re-adding the ACK label.

@stlaz stlaz added the ack Pull Request approved, can be merged label Apr 28, 2017
@MartinBasti
Copy link
Contributor

master:

  • d5c41ed vault: piped input for ipa vault-add fails

ipa-4-5:

  • c8ca0f8 vault: piped input for ipa vault-add fails

@MartinBasti MartinBasti added the pushed Pull Request has already been pushed label Apr 28, 2017
@flo-renaud flo-renaud deleted the bz1445358 branch May 5, 2017 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
5 participants