Allow no protection in pinentry-mode=loopback.

When the inquired passphrase has a 0 length then treat it as no
protection.
This commit is contained in:
Ben Kibbey 2011-09-12 20:13:19 -04:00 committed by Werner Koch
parent eb5709f554
commit 0dcf517700
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2011-09-12 Ben Kibbey <bjk@luxsci.net>
* genkey.c (agent_ask_new_passphrase): Allow for an empty passphrase
(no protection) in PINENTRY_MODE_LOOPBACK.
2011-09-10 Ben Kibbey <bjk@luxsci.net>
* agent.h (pinentry_loopback): New prototype.

View File

@ -313,8 +313,13 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
err = pinentry_loopback(ctrl, "NEW_PASSPHRASE", &buffer, &size, len);
if (!err)
{
buffer[size] = 0;
*r_passphrase = buffer;
if (size)
{
buffer[size] = 0;
*r_passphrase = buffer;
}
else
*r_passphrase = NULL;
}
return err;
}