mirror of
https://github.com/vgough/encfs.git
synced 2025-06-20 11:47:58 +02:00
1.x: backport support for std::shared_ptr, use __APPLE__ instead of __FreeBSD__
git-svn-id: http://encfs.googlecode.com/svn/branches/1.x@130 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
parent
3373886fdf
commit
b5352f2381
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using namespace boost;
|
|
||||||
|
|
||||||
static RLogChannel * Info = DEF_CHANNEL( "info/nameio", Log_Info );
|
static RLogChannel * Info = DEF_CHANNEL( "info/nameio", Log_Info );
|
||||||
|
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
#include "NameIO.h"
|
#include "NameIO.h"
|
||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ public:
|
|||||||
static rel::Interface CurrentInterface(bool caseSensitive = false);
|
static rel::Interface CurrentInterface(bool caseSensitive = false);
|
||||||
|
|
||||||
BlockNameIO( const rel::Interface &iface,
|
BlockNameIO( const rel::Interface &iface,
|
||||||
const boost::shared_ptr<Cipher> &cipher,
|
const shared_ptr<Cipher> &cipher,
|
||||||
const CipherKey &key, int blockSize,
|
const CipherKey &key, int blockSize,
|
||||||
bool caseSensitiveEncoding = false );
|
bool caseSensitiveEncoding = false );
|
||||||
virtual ~BlockNameIO();
|
virtual ~BlockNameIO();
|
||||||
@ -60,7 +59,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
int _interface;
|
int _interface;
|
||||||
int _bs;
|
int _bs;
|
||||||
boost::shared_ptr<Cipher> _cipher;
|
shared_ptr<Cipher> _cipher;
|
||||||
CipherKey _key;
|
CipherKey _key;
|
||||||
bool _caseSensitive;
|
bool _caseSensitive;
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
#define REF_MODULE(TYPE) \
|
#define REF_MODULE(TYPE) \
|
||||||
if( !TYPE::Enabled() ) \
|
if( !TYPE::Enabled() ) \
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mostly pure virtual interface defining operations on a cipher.
|
Mostly pure virtual interface defining operations on a cipher.
|
||||||
|
|
||||||
@ -44,7 +42,7 @@ class Cipher
|
|||||||
public:
|
public:
|
||||||
// if no key length was indicated when cipher was registered, then keyLen
|
// if no key length was indicated when cipher was registered, then keyLen
|
||||||
// <= 0 will be used.
|
// <= 0 will be used.
|
||||||
typedef boost::shared_ptr<Cipher> (*CipherConstructor)( const rel::Interface &iface,
|
typedef shared_ptr<Cipher> (*CipherConstructor)( const rel::Interface &iface,
|
||||||
int keyLenBits );
|
int keyLenBits );
|
||||||
|
|
||||||
struct CipherAlgorithm
|
struct CipherAlgorithm
|
||||||
@ -61,9 +59,9 @@ public:
|
|||||||
static AlgorithmList GetAlgorithmList( bool includeHidden = false );
|
static AlgorithmList GetAlgorithmList( bool includeHidden = false );
|
||||||
|
|
||||||
|
|
||||||
static boost::shared_ptr<Cipher> New( const rel::Interface &iface,
|
static shared_ptr<Cipher> New( const rel::Interface &iface,
|
||||||
int keyLen = -1);
|
int keyLen = -1);
|
||||||
static boost::shared_ptr<Cipher> New( const std::string &cipherName,
|
static shared_ptr<Cipher> New( const std::string &cipherName,
|
||||||
int keyLen = -1 );
|
int keyLen = -1 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- Version 2:0 adds support for a per-file initialization vector with a
|
- Version 2:0 adds support for a per-file initialization vector with a
|
||||||
fixed 8 byte header. The headers are enabled globally within a
|
fixed 8 byte header. The headers are enabled globally within a
|
||||||
|
@ -37,7 +37,7 @@ class Cipher;
|
|||||||
class CipherFileIO : public BlockFileIO
|
class CipherFileIO : public BlockFileIO
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CipherFileIO( const boost::shared_ptr<FileIO> &base,
|
CipherFileIO( const shared_ptr<FileIO> &base,
|
||||||
const FSConfigPtr &cfg);
|
const FSConfigPtr &cfg);
|
||||||
virtual ~CipherFileIO();
|
virtual ~CipherFileIO();
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ private:
|
|||||||
bool streamWrite( unsigned char *buf, int size,
|
bool streamWrite( unsigned char *buf, int size,
|
||||||
uint64_t iv64 ) const;
|
uint64_t iv64 ) const;
|
||||||
|
|
||||||
boost::shared_ptr<FileIO> base;
|
shared_ptr<FileIO> base;
|
||||||
|
|
||||||
FSConfigPtr fsConfig;
|
FSConfigPtr fsConfig;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ private:
|
|||||||
uint64_t fileIV;
|
uint64_t fileIV;
|
||||||
int lastFlags;
|
int lastFlags;
|
||||||
|
|
||||||
boost::shared_ptr<Cipher> cipher;
|
shared_ptr<Cipher> cipher;
|
||||||
CipherKey key;
|
CipherKey key;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#ifndef _CipherKey_incl_
|
#ifndef _CipherKey_incl_
|
||||||
#define _CipherKey_incl_
|
#define _CipherKey_incl_
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
class AbstractCipherKey
|
class AbstractCipherKey
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ public:
|
|||||||
virtual ~AbstractCipherKey();
|
virtual ~AbstractCipherKey();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<AbstractCipherKey> CipherKey;
|
typedef shared_ptr<AbstractCipherKey> CipherKey;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
#define _ConfigVar_incl_
|
#define _ConfigVar_incl_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class ConfigVar
|
class ConfigVar
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ shared_ptr<FileNode> EncFS_Context::getNode(void *pl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *EncFS_Context::putNode(const char *path,
|
void *EncFS_Context::putNode(const char *path,
|
||||||
const boost::shared_ptr<FileNode> &node)
|
const shared_ptr<FileNode> &node)
|
||||||
{
|
{
|
||||||
Lock lock( contextMutex );
|
Lock lock( contextMutex );
|
||||||
Placeholder *pl = new Placeholder( node );
|
Placeholder *pl = new Placeholder( node );
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#ifndef _Context_incl_
|
#ifndef _Context_incl_
|
||||||
#define _Context_incl_
|
#define _Context_incl_
|
||||||
|
|
||||||
#include "encfs.h"
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#ifdef USE_HASHMAP
|
#ifdef USE_HASHMAP
|
||||||
@ -31,7 +29,9 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::shared_ptr;
|
#include "encfs.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
struct EncFS_Args;
|
struct EncFS_Args;
|
||||||
struct EncFS_Opts;
|
struct EncFS_Opts;
|
||||||
class FileNode;
|
class FileNode;
|
||||||
|
@ -101,7 +101,7 @@ bool _nextName(struct dirent *&de, const shared_ptr<DIR> &dir,
|
|||||||
{
|
{
|
||||||
if(fileType)
|
if(fileType)
|
||||||
{
|
{
|
||||||
#if defined(_DIRENT_HAVE_D_TYPE) || defined(__FreeBSD__)
|
#if defined(_DIRENT_HAVE_D_TYPE) || defined(__FreeBSD__) || defined(__APPLE__)
|
||||||
*fileType = de->d_type;
|
*fileType = de->d_type;
|
||||||
#else
|
#else
|
||||||
#warning "struct dirent.d_type not supported"
|
#warning "struct dirent.d_type not supported"
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
#include "FSConfig.h"
|
#include "FSConfig.h"
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
class RenameOp;
|
class RenameOp;
|
||||||
struct RenameEl;
|
struct RenameEl;
|
||||||
@ -73,7 +71,7 @@ private:
|
|||||||
uint64_t iv;
|
uint64_t iv;
|
||||||
shared_ptr<NameIO> naming;
|
shared_ptr<NameIO> naming;
|
||||||
};
|
};
|
||||||
inline bool DirTraverse::valid() const { return dir != 0; }
|
inline bool DirTraverse::valid() const { return dir.get() != 0; }
|
||||||
|
|
||||||
#ifdef USE_HASHMAP
|
#ifdef USE_HASHMAP
|
||||||
namespace __gnu_cxx
|
namespace __gnu_cxx
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
#ifndef _FSConfig_incl_
|
#ifndef _FSConfig_incl_
|
||||||
#define _FSConfig_incl_
|
#define _FSConfig_incl_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "encfs.h"
|
#include "encfs.h"
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
#include <vector>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
enum ConfigType
|
enum ConfigType
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ struct EncFSConfig
|
|||||||
const std::string &rootDir);
|
const std::string &rootDir);
|
||||||
CipherKey getNewUserKey();
|
CipherKey getNewUserKey();
|
||||||
|
|
||||||
boost::shared_ptr<Cipher> getCipher() const;
|
shared_ptr<Cipher> getCipher() const;
|
||||||
|
|
||||||
// deprecated
|
// deprecated
|
||||||
void assignKeyData(const std::string &in);
|
void assignKeyData(const std::string &in);
|
||||||
@ -113,12 +113,12 @@ std::istream &operator >> (std::istream &os, EncFSConfig &cfg);
|
|||||||
|
|
||||||
struct FSConfig
|
struct FSConfig
|
||||||
{
|
{
|
||||||
boost::shared_ptr<EncFSConfig> config;
|
shared_ptr<EncFSConfig> config;
|
||||||
boost::shared_ptr<EncFS_Opts> opts;
|
shared_ptr<EncFS_Opts> opts;
|
||||||
|
|
||||||
boost::shared_ptr<Cipher> cipher;
|
shared_ptr<Cipher> cipher;
|
||||||
CipherKey key;
|
CipherKey key;
|
||||||
boost::shared_ptr<NameIO> nameCoding;
|
shared_ptr<NameIO> nameCoding;
|
||||||
|
|
||||||
bool forceDecode; // force decode on MAC block failures
|
bool forceDecode; // force decode on MAC block failures
|
||||||
bool reverseEncryption; // reverse encryption operation
|
bool reverseEncryption; // reverse encryption operation
|
||||||
@ -126,7 +126,7 @@ struct FSConfig
|
|||||||
bool idleTracking; // turn on idle monitoring of filesystem
|
bool idleTracking; // turn on idle monitoring of filesystem
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<FSConfig> FSConfigPtr;
|
typedef shared_ptr<FSConfig> FSConfigPtr;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using boost::dynamic_pointer_cast;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: locking at the FileNode level is inefficient, since this precludes
|
TODO: locking at the FileNode level is inefficient, since this precludes
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
class Cipher;
|
class Cipher;
|
||||||
class FileIO;
|
class FileIO;
|
||||||
class DirNode;
|
class DirNode;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class FileNode
|
class FileNode
|
||||||
{
|
{
|
||||||
|
@ -110,10 +110,10 @@ struct ConfigInfo
|
|||||||
ConfigType type;
|
ConfigType type;
|
||||||
const char *environmentOverride;
|
const char *environmentOverride;
|
||||||
bool (*loadFunc)(const char *fileName,
|
bool (*loadFunc)(const char *fileName,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
ConfigInfo *cfg);
|
ConfigInfo *cfg);
|
||||||
bool (*saveFunc)(const char *fileName,
|
bool (*saveFunc)(const char *fileName,
|
||||||
const boost::shared_ptr<EncFSConfig> &config);
|
const shared_ptr<EncFSConfig> &config);
|
||||||
int currentSubVersion;
|
int currentSubVersion;
|
||||||
int defaultSubVersion;
|
int defaultSubVersion;
|
||||||
} ConfigFileMapping[] = {
|
} ConfigFileMapping[] = {
|
||||||
@ -362,7 +362,7 @@ bool userAllowMkdir(int promptno, const char *path, mode_t mode )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigType readConfig_load( ConfigInfo *nm, const char *path,
|
ConfigType readConfig_load( ConfigInfo *nm, const char *path,
|
||||||
const boost::shared_ptr<EncFSConfig> &config )
|
const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
if( nm->loadFunc )
|
if( nm->loadFunc )
|
||||||
{
|
{
|
||||||
@ -389,7 +389,7 @@ ConfigType readConfig_load( ConfigInfo *nm, const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigType readConfig( const string &rootDir,
|
ConfigType readConfig( const string &rootDir,
|
||||||
const boost::shared_ptr<EncFSConfig> &config )
|
const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
ConfigInfo *nm = ConfigFileMapping;
|
ConfigInfo *nm = ConfigFileMapping;
|
||||||
while(nm->fileName)
|
while(nm->fileName)
|
||||||
@ -413,7 +413,7 @@ ConfigType readConfig( const string &rootDir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool readV6Config( const char *configFile,
|
bool readV6Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
ConfigInfo *info)
|
ConfigInfo *info)
|
||||||
{
|
{
|
||||||
(void)info;
|
(void)info;
|
||||||
@ -440,7 +440,7 @@ bool readV6Config( const char *configFile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool readV5Config( const char *configFile,
|
bool readV5Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
ConfigInfo *info)
|
ConfigInfo *info)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -498,7 +498,7 @@ bool readV5Config( const char *configFile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool readV4Config( const char *configFile,
|
bool readV4Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
ConfigInfo *info)
|
ConfigInfo *info)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -539,7 +539,7 @@ bool readV4Config( const char *configFile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool saveConfig( ConfigType type, const string &rootDir,
|
bool saveConfig( ConfigType type, const string &rootDir,
|
||||||
const boost::shared_ptr<EncFSConfig> &config )
|
const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ bool saveConfig( ConfigType type, const string &rootDir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool writeV6Config( const char *configFile,
|
bool writeV6Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config )
|
const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
fs::ofstream st( configFile );
|
fs::ofstream st( configFile );
|
||||||
if(!st.is_open())
|
if(!st.is_open())
|
||||||
@ -601,7 +601,7 @@ std::istream &operator >> (std::istream &st, EncFSConfig &cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool writeV5Config( const char *configFile,
|
bool writeV5Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config )
|
const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
ConfigReader cfg;
|
ConfigReader cfg;
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ bool writeV5Config( const char *configFile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool writeV4Config( const char *configFile,
|
bool writeV4Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config )
|
const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
ConfigReader cfg;
|
ConfigReader cfg;
|
||||||
|
|
||||||
@ -1262,7 +1262,7 @@ RootPtr createV6Config( EncFS_Context *ctx,
|
|||||||
return rootInfo;
|
return rootInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
|
void showFSInfo( const shared_ptr<EncFSConfig> &config )
|
||||||
{
|
{
|
||||||
shared_ptr<Cipher> cipher = Cipher::New( config->cipherIface, -1 );
|
shared_ptr<Cipher> cipher = Cipher::New( config->cipherIface, -1 );
|
||||||
{
|
{
|
||||||
@ -1615,7 +1615,7 @@ CipherKey EncFSConfig::getNewUserKey()
|
|||||||
RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
|
RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
|
||||||
{
|
{
|
||||||
RootPtr rootInfo;
|
RootPtr rootInfo;
|
||||||
boost::shared_ptr<EncFSConfig> config(new EncFSConfig);
|
shared_ptr<EncFSConfig> config(new EncFSConfig);
|
||||||
|
|
||||||
if(readConfig( opts->rootDir, config ) != Config_None)
|
if(readConfig( opts->rootDir, config ) != Config_None)
|
||||||
{
|
{
|
||||||
|
@ -47,15 +47,15 @@ class DirNode;
|
|||||||
|
|
||||||
struct EncFS_Root
|
struct EncFS_Root
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Cipher> cipher;
|
shared_ptr<Cipher> cipher;
|
||||||
CipherKey volumeKey;
|
CipherKey volumeKey;
|
||||||
boost::shared_ptr<DirNode> root;
|
shared_ptr<DirNode> root;
|
||||||
|
|
||||||
EncFS_Root();
|
EncFS_Root();
|
||||||
~EncFS_Root();
|
~EncFS_Root();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<EncFS_Root> RootPtr;
|
typedef shared_ptr<EncFS_Root> RootPtr;
|
||||||
|
|
||||||
enum ConfigMode
|
enum ConfigMode
|
||||||
{
|
{
|
||||||
@ -105,40 +105,40 @@ struct EncFS_Opts
|
|||||||
Read existing config file. Looks for any supported configuration version.
|
Read existing config file. Looks for any supported configuration version.
|
||||||
*/
|
*/
|
||||||
ConfigType readConfig( const std::string &rootDir,
|
ConfigType readConfig( const std::string &rootDir,
|
||||||
const boost::shared_ptr<EncFSConfig> &config );
|
const shared_ptr<EncFSConfig> &config );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Save the configuration. Saves back as the same configuration type as was
|
Save the configuration. Saves back as the same configuration type as was
|
||||||
read from.
|
read from.
|
||||||
*/
|
*/
|
||||||
bool saveConfig( ConfigType type, const std::string &rootdir,
|
bool saveConfig( ConfigType type, const std::string &rootdir,
|
||||||
const boost::shared_ptr<EncFSConfig> &config );
|
const shared_ptr<EncFSConfig> &config );
|
||||||
|
|
||||||
class EncFS_Context;
|
class EncFS_Context;
|
||||||
|
|
||||||
RootPtr initFS( EncFS_Context *ctx, const boost::shared_ptr<EncFS_Opts> &opts );
|
RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts );
|
||||||
|
|
||||||
RootPtr createV6Config( EncFS_Context *ctx,
|
RootPtr createV6Config( EncFS_Context *ctx,
|
||||||
const boost::shared_ptr<EncFS_Opts> &opts );
|
const shared_ptr<EncFS_Opts> &opts );
|
||||||
|
|
||||||
void showFSInfo( const boost::shared_ptr<EncFSConfig> &config );
|
void showFSInfo( const shared_ptr<EncFSConfig> &config );
|
||||||
|
|
||||||
bool readV4Config( const char *configFile,
|
bool readV4Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
struct ConfigInfo *);
|
struct ConfigInfo *);
|
||||||
bool writeV4Config( const char *configFile,
|
bool writeV4Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config);
|
const shared_ptr<EncFSConfig> &config);
|
||||||
|
|
||||||
bool readV5Config( const char *configFile,
|
bool readV5Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
struct ConfigInfo *);
|
struct ConfigInfo *);
|
||||||
bool writeV5Config( const char *configFile,
|
bool writeV5Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config);
|
const shared_ptr<EncFSConfig> &config);
|
||||||
|
|
||||||
bool readV6Config( const char *configFile,
|
bool readV6Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config,
|
const shared_ptr<EncFSConfig> &config,
|
||||||
struct ConfigInfo *);
|
struct ConfigInfo *);
|
||||||
bool writeV6Config( const char *configFile,
|
bool writeV6Config( const char *configFile,
|
||||||
const boost::shared_ptr<EncFSConfig> &config);
|
const shared_ptr<EncFSConfig> &config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::shared_ptr;
|
|
||||||
using boost::dynamic_pointer_cast;
|
|
||||||
|
|
||||||
static RLogChannel *Info = DEF_CHANNEL("info/MACFileIO", Log_Info);
|
static RLogChannel *Info = DEF_CHANNEL("info/MACFileIO", Log_Info);
|
||||||
//
|
//
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include "BlockFileIO.h"
|
#include "BlockFileIO.h"
|
||||||
#include "Cipher.h"
|
#include "Cipher.h"
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class MACFileIO : public BlockFileIO
|
class MACFileIO : public BlockFileIO
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -5,14 +5,7 @@ ALL_INCLUDES = @RLOG_CFLAGS@ @OPENSSL_CFLAGS@ @BOOST_CPPFLAGS@
|
|||||||
ALL_LDFLAGS = @RLOG_LIBS@ @OPENSSL_LIBS@ @BOOST_LDFLAGS@
|
ALL_LDFLAGS = @RLOG_LIBS@ @OPENSSL_LIBS@ @BOOST_LDFLAGS@
|
||||||
ALL_LDFLAGS += @BOOST_SERIALIZATION_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@
|
ALL_LDFLAGS += @BOOST_SERIALIZATION_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@
|
||||||
|
|
||||||
INCLUDES = $(all_includes) -I../intl
|
AM_CXXFLAGS = -DRLOG_COMPONENT="encfs" $(ALL_INCLUDES) -I../intl
|
||||||
|
|
||||||
AM_CXXFLAGS = -DRLOG_COMPONENT="encfs" $(ALL_INCLUDES)
|
|
||||||
|
|
||||||
if DARWIN
|
|
||||||
# needed to select correct API in fuse.h
|
|
||||||
AM_CXXFLAGS += -D__FreeBSD__=10
|
|
||||||
endif
|
|
||||||
|
|
||||||
if BUILD_NLS
|
if BUILD_NLS
|
||||||
# define a C macro LOCALEDIR indicating where catalogs will be installed
|
# define a C macro LOCALEDIR indicating where catalogs will be installed
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
|
|
||||||
class NameIO
|
class NameIO
|
||||||
|
@ -18,22 +18,19 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "NullCipher.h"
|
#include "NullCipher.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <rlog/rlog.h>
|
||||||
|
|
||||||
#include "Range.h"
|
#include "Range.h"
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <rlog/rlog.h>
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using boost::shared_ptr;
|
|
||||||
using boost::dynamic_pointer_cast;
|
|
||||||
|
|
||||||
|
|
||||||
static Interface NullInterface( "nullCipher", 1, 0, 0 );
|
static Interface NullInterface( "nullCipher", 1, 0, 0 );
|
||||||
static Range NullKeyRange(0);
|
static Range NullKeyRange(0);
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
static shared_ptr<NameIO> NewNNIO( const Interface &,
|
static shared_ptr<NameIO> NewNNIO( const Interface &,
|
||||||
const shared_ptr<Cipher> &, const CipherKey & )
|
const shared_ptr<Cipher> &, const CipherKey & )
|
||||||
|
@ -296,7 +296,7 @@ int RawFileIO::truncate( off_t size )
|
|||||||
if(fd >= 0 && canWrite)
|
if(fd >= 0 && canWrite)
|
||||||
{
|
{
|
||||||
res = ::ftruncate( fd, size );
|
res = ::ftruncate( fd, size );
|
||||||
#ifndef __FreeBSD__
|
#if !defined(__FreeBSD__) && !defined(__APPLE__)
|
||||||
::fdatasync( fd );
|
::fdatasync( fd );
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
|
@ -48,9 +48,6 @@ using namespace std;
|
|||||||
using namespace rel;
|
using namespace rel;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
using boost::dynamic_pointer_cast;
|
|
||||||
|
|
||||||
const int MAX_KEYLENGTH = 32; // in bytes (256 bit)
|
const int MAX_KEYLENGTH = 32; // in bytes (256 bit)
|
||||||
const int MAX_IVLENGTH = 16;
|
const int MAX_IVLENGTH = 16;
|
||||||
const int KEY_CHECKSUM_BYTES = 4;
|
const int KEY_CHECKSUM_BYTES = 4;
|
||||||
|
@ -30,8 +30,6 @@ struct evp_cipher_st;
|
|||||||
typedef struct evp_cipher_st EVP_CIPHER;
|
typedef struct evp_cipher_st EVP_CIPHER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Implements Cipher interface for OpenSSL's ciphers.
|
Implements Cipher interface for OpenSSL's ciphers.
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class StreamNameIO : public NameIO
|
class StreamNameIO : public NameIO
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ static int withFileNode( const char *opName,
|
|||||||
else
|
else
|
||||||
fnode = FSRoot->lookupNode( path, opName );
|
fnode = FSRoot->lookupNode( path, opName );
|
||||||
|
|
||||||
rAssert(fnode != NULL);
|
rAssert(fnode.get() != NULL);
|
||||||
rLog(Info, "%s %s", opName, fnode->cipherName());
|
rLog(Info, "%s %s", opName, fnode->cipherName());
|
||||||
res = op( fnode.get(), data );
|
res = op( fnode.get(), data );
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
#include "FileNode.h"
|
#include "FileNode.h"
|
||||||
#include "DirNode.h"
|
#include "DirNode.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
#include <rlog/rlog.h>
|
#include <rlog/rlog.h>
|
||||||
#include <rlog/StdioNode.h>
|
#include <rlog/StdioNode.h>
|
||||||
@ -51,8 +52,8 @@
|
|||||||
|
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost;
|
|
||||||
using boost::format;
|
using boost::format;
|
||||||
|
using boost::scoped_array;
|
||||||
|
|
||||||
static int showInfo( int argc, char **argv );
|
static int showInfo( int argc, char **argv );
|
||||||
static int showVersion( int argc, char **argv );
|
static int showVersion( int argc, char **argv );
|
||||||
@ -172,7 +173,7 @@ static int showInfo( int argc, char **argv )
|
|||||||
if( !checkDir( rootDir ))
|
if( !checkDir( rootDir ))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
boost::shared_ptr<EncFSConfig> config(new EncFSConfig);
|
shared_ptr<EncFSConfig> config(new EncFSConfig);
|
||||||
ConfigType type = readConfig( rootDir, config );
|
ConfigType type = readConfig( rootDir, config );
|
||||||
|
|
||||||
// show information stored in config..
|
// show information stored in config..
|
||||||
@ -698,7 +699,7 @@ static int do_chpasswd( bool useStdin, bool annotate, int argc, char **argv )
|
|||||||
if( !checkDir( rootDir ))
|
if( !checkDir( rootDir ))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
boost::shared_ptr<EncFSConfig> config(new EncFSConfig);
|
shared_ptr<EncFSConfig> config(new EncFSConfig);
|
||||||
ConfigType cfgType = readConfig( rootDir, config );
|
ConfigType cfgType = readConfig( rootDir, config );
|
||||||
|
|
||||||
if(cfgType == Config_None)
|
if(cfgType == Config_None)
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "encfs.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -34,7 +31,6 @@
|
|||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
#include <rlog/rlog.h>
|
#include <rlog/rlog.h>
|
||||||
#include <rlog/Error.h>
|
#include <rlog/Error.h>
|
||||||
@ -43,13 +39,15 @@
|
|||||||
#include <rlog/StdioNode.h>
|
#include <rlog/StdioNode.h>
|
||||||
|
|
||||||
#include "ConfigReader.h"
|
#include "ConfigReader.h"
|
||||||
|
#include "Context.h"
|
||||||
|
#include "DirNode.h"
|
||||||
|
#include "FileUtils.h"
|
||||||
#include "Interface.h"
|
#include "Interface.h"
|
||||||
#include "MemoryPool.h"
|
#include "MemoryPool.h"
|
||||||
#include "FileUtils.h"
|
#include "config.h"
|
||||||
#include "DirNode.h"
|
#include "encfs.h"
|
||||||
#include "Context.h"
|
|
||||||
|
|
||||||
#include "openssl.h"
|
#include "openssl.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
@ -71,7 +69,6 @@ using namespace std;
|
|||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace rel;
|
using namespace rel;
|
||||||
using boost::format;
|
using boost::format;
|
||||||
using boost::shared_ptr;
|
|
||||||
using boost::scoped_ptr;
|
using boost::scoped_ptr;
|
||||||
|
|
||||||
// Maximum number of arguments that we're going to pass on to fuse. Doesn't
|
// Maximum number of arguments that we're going to pass on to fuse. Doesn't
|
||||||
@ -592,7 +589,7 @@ int main(int argc, char *argv[])
|
|||||||
encfs_oper.utimens = encfs_utimens;
|
encfs_oper.utimens = encfs_utimens;
|
||||||
//encfs_oper.bmap = encfs_bmap;
|
//encfs_oper.bmap = encfs_bmap;
|
||||||
|
|
||||||
#if (__FreeBSD__ >= 10)
|
#if (__FreeBSD__ >= 10) || defined(__APPLE__)
|
||||||
// encfs_oper.setvolname
|
// encfs_oper.setvolname
|
||||||
// encfs_oper.exchange
|
// encfs_oper.exchange
|
||||||
// encfs_oper.getxtimes
|
// encfs_oper.getxtimes
|
||||||
|
37
encfs/shared_ptr.h
Normal file
37
encfs/shared_ptr.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Author: Valient Gough <vgough@pobox.com>
|
||||||
|
*
|
||||||
|
*****************************************************************************
|
||||||
|
* Copyright (c) 2012 Valient Gough
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SHARED_PTR_incl_
|
||||||
|
#define _SHARED_PTR_incl_
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_STD_SHARED_PTR
|
||||||
|
#include <memory>
|
||||||
|
using std::shared_ptr;
|
||||||
|
using std::dynamic_pointer_cast;
|
||||||
|
#else
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
using boost::shared_ptr;
|
||||||
|
using boost::dynamic_pointer_cast;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -52,8 +52,6 @@ using namespace std;
|
|||||||
using namespace rel;
|
using namespace rel;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
const int FSBlockSize = 256;
|
const int FSBlockSize = 256;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
Loading…
x
Reference in New Issue
Block a user