passphrase_passwd_fd does not work

Bug #683535 reported by Stephan Ritscher
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
eCryptfs
Fix Released
Medium
Dustin Kirkland 

Bug Description

Hi,

I tried to mount a directory using

echo "passphrase_passwd=<>" | mount -t ecryptfs -o ecryptfs_sig=<>,ecryptfs_fnek_sig=<>,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_passthrough=no,key=passphrase:passphrase_passwd_fd=0 ~/Private ~/Private

(<> stands for removed parts)

Syslog reported

<> mount.ecryptfs: ecryptfs_get_module_ciphers: opendir error on [/lib/modules/2.6.34-gentoo-r12/kernel/crypto]. Cannot get a list of ciphers available as modules.
<> mount.ecryptfs: parse_options_file: mmap failed on fd [0]; rc = [-22]
<> mount.ecryptfs: tf_pass_file: Error parsing file for passwd; rc = [-22]

Then I had a look at ecryptfs-utils and discovered that the problem was in cmd_ln_parser.c. The call file_size = filestat.st_size returned 0 on my linux system since the file descriptor was a pipe.

I fixed it in the attached patch. I replaced mmap by read (until EOF). Please review the patch and tell me your opinion.

Greetings
Stephan

Revision history for this message
Stephan Ritscher (no3pam) wrote :
Revision history for this message
Stephan Ritscher (no3pam) wrote :

Bump

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Howdy! Sorry for the unexepectedly long delay in responding to this here. Thanks for the patch.

I'll get this tested and reviewed.

Changed in ecryptfs:
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Dustin Kirkland (kirkland)
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Thanks for the patch. Looks good to me. Testing confirms the fix too. Thanks!

kirkland@x220:/tmp/foo$ echo "passphrase_passwd=foobar" | sudo mount -t ecryptfs -o ecryptfs_sig=c7fed37c0a341e19,ecryptfs_fnek_sig=32cf
6135c869c68c,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_passthrough=no,key=passphrase:passphrase_passwd_fd=0 ./a ./b
[sudo] password for kirkland:
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=32cf6135c869c68c
  ecryptfs_key_bytes=32
  ecryptfs_cipher=aes
  ecryptfs_sig=c7fed37c0a341e19
Mounted eCryptfs

Changed in ecryptfs:
status: Triaged → Fix Committed
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Committed revision 588.

Revision history for this message
Tyler Hicks (tyhicks) wrote :

Stephan, I made just a few small touch ups, mainly to the error paths. Revision 592.

Thanks again for the patch!

Changed in ecryptfs:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.