test using cryptsetup version 1.5.1
simple test:
1. open a mapper against a device.
2 call crypt_init_by_name() on the mapper and the call return "0" to mean success,this is expected.
3.Unplug the device.
4.call the function again and it still return "0" to mean success,shouldnt it fail since the underlying device is no longer available?
Simple test to show this:
open a mapper against a device:
root@mtz ink]# cryptsetup luksOpen /dev/sdc6 sdc6
Enter passphrase for /dev/sdc6:
run the "test" program on the mapper and results are below( source code below )
[root@mtz ink]# ./test /dev/mapper/sdc6
pass1
pass2
unplugged the device and rerun the test again and the results are below.
[root@mtz ink]# ./test /dev/mapper/sdc6
pass1
fail2
[root@mtz ink]#
source code of the test program:
#include<libcryptsetup.h>
int main( int argc,char * argv[] )
{
const char * path = argv[ 1 ] ;
struct crypt_device * cd;
if( crypt_init_by_name( &cd,path ) < 0 ){
puts( "fail1" ) ;
crypt_free( cd ) ;
return 1 ;
}else{
puts( "pass1" ) ;
}
const char * e = crypt_get_device_name( cd ) ;
if( e ){
puts( "pass2" ) ;
}else{
puts( "fail2" ) ;
}
crypt_free( cd ) ;
return 0 ;
}
_______________________________________________ dm-crypt mailing list dm-crypt@xxxxxxxx http://www.saout.de/mailman/listinfo/dm-crypt