On 08/14/2013 04:53 PM, Anthony Thyssen wrote:
On Tue, 13 Aug 2013 19:08:51 -0700
"David J. Bakeman" <dbake...@comcast.net> wrote:
| I've got an encrypted dir that I've been using with:
| 
| encfs --extpass=command root mount
| 
| for a long time.  I'm now trying to use:
| 
| command | encfs --stdinpass root mount
| 
| and it keeps giving the decoded volume key error.  If I do:
| 
| command > file
| echo "cat file" > cout
| chmod +x cout
| encfs --extpass=cout root mount
| 
| it works!  However this doesn't:
| 
| cat file | encfs --stdinpass root mount
| 
| So it seems that the stdout of command is correct but it only works from --extpass???
| 
| I created the dir in fedora 12 and I'm now running Fedora 18 with encfs version 1.7.4.  I don't remember what version of encfs was used in fedora 12.
| 
| Any ideas?


Watch the returns...  One may strip a final new line
while the other many not.
True but if there was an extra character coming from the command it would also be present in the file.  On linux at least cat adds nothing so the output is identical.

Today I got a little less lazy and actually looked at the code for encfs.  Now everything makes sense.  When reading a password from stdin encfs 1.7.4 only accepts 512 bytes whereas when reading from extpass it accepts whatever the limit on an stl string is (This is contrary to the docs which say extpass is limited to 2k on my 64 bit system the max_size for a string is reported as 4611686018427387897 though I'm sure it'd run out of memory way before that :<).  Is there any reason why the stdin password code doesn't use the same read/append loop to build the password in a string?  Perhaps something like:

char buf[512];
string password;

while(fgets(buf, sizeof(buf), stdin))
    password.append(buf);
// the following removes any trailing newline just like the extpass code does.
if(password.empty() && password[password.length()-1 ] == '\n' )
    password.resize(password.length() - 1 );

Anyway I fixed my issue by passing my whole command as extpass program (I had assumed that a command with spaces and pipes wouldn't be accepted).  so encfs --extpass='command 1 | command 2' root mount works.

Remember for passwords any character could be used including newlines,
though typically newlines and nulls are not used for obvious reasons.




  Anthony Thyssen ( System Programmer )    <a.thys...@griffith.edu.au>
 --------------------------------------------------------------------------
   When a place gets crowded enough to require ID's, social collapse is
   not far away.  It is time to go elsewhere.  The best thing about space
   travel is that it made it possible to go elsewhere.    -- Robert Heinlein
 --------------------------------------------------------------------------
   Anthony's Castle     http://www.ict.griffith.edu.au/anthony/


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Encfs-users mailing list
Encfs-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/encfs-users

Reply via email to