mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
add direct-load method so that encfsctl cat can work with direct cipher paths
git-svn-id: http://encfs.googlecode.com/svn/trunk@19 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
parent
2123f3580f
commit
4b707677b5
@ -706,6 +706,22 @@ shared_ptr<FileNode> DirNode::renameNode( const char *from, const char *to,
|
||||
return node;
|
||||
}
|
||||
|
||||
shared_ptr<FileNode> DirNode::directLookup( const char *path )
|
||||
{
|
||||
return shared_ptr<FileNode>(
|
||||
new FileNode( this,
|
||||
config->fsSubVersion,
|
||||
"unknown", path,
|
||||
config->cipher, config->key,
|
||||
config->blockSize, config->blockMACBytes,
|
||||
config->blockMACRandBytes,
|
||||
config->uniqueIV,
|
||||
config->externalIVChaining,
|
||||
config->forceDecode,
|
||||
config->reverseEncryption,
|
||||
config->allowHoles) );
|
||||
}
|
||||
|
||||
shared_ptr<FileNode> DirNode::findOrCreate( const char *plainName)
|
||||
{
|
||||
shared_ptr<FileNode> node;
|
||||
|
@ -135,6 +135,10 @@ public:
|
||||
shared_ptr<FileNode> openNode( const char *plaintextName,
|
||||
const char *requestor, int flags, int *openResult );
|
||||
|
||||
/* For internal use - open a cipher file directly
|
||||
*/
|
||||
shared_ptr<FileNode> directLookup( const char *realPath );
|
||||
|
||||
std::string cipherPath( const char *plaintextPath );
|
||||
std::string plainPath( const char *cipherPath );
|
||||
|
||||
|
@ -334,6 +334,19 @@ int processContents( const shared_ptr<EncFS_Root> &rootInfo,
|
||||
int errCode = 0;
|
||||
shared_ptr<FileNode> node = rootInfo->root->openNode( path, "encfsctl",
|
||||
O_RDONLY, &errCode );
|
||||
|
||||
if(!node)
|
||||
{
|
||||
// try opening directly, so a cipher-path can be passed in
|
||||
node = rootInfo->root->directLookup( path );
|
||||
if(node)
|
||||
{
|
||||
errCode = node->open( O_RDONLY );
|
||||
if(errCode < 0)
|
||||
node.reset();
|
||||
}
|
||||
}
|
||||
|
||||
if(!node)
|
||||
{
|
||||
cerr << "unable to open " << path << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user