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

"Unexpected response: OK" if empty password is entred via pinentry #176

Closed
bircoph opened this issue May 2, 2021 · 1 comment
Closed
Assignees

Comments

@bircoph
Copy link

bircoph commented May 2, 2021

Hi!

During investigation of issue #175 I found that nitrocli-0.4.0 fails to recognize pinentry's response when empty password is provided and OK button is pressed (or just hit the Enter):

$  nitrocli pws get 1
Failed to parse pinentry secret

Caused by:
    Unexpected response: OK

If cancel is pressed (or Esc) response is more reasonable:

$  nitrocli pws get 1
Failed to parse pinentry secret

Caused by:
    83886179 Operation cancelled <Pinentry>

Why I need to enter empty password in the first place? Due to bug #175 the first entered password will be discarded regardless of whether it is valid or not, so to save time I tried just to skip it by pressing Enter and found another issue.

@d-e-s-o
Copy link
Owner

d-e-s-o commented May 2, 2021

Thanks for opening an issue. It's easy to reproduce.

Response when we enter something:

$ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
D hallo
OK

Response when we enter nothing:

$ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
OK

We were always under the impression that there would be a D line.

@d-e-s-o d-e-s-o self-assigned this May 2, 2021
d-e-s-o added a commit that referenced this issue May 2, 2021
As it turns out, the pinentry program responds slightly differently to a
request to enter a password/PIN when the user enters one vs. when he/she
just continues, leaving the input empty, as is illustrated here:

When the user enters 'hello':
  > $ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
  > D hello
  > OK

When the user enters nothing:
  > $ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
  > OK

So far we always expected a two line response, with the first line
containing the 'D ' prefix, which prevents us from handling empty input
properly.
This change fixes this shortcoming by adding a case for it.

Fixes #176
d-e-s-o added a commit that referenced this issue May 2, 2021
As it turns out, the pinentry program responds slightly differently to a
request to enter a password/PIN when the user enters one vs. when he/she
just continues, leaving the input empty, as is illustrated here:

When the user enters 'hello':
  > $ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
  > D hello
  > OK

When the user enters nothing:
  > $ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
  > OK

So far we always expected a two line response, with the first line
containing the 'D ' prefix, which prevents us from handling empty input
properly.
This change fixes this shortcoming by adding a case for it.

Fixes #176
@d-e-s-o d-e-s-o closed this as completed in 0153941 May 2, 2021
d-e-s-o added a commit that referenced this issue May 9, 2021
As it turns out, the pinentry program responds slightly differently to a
request to enter a password/PIN when the user enters one vs. when he/she
just continues, leaving the input empty, as is illustrated here:

When the user enters 'hello':
  > $ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
  > D hello
  > OK

When the user enters nothing:
  > $ gpg-connect-agent 'GET_PASSPHRASE --data cacheid errormsg prompt description' '/bye'
  > OK

So far we always expected a two line response, with the first line
containing the 'D ' prefix, which prevents us from handling empty input
properly.
This change fixes this shortcoming by adding a case for it.

Fixes #176
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants