From a6772460898faffd4f7fa8e08b9d063550741df3 Mon Sep 17 00:00:00 2001 From: Miloslav Trmac Date: Fri, 5 Feb 2010 17:01:26 +0000 Subject: [PATCH] - Fix a crash when an empty passphrase is provided Resolves: #558410 --- volume_key-0.3.1-empty-passphrase.patch | 56 +++++++++++++++++++++++++ volume_key.spec | 9 +++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 volume_key-0.3.1-empty-passphrase.patch diff --git a/volume_key-0.3.1-empty-passphrase.patch b/volume_key-0.3.1-empty-passphrase.patch new file mode 100644 index 0000000..3782bf8 --- /dev/null +++ b/volume_key-0.3.1-empty-passphrase.patch @@ -0,0 +1,56 @@ +commit 02ba974efaf3b12f548d83f0584917dfcfd1cb1b +Author: Miloslav Trmač +Date: Fri Feb 5 17:53:21 2010 +0100 + + Fix crash if passphrase_ui_cb () fails. + + 2010-02-05 Miloslav Trmač + + * src/volume_key.c (pos_init): Set *error if passphrase_ui_cb () fails. + +diff --git a/ChangeLog b/ChangeLog +index 72f053b..1ab28d0 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,7 @@ ++2010-02-05 Miloslav Trmač ++ ++ * src/volume_key.c (pos_init): Set *error if passphrase_ui_cb () fails. ++ + 2009-12-11 Miloslav Trmač + + * configure.ac: Release 0.3.1. +diff --git a/src/volume_key.c b/src/volume_key.c +index 361aa86..68c837a 100644 +--- a/src/volume_key.c ++++ b/src/volume_key.c +@@ -581,7 +581,7 @@ pos_init (struct packet_output_state *pos, GError **error) + : _("Passphrases do not match. " + "New packet passphrase"), failed); + if (passphrase == NULL) +- return -1; ++ goto no_passphrase; + passphrase2 = passphrase_ui_cb (NULL, + _("Repeat new packet passphrase"), + failed); +@@ -589,7 +589,7 @@ pos_init (struct packet_output_state *pos, GError **error) + { + memset (passphrase, 0, strlen (passphrase)); + g_free (passphrase); +- return -1; ++ goto no_passphrase; + } + passphrase_ok = strcmp (passphrase, passphrase2) == 0; + memset (passphrase2, 0, strlen (passphrase2)); +@@ -607,6 +607,11 @@ pos_init (struct packet_output_state *pos, GError **error) + pos->passphrase = passphrase; + } + return 0; ++ ++ no_passphrase: ++ g_set_error (error, LIBVK_ERROR, LIBVK_ERROR_UI_NO_RESPONSE, ++ _("Passphrase not provided")); ++ return -1; + } + + /* Free data in POS */ diff --git a/volume_key.spec b/volume_key.spec index c08b5d9..630d6ab 100644 --- a/volume_key.spec +++ b/volume_key.spec @@ -3,13 +3,15 @@ Summary: An utility for manipulating storage encryption keys and passphrases Name: volume_key Version: 0.3.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: Applications/System URL: https://fedorahosted.org/volume_key/ Requires: volume_key-libs = %{version}-%{release} Source0: https://fedorahosted.org/releases/v/o/volume_key/volume_key-%{version}.tar.bz2 +# Committed upstrean +Patch0: volume_key-0.3.1-empty-passphrase.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: cryptsetup-luks-devel, gettext-devel, glib2-devel, gnupg BuildRequires: gpgme-devel, libblkid-devel, nss-devel, python-devel @@ -74,6 +76,7 @@ for other formats is possible, some formats are planned for future releases. %prep %setup -q +%patch0 -p1 -b .empty-passphrase %build %configure @@ -116,6 +119,10 @@ rm -rf $RPM_BUILD_ROOT %{python_sitearch}/volume_key.py* %changelog +* Fri Feb 5 2010 Miloslav Trmač - 0.3.1-2 +- Fix a crash when an empty passphrase is provided + Resolves: #558410 + * Fri Dec 11 2009 Miloslav Trmač - 0.3.1-1 - Update to volume_key-0.3.1.