You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

149 lines
6.0 KiB

diff -rupN cryptsetup-2.0.3.old/src/Makemodule.am cryptsetup-2.0.3.new/src/Makemodule.am
--- cryptsetup-2.0.3.old/src/Makemodule.am 2019-08-27 17:37:25.043999695 +0200
+++ cryptsetup-2.0.3.new/src/Makemodule.am 2019-08-27 17:39:40.303336254 +0200
@@ -6,6 +6,7 @@ cryptsetup_SOURCES = \
lib/utils_loop.c \
lib/utils_io.c \
src/utils_tools.c \
+ lib/utils_loop.c \
src/utils_password.c \
src/cryptsetup.c \
src/cryptsetup.h
diff -rupN cryptsetup-2.0.3.old/src/utils_password.c cryptsetup-2.0.3.new/src/utils_password.c
--- cryptsetup-2.0.3.old/src/utils_password.c 2019-08-27 17:37:25.043999695 +0200
+++ cryptsetup-2.0.3.new/src/utils_password.c 2019-08-27 17:38:35.354214280 +0200
@@ -256,7 +256,7 @@ int tools_get_key(const char *prompt,
int timeout, int verify, int pwquality,
struct crypt_device *cd)
{
- char tmp[1024];
+ char tmp[1024], *backing_file;
int r = -EINVAL, block;
block = tools_signals_blocked();
@@ -270,9 +270,11 @@ int tools_get_key(const char *prompt,
} else {
if (!prompt && !crypt_get_device_name(cd))
snprintf(tmp, sizeof(tmp), _("Enter passphrase: "));
- else if (!prompt)
- snprintf(tmp, sizeof(tmp), _("Enter passphrase for %s: "),
- crypt_get_device_name(cd));
+ else if (!prompt) {
+ backing_file = crypt_loop_backing_file(crypt_get_device_name(cd));
+ snprintf(tmp, sizeof(tmp), _("Enter passphrase for %s: "), backing_file ?: crypt_get_device_name(cd));
+ free(backing_file);
+ }
r = crypt_get_key_tty(prompt ?: tmp, key, key_size, timeout, verify, cd);
}
} else {
diff -rupN cryptsetup-2.0.3.old/tests/compat-test cryptsetup-2.0.3.new/tests/compat-test
--- cryptsetup-2.0.3.old/tests/compat-test 2019-08-27 17:37:24.942997950 +0200
+++ cryptsetup-2.0.3.new/tests/compat-test 2019-08-27 17:41:15.868988979 +0200
@@ -735,15 +735,20 @@ fi
which expect >/dev/null 2>&1 || skip "WARNING: expect tool missing, interactive test will be skipped." 0
prepare "[32] Interactive password retry from terminal." new
+if [ "$(pwd)" = "/" ]; then
+ EXPECT_DEV=/$IMG
+else
+ EXPECT_DEV=$(pwd)/$IMG
+fi
expect - >/dev/null <<EOF
proc abort {} { send_error "Timeout. "; exit 2 }
set timeout 10
eval spawn $CRYPTSETUP luksOpen -v -T 2 $LOOPDEV $DEV_NAME
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0 x\n"
expect timeout abort "No key available with this passphrase."
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0\n"
expect timeout abort "Key slot 0 unlocked."
@@ -760,11 +765,11 @@ expect - >/dev/null <<EOF
proc abort {} { send_error "Timeout. "; exit 2 }
set timeout 10
eval spawn $CRYPTSETUP luksOpen -v -T 2 $LOOPDEV $DEV_NAME
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0 x\n"
expect timeout abort "No key available with this passphrase."
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0 y\n"
expect timeout abort "No key available with this passphrase."
@@ -799,7 +804,7 @@ set timeout 10
eval spawn $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT -v $LOOPDEV
expect timeout abort "Are you sure? (Type uppercase yes):"
send "YES\n"
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0\n"
expect timeout abort "Verify passphrase:"
@@ -808,7 +813,7 @@ send "$PWD0\n"
expect timeout abort "Command successful."
expect timeout abort eof
eval spawn $CRYPTSETUP luksOpen -v $LOOPDEV --test-passphrase
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0\n"
expect timeout abort "Command successful."
@@ -829,7 +834,7 @@ expect timeout abort eof
eval spawn $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT -v $LOOPDEV
expect timeout abort "Are you sure? (Type uppercase yes):"
send "YES\n"
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0\n"
expect timeout abort "Verify passphrase:"
@@ -838,7 +843,7 @@ send "$PWD0 x\n"
expect timeout abort "Passphrases do not match."
expect timeout abort eof
eval spawn $CRYPTSETUP luksOpen -v $LOOPDEV -T 1 --test-passphrase
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0\n"
expect timeout abort "No key available with this passphrase."
@@ -890,7 +895,7 @@ send "$PWD1\n"
expect timeout abort "Command successful."
expect timeout abort eof
eval spawn $CRYPTSETUP luksOpen -v $LOOPDEV --test-passphrase
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD1\n"
expect timeout abort "Command successful."
@@ -908,21 +913,21 @@ eval spawn $CRYPTSETUP luksSuspend -v $D
expect timeout abort "Command successful."
expect timeout abort eof
eval spawn $CRYPTSETUP luksResume -v -T 3 $DEV_NAME
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0 x\n"
expect timeout abort "No key available with this passphrase."
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD1\n"
expect timeout abort "No key available with this passphrase."
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0 y\n"
expect timeout abort "No key available with this passphrase."
expect timeout abort eof
eval spawn $CRYPTSETUP luksResume -v $DEV_NAME
-expect timeout abort "Enter passphrase for $LOOPDEV:"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
sleep 0.1
send "$PWD0\n"
expect timeout abort "Command successful."