Commit cddf4d85 authored by Milan Broz's avatar Milan Broz

Fix luksClose if underlying device is another DM device

and commands fails with "Device 253:0 doesn't exist or access denied." error.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@225 36d66b0a-2a48-0410-832c-cd162a569da5
parent 5ec2bba8
2010-05-23 Milan Broz <mbroz@redhat.com>
* Fix luksClose operation for stacked DM devices.
2010-05-03 Milan Broz <mbroz@redhat.com>
* Fix automatic dm-crypt module loading.
* Escape hyphens in man page.
......
......@@ -171,7 +171,7 @@ static char *__lookup_dev(char *path, dev_t dev, int dir_level, const int max_le
continue;
strncpy(ptr, entry->d_name, space);
if (lstat(path, &st) < 0)
if (stat(path, &st) < 0)
continue;
if (S_ISDIR(st.st_mode)) {
......
......@@ -4,6 +4,7 @@ CRYPTSETUP=../src/cryptsetup
LOOPDEV=/dev/loop5
DEV_NAME=dummy
DEV_NAME2=dummy2
ORIG_IMG=luks-test-orig
IMG=luks-test
IMG1=luks-test1
......@@ -20,6 +21,7 @@ KEY_MATERIAL1_EXT="S69632-133632"
function remove_mapping()
{
[ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove $DEV_NAME2
[ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
losetup -d $LOOPDEV >/dev/null 2>&1
rm -f $ORIG_IMG $IMG $IMG1 $KEY1 >/dev/null 2>&1
......@@ -135,5 +137,13 @@ $CRYPTSETUP -q -i 1000 -c aes-cbc-essiv:sha256 -s 128 luksFormat $LOOPDEV $KEY1
check "$LUKS_HEADER $KEY_SLOT0 $KEY_MATERIAL0"
$CRYPTSETUP -d $KEY1 luksOpen $LOOPDEV $DEV_NAME || fail
prepare "[13] open/close - stacked devices"
echo "key0" | $CRYPTSETUP -q luksFormat $LOOPDEV || fail
echo "key0" | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
echo "key0" | $CRYPTSETUP -q luksFormat /dev/mapper/$DEV_NAME || fail
echo "key0" | $CRYPTSETUP -q luksOpen /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
$CRYPTSETUP -q luksClose $DEV_NAME2 || fail
$CRYPTSETUP -q luksClose $DEV_NAME || fail
remove_mapping
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment