Package: pmount
Version: 0.9.4-1
Severity: normal
Tags: experimental patch
Hi,
I have a problem with pmount and an encrypted dvd. It is a "feature" of
cryptsetup that cryptsetup luksOpen does not work with read-only devices
without the --readonly option.
The attached patch workarounds this problem by calling cryptsetup with
--readonly if pmount is called with -r.
Thanks for adding luks support to pmount. I hope it will make it to
unstable soon.
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages pmount depends on:
ii libc6 2.3.5-5 GNU C Library: Shared
libraries an
ii libdbus-1-1 0.36.1-1 simple interprocess
messaging syst
ii libhal1 0.5.4-1 Hardware Abstraction Layer
- share
ii libsysfs1 1.3.0-2 interface library to sysfs
pmount recommends no packages.
-- debconf-show failed
diff -Nur pmount-0.9.4/luks.c pmount-0.9.4-patch/luks.c
--- pmount-0.9.4/luks.c 2005-07-29 13:08:34.000000000 +0200
+++ pmount-0.9.4-patch/luks.c 2005-09-02 10:28:38.000000000 +0200
@@ -17,12 +17,13 @@
enum decrypt_status
luks_decrypt( const char* device, char* decrypted, int decrypted_size,
- const char* password_file )
+ const char* password_file, int readonly )
{
int status;
char* label;
enum decrypt_status result;
struct stat st;
+ char* readonly_param;
/* check if encrypted */
status = spawn( SPAWN_EROOT|SPAWN_NO_STDOUT|SPAWN_NO_STDERR,
@@ -42,13 +43,15 @@
return DECRYPT_EXISTS;
/* open LUKS device */
+ readonly_param = readonly == 1 ? "--readonly" : "";
if( password_file )
status = spawn( SPAWN_EROOT|SPAWN_NO_STDOUT|SPAWN_NO_STDERR,
CRYPTSETUP, CRYPTSETUP, "luksOpen", "--key-file",
- password_file, device, label, NULL );
+ password_file, readonly_param, device, label, NULL );
else
status = spawn( SPAWN_EROOT|SPAWN_NO_STDOUT|SPAWN_NO_STDERR,
- CRYPTSETUP, CRYPTSETUP, "luksOpen", device, label, NULL );
+ CRYPTSETUP, CRYPTSETUP, readonly_param, "luksOpen",
+ device, label, NULL );
if( status == 0 )
/* yes, we have a LUKS device */
diff -Nur pmount-0.9.4/luks.h pmount-0.9.4-patch/luks.h
--- pmount-0.9.4/luks.h 2005-07-29 13:08:34.000000000 +0200
+++ pmount-0.9.4-patch/luks.h 2005-09-02 10:32:35.000000000 +0200
@@ -24,9 +24,10 @@
* this will be set to device
* @param decrypted_size size of the "decrypted" buffer
* @param password_file file to read the password from (NULL means prompt)
+ * @param readonly 1 if device is read-only
*/
enum decrypt_status luks_decrypt( const char* device, char* decrypted,
- int decrypted_size, const char* password_file );
+ int decrypted_size, const char* password_file, int readonly );
/**
* Check whether device is mapped through cryptsetup, and release it if so.
diff -Nur pmount-0.9.4/pmount.c pmount-0.9.4-patch/pmount.c
--- pmount-0.9.4/pmount.c 2005-07-29 13:08:34.000000000 +0200
+++ pmount-0.9.4-patch/pmount.c 2005-09-02 10:30:13.000000000 +0200
@@ -644,7 +644,8 @@
/* check for encrypted device */
enum decrypt_status decrypt = luks_decrypt( device,
- decrypted_device, sizeof( decrypted_device ), passphrase );
+ decrypted_device, sizeof( decrypted_device ), passphrase,
+ force_write == 0 ? 1 : 0 );
switch (decrypt) {
case DECRYPT_FAILED: