volume_key/volume_key-0.3.4-passphrase-ui.patch
Miloslav Trmač 4886de908b Two UI improvements
* Mon Oct 18 2010 Miloslav Trmač <mitr@redhat.com> - 0.3.4-4
- Tell the user if asking for the same passphrase again
  Resolves: #641111
- Check certificate file before interacting with the user
  Resolves: #643897
2010-10-18 17:45:07 +02:00

60 lines
2.2 KiB
Diff

Subject: [PATCH 1/2] Tell the user when a non-NSS passphrase is incorrect.
2010-10-18 Miloslav Trmač <mitr@redhat.com>
* src/volume_key.c (passphrase_ui_cb): Tell the user when a non-NSS
passphrase is incorrect.
diff --git a/src/volume_key.c b/src/volume_key.c
index 7f9f391..c9c4bca 100644
--- a/src/volume_key.c
+++ b/src/volume_key.c
@@ -545,6 +545,8 @@ passphrase_ui_cb (void *data, const char *prompt, unsigned failed_attempts)
return NULL;
return read_batch_string ();
}
+ if (failed_attempts != 0)
+ fprintf (stderr, _("Error, try again.\n"));
s = g_strdup_printf (_("%s: "), prompt);
res = get_password (s);
g_free (s);
--
2010-10-18 Miloslav Trmač <mitr@redhat.com>
* lib/volume_luks.c (luks_apply_secret)
* src/volume_key.c (pos_interact): Only tell the user about an incorrect
passphrase once.
diff --git a/lib/volume_luks.c b/lib/volume_luks.c
index 4561a43..4650464 100644
--- a/lib/volume_luks.c
+++ b/lib/volume_luks.c
@@ -481,7 +481,9 @@ luks_apply_secret (struct libvk_volume *vol, const struct libvk_volume *packet,
failed, error);
if (passphrase == NULL)
goto err_prompts;
- passphrase2 = ui_get_passphrase (ui, prompt2, failed, error);
+ /* The repeated passphrase is always considered a first attempt -
+ otherwise src/volume_key.c would prepend "Error, try again". */
+ passphrase2 = ui_get_passphrase (ui, prompt2, 0, error);
if (passphrase2 == NULL)
goto err_passphrase;
passphrase_ok = strcmp (passphrase, passphrase2) == 0;
diff --git a/src/volume_key.c b/src/volume_key.c
index c9c4bca..855956f 100644
--- a/src/volume_key.c
+++ b/src/volume_key.c
@@ -652,9 +652,10 @@ pos_init (struct packet_output_state *pos, GError **error)
"New packet passphrase"), failed);
if (passphrase == NULL)
goto no_passphrase;
+ /* The repeated passphrase is always considered a first attempt -
+ otherwise passphrase_ui_cb would prepend "Error, try again". */
passphrase2 = passphrase_ui_cb (NULL,
- _("Repeat new packet passphrase"),
- failed);
+ _("Repeat new packet passphrase"), 0);
if (passphrase2 == NULL)
{
memset (passphrase, 0, strlen (passphrase));
--