mirror of
https://github.com/vgough/encfs.git
synced 2024-11-24 17:03:13 +01:00
eliminate boost dependency, replace with C++11 features
git-svn-id: http://encfs.googlecode.com/svn/trunk@86 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
parent
36946fdea7
commit
1680008df1
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
Tue Aug 21 2012 Valient Gough <vgough@pobox.com>
|
||||||
|
* replace boost with C++11
|
||||||
|
|
||||||
|
Sun Aug 19 2012 Valient Gough <vgough@pobox.com>
|
||||||
|
* move encrypted key into separate config block
|
||||||
|
|
||||||
|
Sat Aug 18 2012 Valient Gough <vgough@pobox.com>
|
||||||
|
* add V to getopt for version
|
||||||
|
|
||||||
|
Sun May 13 2012 Valient Gough <vgough@pobox.com>
|
||||||
|
* allow "config" for top-level v6 xml config
|
||||||
|
* drop logging of useStdin state
|
||||||
|
|
||||||
Wed Apr 25 2012 Valient Gough <vgough@pobox.com>
|
Wed Apr 25 2012 Valient Gough <vgough@pobox.com>
|
||||||
* fix encfsctl cat when iv chaining is enabled. Fixes issue #132
|
* fix encfsctl cat when iv chaining is enabled. Fixes issue #132
|
||||||
|
|
||||||
|
@ -46,9 +46,7 @@ AC_PROG_LIBTOOL
|
|||||||
|
|
||||||
AX_PTHREAD
|
AX_PTHREAD
|
||||||
|
|
||||||
AX_BOOST_BASE([1.34])
|
AC_CHECK_HEADERS([tr1/memory tr1/unordered_map tr1/unordered_set tr1/tuple])
|
||||||
AX_BOOST_SYSTEM
|
|
||||||
AX_BOOST_FILESYSTEM
|
|
||||||
|
|
||||||
dnl Need to include any user specified flags in the tests below, as they might
|
dnl Need to include any user specified flags in the tests below, as they might
|
||||||
dnl specify required include directories..
|
dnl specify required include directories..
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace boost;
|
|
||||||
|
|
||||||
static RLogChannel * Info = DEF_CHANNEL( "info/nameio", Log_Info );
|
static RLogChannel * Info = DEF_CHANNEL( "info/nameio", Log_Info );
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "NameIO.h"
|
#include "NameIO.h"
|
||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public:
|
|||||||
static Interface CurrentInterface(bool caseSensitive = false);
|
static Interface CurrentInterface(bool caseSensitive = false);
|
||||||
|
|
||||||
BlockNameIO( const Interface &iface,
|
BlockNameIO( const 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();
|
||||||
@ -57,11 +57,10 @@ 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "SSL_Cipher.h"
|
#include "SSL_Cipher.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
#define REF_MODULE(TYPE) \
|
#define REF_MODULE(TYPE) \
|
||||||
if( !TYPE::Enabled() ) \
|
if( !TYPE::Enabled() ) \
|
||||||
|
@ -29,8 +29,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.
|
||||||
|
|
||||||
@ -42,7 +40,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)(
|
typedef shared_ptr<Cipher> (*CipherConstructor)(
|
||||||
const Interface &iface, int keyLenBits );
|
const Interface &iface, int keyLenBits );
|
||||||
|
|
||||||
struct CipherAlgorithm
|
struct CipherAlgorithm
|
||||||
@ -59,9 +57,9 @@ public:
|
|||||||
static AlgorithmList GetAlgorithmList( bool includeHidden = false );
|
static AlgorithmList GetAlgorithmList( bool includeHidden = false );
|
||||||
|
|
||||||
|
|
||||||
static boost::shared_ptr<Cipher> New( const Interface &iface,
|
static shared_ptr<Cipher> New( const 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 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,8 +27,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
|
||||||
|
@ -34,7 +34,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();
|
||||||
|
|
||||||
@ -68,7 +68,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;
|
||||||
|
|
||||||
@ -80,7 +80,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
|
||||||
|
|
||||||
|
@ -19,9 +19,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 );
|
||||||
|
@ -19,16 +19,17 @@
|
|||||||
#define _Context_incl_
|
#define _Context_incl_
|
||||||
|
|
||||||
#include "encfs.h"
|
#include "encfs.h"
|
||||||
#include <boost/shared_ptr.hpp>
|
#include "shared_ptr.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#ifdef USE_HASHMAP
|
#if HAVE_TR1_UNORDERED_MAP
|
||||||
#include <ext/hash_map>
|
#include <tr1/unordered_map>
|
||||||
|
using std::tr1::unordered_map;
|
||||||
#else
|
#else
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
|
using std::unordered_map;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
struct EncFS_Args;
|
struct EncFS_Args;
|
||||||
struct EncFS_Opts;
|
struct EncFS_Opts;
|
||||||
class FileNode;
|
class FileNode;
|
||||||
@ -87,15 +88,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// set of open files, indexed by path
|
// set of open files, indexed by path
|
||||||
#ifdef USE_HASHMAP
|
typedef unordered_map<std::string, std::set<Placeholder*> > FileMap;
|
||||||
typedef __gnu_cxx::hash_map<std::string,
|
|
||||||
std::set<Placeholder*> > FileMap;
|
|
||||||
#else
|
|
||||||
typedef std::map< std::string,
|
|
||||||
std::set<Placeholder*> > FileMap;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mutable pthread_mutex_t contextMutex;
|
mutable pthread_mutex_t contextMutex;
|
||||||
|
|
||||||
FileMap openFiles;
|
FileMap openFiles;
|
||||||
|
|
||||||
int usageCount;
|
int usageCount;
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
#include "NameIO.h"
|
#include "NameIO.h"
|
||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
#include "FSConfig.h"
|
#include "FSConfig.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
class RenameOp;
|
class RenameOp;
|
||||||
@ -72,19 +71,6 @@ private:
|
|||||||
};
|
};
|
||||||
inline bool DirTraverse::valid() const { return dir != 0; }
|
inline bool DirTraverse::valid() const { return dir != 0; }
|
||||||
|
|
||||||
#ifdef USE_HASHMAP
|
|
||||||
namespace __gnu_cxx
|
|
||||||
{
|
|
||||||
template<> struct hash<std::string>
|
|
||||||
{
|
|
||||||
size_t operator() (const std::string &__s) const
|
|
||||||
{
|
|
||||||
return __stl_hash_string( __s.c_str() );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class DirNode
|
class DirNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
#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 <vector>
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
enum ConfigType
|
enum ConfigType
|
||||||
{
|
{
|
||||||
@ -52,8 +52,8 @@ CipherKey getUserKey(const EncfsConfig &config,
|
|||||||
CipherKey getNewUserKey(EncfsConfig &config, bool useStdin,
|
CipherKey getNewUserKey(EncfsConfig &config, bool useStdin,
|
||||||
const std::string &program, const std::string &rootDir);
|
const std::string &program, const std::string &rootDir);
|
||||||
|
|
||||||
boost::shared_ptr<Cipher> getCipher(const EncfsConfig &cfg);
|
shared_ptr<Cipher> getCipher(const EncfsConfig &cfg);
|
||||||
boost::shared_ptr<Cipher> getCipher(const Interface &iface, int keySize);
|
shared_ptr<Cipher> getCipher(const Interface &iface, int keySize);
|
||||||
|
|
||||||
// helpers for serializing to/from a stream
|
// helpers for serializing to/from a stream
|
||||||
std::ostream &operator << (std::ostream &os, const EncfsConfig &cfg);
|
std::ostream &operator << (std::ostream &os, const EncfsConfig &cfg);
|
||||||
@ -62,12 +62,12 @@ std::istream &operator >> (std::istream &os, EncfsConfig &cfg);
|
|||||||
// Filesystem state
|
// Filesystem state
|
||||||
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
|
||||||
@ -75,7 +75,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
|
||||||
|
|
||||||
|
@ -50,7 +50,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
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
class Cipher;
|
class Cipher;
|
||||||
class FileIO;
|
class FileIO;
|
||||||
class DirNode;
|
class DirNode;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class FileNode
|
class FileNode
|
||||||
{
|
{
|
||||||
|
@ -61,9 +61,6 @@
|
|||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
#include <boost/version.hpp>
|
|
||||||
#include <boost/filesystem/fstream.hpp>
|
|
||||||
|
|
||||||
#include <google/protobuf/text_format.h>
|
#include <google/protobuf/text_format.h>
|
||||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||||
|
|
||||||
@ -74,7 +71,6 @@
|
|||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace gnu;
|
using namespace gnu;
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
static const int DefaultBlockSize = 1024;
|
static const int DefaultBlockSize = 1024;
|
||||||
// The maximum length of text passwords. If longer are needed,
|
// The maximum length of text passwords. If longer are needed,
|
||||||
@ -90,17 +86,8 @@ static const char ENCFS_ENV_ROOTDIR[] = "encfs_root";
|
|||||||
static const char ENCFS_ENV_STDOUT[] = "encfs_stdout";
|
static const char ENCFS_ENV_STDOUT[] = "encfs_stdout";
|
||||||
static const char ENCFS_ENV_STDERR[] = "encfs_stderr";
|
static const char ENCFS_ENV_STDERR[] = "encfs_stderr";
|
||||||
|
|
||||||
|
const int V5Latest = 20040813; // fix MACFileIO block size issues
|
||||||
//static int V5SubVersion = 20040518;
|
const int ProtoSubVersion = 20120819;
|
||||||
//static int V5SubVersion = 20040621; // add external IV chaining
|
|
||||||
static int V5SubVersion = 20040813; // fix MACFileIO block size issues
|
|
||||||
|
|
||||||
// 20080813 was really made on 20080413 -- typo on date..
|
|
||||||
//const int V6SubVersion = 20080813; // switch to v6/XML, add allowHoles option
|
|
||||||
//const int V6SubVersion = 20080816; // add salt and iteration count
|
|
||||||
const int V6SubVersion = 20100713; // add version field for boost 1.42+
|
|
||||||
|
|
||||||
const int ProtoSubVersion = 20120302;
|
|
||||||
|
|
||||||
const char ConfigFileName[] = ".encfs.txt";
|
const char ConfigFileName[] = ".encfs.txt";
|
||||||
|
|
||||||
@ -116,7 +103,7 @@ struct ConfigInfo
|
|||||||
{Config_V6, ".encfs6.xml", "ENCFS6_CONFIG", readV6Config },
|
{Config_V6, ".encfs6.xml", "ENCFS6_CONFIG", readV6Config },
|
||||||
// backward compatible support for older versions
|
// backward compatible support for older versions
|
||||||
{Config_V5, ".encfs5", "ENCFS5_CONFIG", readV5Config },
|
{Config_V5, ".encfs5", "ENCFS5_CONFIG", readV5Config },
|
||||||
{Config_V3, ".encfs4", NULL, readV4Config },
|
{Config_V4, ".encfs4", NULL, readV4Config },
|
||||||
// prehistoric - no longer support
|
// prehistoric - no longer support
|
||||||
{Config_V3, ".encfs3", NULL, NULL },
|
{Config_V3, ".encfs3", NULL, NULL },
|
||||||
{Config_Prehistoric, ".encfs2", NULL, NULL },
|
{Config_Prehistoric, ".encfs2", NULL, NULL },
|
||||||
@ -310,7 +297,7 @@ bool readV6Config( const char *configFile,
|
|||||||
{
|
{
|
||||||
rInfo("found 20080813");
|
rInfo("found 20080813");
|
||||||
cfg.set_revision(20080813);
|
cfg.set_revision(20080813);
|
||||||
} else if (version < V5SubVersion)
|
} else if (version < V5Latest)
|
||||||
{
|
{
|
||||||
rError("Invalid version %i - please fix config file", version);
|
rError("Invalid version %i - please fix config file", version);
|
||||||
} else
|
} else
|
||||||
@ -393,16 +380,16 @@ bool readV5Config( const char *configFile,
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
config.set_revision(cfgRdr["subVersion"].readInt(0));
|
config.set_revision(cfgRdr["subVersion"].readInt(0));
|
||||||
if(config.revision() > V5SubVersion)
|
if(config.revision() > V5Latest)
|
||||||
{
|
{
|
||||||
/* config file specifies a version outside our supported
|
/* config file specifies a version outside our supported
|
||||||
range.. */
|
range.. */
|
||||||
rWarning(_("Config subversion %i found, but this version of"
|
rWarning(_("Config subversion %i found, but this version of"
|
||||||
" encfs only supports up to version %i."),
|
" encfs only supports up to version %i."),
|
||||||
config.revision(), V5SubVersion);
|
config.revision(), V5Latest);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if( config.revision() < 20040813 )
|
if( config.revision() < V5Latest )
|
||||||
{
|
{
|
||||||
rError(_("This version of EncFS doesn't support "
|
rError(_("This version of EncFS doesn't support "
|
||||||
"filesystems created before 2004-08-13"));
|
"filesystems created before 2004-08-13"));
|
||||||
@ -1053,7 +1040,7 @@ RootPtr createConfig( EncFS_Context *ctx,
|
|||||||
config.set_block_size( blockSize );
|
config.set_block_size( blockSize );
|
||||||
config.mutable_naming()->MergeFrom( nameIOIface );
|
config.mutable_naming()->MergeFrom( nameIOIface );
|
||||||
config.set_creator( "EncFS " VERSION );
|
config.set_creator( "EncFS " VERSION );
|
||||||
config.set_revision( V6SubVersion );
|
config.set_revision( ProtoSubVersion );
|
||||||
config.set_block_mac_bytes( blockMACBytes );
|
config.set_block_mac_bytes( blockMACBytes );
|
||||||
config.set_block_mac_rand_bytes( blockMACRandBytes );
|
config.set_block_mac_rand_bytes( blockMACRandBytes );
|
||||||
config.set_unique_iv( uniqueIV );
|
config.set_unique_iv( uniqueIV );
|
||||||
@ -1142,7 +1129,7 @@ RootPtr createConfig( EncFS_Context *ctx,
|
|||||||
fsConfig->cipher = cipher;
|
fsConfig->cipher = cipher;
|
||||||
fsConfig->key = volumeKey;
|
fsConfig->key = volumeKey;
|
||||||
fsConfig->nameCoding = nameCoder;
|
fsConfig->nameCoding = nameCoder;
|
||||||
fsConfig->config = boost::shared_ptr<EncfsConfig>(new EncfsConfig(config));
|
fsConfig->config = shared_ptr<EncfsConfig>(new EncfsConfig(config));
|
||||||
fsConfig->forceDecode = forceDecode;
|
fsConfig->forceDecode = forceDecode;
|
||||||
fsConfig->reverseEncryption = reverseEncryption;
|
fsConfig->reverseEncryption = reverseEncryption;
|
||||||
fsConfig->idleTracking = enableIdleTracking;
|
fsConfig->idleTracking = enableIdleTracking;
|
||||||
@ -1227,7 +1214,7 @@ void showFSInfo( const EncfsConfig &config )
|
|||||||
}
|
}
|
||||||
if(config.block_mac_bytes() || config.block_mac_rand_bytes())
|
if(config.block_mac_bytes() || config.block_mac_rand_bytes())
|
||||||
{
|
{
|
||||||
if(config.revision() < 20040813)
|
if(config.revision() < V5Latest)
|
||||||
{
|
{
|
||||||
cout << autosprintf(
|
cout << autosprintf(
|
||||||
// xgroup(diag)
|
// xgroup(diag)
|
||||||
@ -1636,7 +1623,7 @@ RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
|
|||||||
fsConfig->cipher = cipher;
|
fsConfig->cipher = cipher;
|
||||||
fsConfig->key = volumeKey;
|
fsConfig->key = volumeKey;
|
||||||
fsConfig->nameCoding = nameCoder;
|
fsConfig->nameCoding = nameCoder;
|
||||||
fsConfig->config = boost::shared_ptr<EncfsConfig>(new EncfsConfig(config));
|
fsConfig->config = shared_ptr<EncfsConfig>(new EncfsConfig(config));
|
||||||
fsConfig->forceDecode = opts->forceDecode;
|
fsConfig->forceDecode = opts->forceDecode;
|
||||||
fsConfig->reverseEncryption = opts->reverseEncryption;
|
fsConfig->reverseEncryption = opts->reverseEncryption;
|
||||||
fsConfig->opts = opts;
|
fsConfig->opts = opts;
|
||||||
|
@ -44,15 +44,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
|
||||||
{
|
{
|
||||||
@ -109,10 +109,10 @@ bool saveConfig( const std::string &rootdir, const 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 createConfig( EncFS_Context *ctx,
|
RootPtr createConfig( EncFS_Context *ctx,
|
||||||
const boost::shared_ptr<EncFS_Opts> &opts );
|
const shared_ptr<EncFS_Opts> &opts );
|
||||||
|
|
||||||
void showFSInfo( const EncfsConfig &config );
|
void showFSInfo( const EncfsConfig &config );
|
||||||
|
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
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);
|
||||||
//
|
//
|
||||||
|
@ -21,8 +21,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:
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
include $(top_srcdir)/Makefile.common
|
include $(top_srcdir)/Makefile.common
|
||||||
|
|
||||||
ALL_INCLUDES = @RLOG_CFLAGS@ @OPENSSL_CFLAGS@ @BOOST_CPPFLAGS@
|
ALL_INCLUDES = @RLOG_CFLAGS@ @OPENSSL_CFLAGS@
|
||||||
ALL_INCLUDES += @PROTOBUF_CFLAGS@
|
ALL_INCLUDES += @PROTOBUF_CFLAGS@
|
||||||
ALL_LDFLAGS = @RLOG_LIBS@ @OPENSSL_LIBS@ @BOOST_LDFLAGS@
|
ALL_LDFLAGS = @RLOG_LIBS@ @OPENSSL_LIBS@
|
||||||
ALL_LDFLAGS += @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@
|
|
||||||
ALL_LDFLAGS += @PROTOBUF_LIBS@
|
ALL_LDFLAGS += @PROTOBUF_LIBS@
|
||||||
|
|
||||||
INCLUDES = $(all_includes) -I../intl
|
INCLUDES = $(all_includes) -I../intl
|
||||||
@ -50,9 +49,7 @@ endif
|
|||||||
# : +1 : => internal changes, nothing breaks
|
# : +1 : => internal changes, nothing breaks
|
||||||
#
|
#
|
||||||
libencfs_la_LDFLAGS = -version-info 7:0:0
|
libencfs_la_LDFLAGS = -version-info 7:0:0
|
||||||
libencfs_la_LIBADD = @RLOG_LIBS@ \
|
libencfs_la_LIBADD = @RLOG_LIBS@ @OPENSSL_LIBS@
|
||||||
@OPENSSL_LIBS@ \
|
|
||||||
@BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@
|
|
||||||
|
|
||||||
EXTRASRC = ../intl/autosprintf.cpp
|
EXTRASRC = ../intl/autosprintf.cpp
|
||||||
if BUILD_OPENSSL
|
if BUILD_OPENSSL
|
||||||
@ -105,7 +102,6 @@ encfsctl_SOURCES = \
|
|||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
base64.h \
|
base64.h \
|
||||||
boost-versioning.h \
|
|
||||||
BlockFileIO.h \
|
BlockFileIO.h \
|
||||||
BlockNameIO.h \
|
BlockNameIO.h \
|
||||||
CipherFileIO.h \
|
CipherFileIO.h \
|
||||||
|
@ -26,7 +26,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
|
||||||
|
@ -19,16 +19,14 @@
|
|||||||
|
|
||||||
#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 <rlog/rlog.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using boost::shared_ptr;
|
|
||||||
using boost::dynamic_pointer_cast;
|
|
||||||
|
|
||||||
|
|
||||||
static Interface NullInterface = makeInterface( "nullCipher", 1, 0, 0 );
|
static Interface NullInterface = makeInterface( "nullCipher", 1, 0, 0 );
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
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 & )
|
||||||
{
|
{
|
||||||
|
@ -46,9 +46,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;
|
||||||
|
@ -28,8 +28,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.
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "CipherKey.h"
|
#include "CipherKey.h"
|
||||||
|
|
||||||
class Cipher;
|
class Cipher;
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
class StreamNameIO : public NameIO
|
class StreamNameIO : public NameIO
|
||||||
{
|
{
|
||||||
|
@ -27,8 +27,9 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstring>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <tinyxml.h>
|
#include <tinyxml.h>
|
||||||
@ -151,7 +152,7 @@ public:
|
|||||||
|
|
||||||
struct XmlReader::XmlReaderData
|
struct XmlReader::XmlReaderData
|
||||||
{
|
{
|
||||||
boost::shared_ptr<TiXmlDocument> doc;
|
shared_ptr<TiXmlDocument> doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
XmlReader::XmlReader()
|
XmlReader::XmlReader()
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#ifndef _XmlReader_incl_
|
#ifndef _XmlReader_incl_
|
||||||
#define _XmlReader_incl_
|
#define _XmlReader_incl_
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
class XmlValue;
|
class XmlValue;
|
||||||
typedef boost::shared_ptr<XmlValue> XmlValuePtr;
|
typedef shared_ptr<XmlValue> XmlValuePtr;
|
||||||
|
|
||||||
class XmlValue
|
class XmlValue
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct XmlReaderData;
|
struct XmlReaderData;
|
||||||
boost::shared_ptr<XmlReaderData> pd;
|
shared_ptr<XmlReaderData> pd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
#ifndef BOOST_VERSIONING_INCL
|
|
||||||
#define BOOST_VERSIONING_INCL
|
|
||||||
|
|
||||||
// This header stores workaround code for dealing with incompatible changes
|
|
||||||
// made to boost archive/serialization classes.
|
|
||||||
|
|
||||||
|
|
||||||
#if (BOOST_VERSION <= 104100)
|
|
||||||
// Easy case, boost archive serial numbers are sizeof(int)
|
|
||||||
BOOST_CLASS_VERSION(EncFSConfig, V6SubVersion)
|
|
||||||
#else
|
|
||||||
// starting with boost 1.42, serial numbers change to 8-bit. However to make
|
|
||||||
// things tricker, the internal comparison is more like 16bit, which makes
|
|
||||||
// writing backward compatible code very tricky.
|
|
||||||
|
|
||||||
// We make a partial specialization of the iserializer class to remove the
|
|
||||||
// version number checking which would otherwise cause boost::serialization to
|
|
||||||
// throw an exception if it came across a version that was greater then what
|
|
||||||
// we specify in BOOST_CLASS_VERSION below. Without this, manual editing
|
|
||||||
// of the file is needed before boost will allow us to read it.
|
|
||||||
|
|
||||||
// See bug http://code.google.com/p/encfs/issues/detail?id=60
|
|
||||||
|
|
||||||
BOOST_CLASS_VERSION(EncFSConfig, 20)
|
|
||||||
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace archive {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
|
|
||||||
// Specialize iserializer class in order to get rid of version check
|
|
||||||
template<class Archive>
|
|
||||||
class iserializer<Archive, EncFSConfig> : public basic_iserializer
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
virtual void destroy(/*const*/ void *address) const {
|
|
||||||
boost::serialization::access::destroy(static_cast<EncFSConfig *>(address));
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
explicit iserializer() :
|
|
||||||
basic_iserializer(
|
|
||||||
boost::serialization::singleton<
|
|
||||||
BOOST_DEDUCED_TYPENAME
|
|
||||||
boost::serialization::type_info_implementation<EncFSConfig>::type
|
|
||||||
>::get_const_instance()
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
public:
|
|
||||||
virtual BOOST_DLLEXPORT void load_object_data(
|
|
||||||
basic_iarchive & ar,
|
|
||||||
void *x,
|
|
||||||
const unsigned int file_version
|
|
||||||
) const BOOST_USED;
|
|
||||||
virtual bool class_info() const {
|
|
||||||
return boost::serialization::implementation_level<EncFSConfig>::value
|
|
||||||
>= boost::serialization::object_class_info;
|
|
||||||
}
|
|
||||||
virtual bool tracking(const unsigned int /* flags */) const {
|
|
||||||
return boost::serialization::tracking_level<EncFSConfig>::value
|
|
||||||
== boost::serialization::track_always
|
|
||||||
|| ( boost::serialization::tracking_level<EncFSConfig>::value
|
|
||||||
== boost::serialization::track_selectively
|
|
||||||
&& serialized_as_pointer());
|
|
||||||
}
|
|
||||||
virtual version_type version() const {
|
|
||||||
return version_type(::boost::serialization::version<EncFSConfig>::value);
|
|
||||||
}
|
|
||||||
virtual bool is_polymorphic() const {
|
|
||||||
return boost::is_polymorphic<EncFSConfig>::value;
|
|
||||||
}
|
|
||||||
virtual ~iserializer(){};
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Archive>
|
|
||||||
BOOST_DLLEXPORT void iserializer<Archive, EncFSConfig>::load_object_data(
|
|
||||||
basic_iarchive & ar,
|
|
||||||
void *x,
|
|
||||||
const unsigned int file_version
|
|
||||||
) const {
|
|
||||||
boost::serialization::serialize_adl(
|
|
||||||
boost::serialization::smart_cast_reference<Archive &>(ar),
|
|
||||||
* static_cast<EncFSConfig *>(x),
|
|
||||||
file_version
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_VERSIONING_INCL
|
|
@ -41,14 +41,21 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#if HAVE_TR1_TUPLE
|
||||||
#include <boost/scoped_array.hpp>
|
#include <tr1/tuple>
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::tr1;
|
||||||
|
#else
|
||||||
|
#include <tuple>
|
||||||
|
using namespace std;
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "DirNode.h"
|
#include "DirNode.h"
|
||||||
#include "MemoryPool.h"
|
#include "MemoryPool.h"
|
||||||
#include "FileUtils.h"
|
#include "FileUtils.h"
|
||||||
#include "Mutex.h"
|
#include "Mutex.h"
|
||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
|
#include "shared_ptr.h"
|
||||||
|
|
||||||
#include <rlog/rlog.h>
|
#include <rlog/rlog.h>
|
||||||
#include <rlog/Error.h>
|
#include <rlog/Error.h>
|
||||||
@ -59,10 +66,8 @@
|
|||||||
|
|
||||||
#define ESUCCESS 0
|
#define ESUCCESS 0
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using rel::Lock;
|
using rel::Lock;
|
||||||
using namespace boost;
|
|
||||||
|
|
||||||
#define GET_FN(ctx, finfo) ctx->getNode((void*)(uintptr_t)finfo->fh)
|
#define GET_FN(ctx, finfo) ctx->getNode((void*)(uintptr_t)finfo->fh)
|
||||||
|
|
||||||
@ -165,16 +170,16 @@ int _do_getattr(FileNode *fnode, struct stat *stbuf)
|
|||||||
if(FSRoot)
|
if(FSRoot)
|
||||||
{
|
{
|
||||||
// determine plaintext link size.. Easiest to read and decrypt..
|
// determine plaintext link size.. Easiest to read and decrypt..
|
||||||
scoped_array<char> buf(new char[stbuf->st_size+1]);
|
vector<char> buf(stbuf->st_size+1, 0);
|
||||||
|
|
||||||
res = ::readlink( fnode->cipherName(), buf.get(), stbuf->st_size );
|
res = ::readlink( fnode->cipherName(), &buf[0], stbuf->st_size );
|
||||||
if(res >= 0)
|
if(res >= 0)
|
||||||
{
|
{
|
||||||
// other functions expect c-strings to be null-terminated, which
|
// other functions expect c-strings to be null-terminated, which
|
||||||
// readlink doesn't provide
|
// readlink doesn't provide
|
||||||
buf[res] = '\0';
|
buf[res] = '\0';
|
||||||
|
|
||||||
stbuf->st_size = FSRoot->plainPath( buf.get() ).length();
|
stbuf->st_size = FSRoot->plainPath( &buf[0] ).length();
|
||||||
|
|
||||||
res = ESUCCESS;
|
res = ESUCCESS;
|
||||||
} else
|
} else
|
||||||
@ -363,8 +368,8 @@ int encfs_rmdir(const char *path)
|
|||||||
int _do_readlink(EncFS_Context *ctx, const string &cyName,
|
int _do_readlink(EncFS_Context *ctx, const string &cyName,
|
||||||
tuple<char *, size_t> data )
|
tuple<char *, size_t> data )
|
||||||
{
|
{
|
||||||
char *buf = data.get<0>();
|
char *buf = get<0>(data);
|
||||||
size_t size = data.get<1>();
|
size_t size = get<1>(data);
|
||||||
|
|
||||||
int res = ESUCCESS;
|
int res = ESUCCESS;
|
||||||
shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
|
shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
|
||||||
@ -500,7 +505,7 @@ int encfs_chmod(const char *path, mode_t mode)
|
|||||||
int _do_chown(EncFS_Context *, const string &cyName,
|
int _do_chown(EncFS_Context *, const string &cyName,
|
||||||
tuple<uid_t, gid_t> data)
|
tuple<uid_t, gid_t> data)
|
||||||
{
|
{
|
||||||
int res = lchown( cyName.c_str(), data.get<0>(), data.get<1>() );
|
int res = lchown( cyName.c_str(), get<0>(data), get<1>(data) );
|
||||||
return (res == -1) ? -errno : ESUCCESS;
|
return (res == -1) ? -errno : ESUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,7 +638,7 @@ int encfs_release(const char *path, struct fuse_file_info *finfo)
|
|||||||
|
|
||||||
int _do_read(FileNode *fnode, tuple<unsigned char *, size_t, off_t> data)
|
int _do_read(FileNode *fnode, tuple<unsigned char *, size_t, off_t> data)
|
||||||
{
|
{
|
||||||
return fnode->read( data.get<2>(), data.get<0>(), data.get<1>());
|
return fnode->read( get<2>(data), get<0>(data), get<1>(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
int encfs_read(const char *path, char *buf, size_t size, off_t offset,
|
int encfs_read(const char *path, char *buf, size_t size, off_t offset,
|
||||||
@ -656,8 +661,8 @@ int encfs_fsync(const char *path, int dataSync,
|
|||||||
|
|
||||||
int _do_write(FileNode *fnode, tuple<const char *, size_t, off_t> data)
|
int _do_write(FileNode *fnode, tuple<const char *, size_t, off_t> data)
|
||||||
{
|
{
|
||||||
size_t size = data.get<1>();
|
size_t size = get<1>(data);
|
||||||
if(fnode->write( data.get<2>(), (unsigned char *)data.get<0>(), size ))
|
if(fnode->write( get<2>(data), (unsigned char *)get<0>(data), size ))
|
||||||
return size;
|
return size;
|
||||||
else
|
else
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@ -707,8 +712,8 @@ int _do_setxattr(EncFS_Context *, const string &cyName,
|
|||||||
tuple<const char *, const char *, size_t, uint32_t> data)
|
tuple<const char *, const char *, size_t, uint32_t> data)
|
||||||
{
|
{
|
||||||
int options = 0;
|
int options = 0;
|
||||||
return ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
|
return ::setxattr( cyName.c_str(), get<0>(data), get<1>(data),
|
||||||
data.get<2>(), data.get<3>(), options );
|
get<2>(data), get<3>(data), options );
|
||||||
}
|
}
|
||||||
int encfs_setxattr( const char *path, const char *name,
|
int encfs_setxattr( const char *path, const char *name,
|
||||||
const char *value, size_t size, int flags, uint32_t position )
|
const char *value, size_t size, int flags, uint32_t position )
|
||||||
@ -721,8 +726,8 @@ int encfs_setxattr( const char *path, const char *name,
|
|||||||
int _do_setxattr(EncFS_Context *, const string &cyName,
|
int _do_setxattr(EncFS_Context *, const string &cyName,
|
||||||
tuple<const char *, const char *, size_t, int> data)
|
tuple<const char *, const char *, size_t, int> data)
|
||||||
{
|
{
|
||||||
return ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
|
return ::setxattr( cyName.c_str(), get<0>(data), get<1>(data),
|
||||||
data.get<2>(), data.get<3>() );
|
get<2>(data), get<3>(data) );
|
||||||
}
|
}
|
||||||
int encfs_setxattr( const char *path, const char *name,
|
int encfs_setxattr( const char *path, const char *name,
|
||||||
const char *value, size_t size, int flags )
|
const char *value, size_t size, int flags )
|
||||||
@ -738,8 +743,8 @@ int _do_getxattr(EncFS_Context *, const string &cyName,
|
|||||||
tuple<const char *, void *, size_t, uint32_t> data)
|
tuple<const char *, void *, size_t, uint32_t> data)
|
||||||
{
|
{
|
||||||
int options = 0;
|
int options = 0;
|
||||||
return ::getxattr( cyName.c_str(), data.get<0>(),
|
return ::getxattr( cyName.c_str(), get<0>(data),
|
||||||
data.get<1>(), data.get<2>(), data.get<3>(), options );
|
get<1>(data), get<2>(data), get<3>(data), options );
|
||||||
}
|
}
|
||||||
int encfs_getxattr( const char *path, const char *name,
|
int encfs_getxattr( const char *path, const char *name,
|
||||||
char *value, size_t size, uint32_t position )
|
char *value, size_t size, uint32_t position )
|
||||||
@ -751,8 +756,8 @@ int encfs_getxattr( const char *path, const char *name,
|
|||||||
int _do_getxattr(EncFS_Context *, const string &cyName,
|
int _do_getxattr(EncFS_Context *, const string &cyName,
|
||||||
tuple<const char *, void *, size_t> data)
|
tuple<const char *, void *, size_t> data)
|
||||||
{
|
{
|
||||||
return ::getxattr( cyName.c_str(), data.get<0>(),
|
return ::getxattr( cyName.c_str(), get<0>(data),
|
||||||
data.get<1>(), data.get<2>());
|
get<1>(data), get<2>(data));
|
||||||
}
|
}
|
||||||
int encfs_getxattr( const char *path, const char *name,
|
int encfs_getxattr( const char *path, const char *name,
|
||||||
char *value, size_t size )
|
char *value, size_t size )
|
||||||
@ -768,10 +773,10 @@ int _do_listxattr(EncFS_Context *, const string &cyName,
|
|||||||
{
|
{
|
||||||
#ifdef XATTR_ADD_OPT
|
#ifdef XATTR_ADD_OPT
|
||||||
int options = 0;
|
int options = 0;
|
||||||
int res = ::listxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
|
int res = ::listxattr( cyName.c_str(), get<0>(data), get<1>(data),
|
||||||
options );
|
options );
|
||||||
#else
|
#else
|
||||||
int res = ::listxattr( cyName.c_str(), data.get<0>(), data.get<1>() );
|
int res = ::listxattr( cyName.c_str(), get<0>(data), get<1>(data) );
|
||||||
#endif
|
#endif
|
||||||
return (res == -1) ? -errno : res;
|
return (res == -1) ? -errno : res;
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,6 @@
|
|||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
#include <boost/scoped_array.hpp>
|
|
||||||
|
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
#define NO_DES
|
#define NO_DES
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
@ -55,7 +53,6 @@
|
|||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace gnu;
|
using namespace gnu;
|
||||||
using namespace boost;
|
|
||||||
|
|
||||||
|
|
||||||
static int showInfo( int argc, char **argv );
|
static int showInfo( int argc, char **argv );
|
||||||
@ -472,8 +469,8 @@ static int copyLink(const struct stat &stBuf,
|
|||||||
const shared_ptr<EncFS_Root> &rootInfo,
|
const shared_ptr<EncFS_Root> &rootInfo,
|
||||||
const string &cpath, const string &destName )
|
const string &cpath, const string &destName )
|
||||||
{
|
{
|
||||||
scoped_array<char> buf(new char[stBuf.st_size+1]);
|
vector<char> buf(stBuf.st_size+1, 0);
|
||||||
int res = ::readlink( cpath.c_str(), buf.get(), stBuf.st_size );
|
int res = ::readlink( cpath.c_str(), &buf[0], stBuf.st_size );
|
||||||
if(res == -1)
|
if(res == -1)
|
||||||
{
|
{
|
||||||
cerr << "unable to readlink of " << cpath << "\n";
|
cerr << "unable to readlink of " << cpath << "\n";
|
||||||
@ -481,7 +478,7 @@ static int copyLink(const struct stat &stBuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf[res] = '\0';
|
buf[res] = '\0';
|
||||||
string decodedLink = rootInfo->root->plainPath(buf.get());
|
string decodedLink = rootInfo->root->plainPath(&buf[0]);
|
||||||
|
|
||||||
res = ::symlink( decodedLink.c_str(), destName.c_str() );
|
res = ::symlink( decodedLink.c_str(), destName.c_str() );
|
||||||
if(res == -1)
|
if(res == -1)
|
||||||
|
@ -33,9 +33,6 @@
|
|||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#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>
|
||||||
#include <rlog/RLogChannel.h>
|
#include <rlog/RLogChannel.h>
|
||||||
@ -70,8 +67,6 @@ inline static int MAX(int a, int b)
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
using namespace gnu;
|
using namespace gnu;
|
||||||
using boost::shared_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
|
||||||
// affect how many arguments we can handle, just how many we can pass on..
|
// affect how many arguments we can handle, just how many we can pass on..
|
||||||
@ -501,8 +496,8 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// log to stderr by default..
|
// log to stderr by default..
|
||||||
scoped_ptr<StdioNode> slog( new StdioNode( STDERR_FILENO ) );
|
shared_ptr<StdioNode> slog( new StdioNode( STDERR_FILENO ) );
|
||||||
scoped_ptr<SyslogNode> logNode;
|
shared_ptr<SyslogNode> logNode;
|
||||||
|
|
||||||
// show error and warning output
|
// show error and warning output
|
||||||
slog->subscribeTo( GetGlobalChannel("error") );
|
slog->subscribeTo( GetGlobalChannel("error") );
|
||||||
|
38
encfs/shared_ptr.h
Normal file
38
encfs/shared_ptr.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* 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 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 General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU 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_TR1_MEMORY
|
||||||
|
#include <tr1/memory>
|
||||||
|
using std::tr1::shared_ptr;
|
||||||
|
using std::tr1::dynamic_pointer_cast;
|
||||||
|
#else
|
||||||
|
#include <memory>
|
||||||
|
using std::shared_ptr;
|
||||||
|
using std::dynamic_pointer_cast;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -49,14 +49,17 @@
|
|||||||
|
|
||||||
#include <google/protobuf/text_format.h>
|
#include <google/protobuf/text_format.h>
|
||||||
|
|
||||||
|
#if HAVE_TR1_UNORDERED_SET
|
||||||
#include <tr1/unordered_set>
|
#include <tr1/unordered_set>
|
||||||
|
using std::tr1::unordered_set;
|
||||||
|
#else
|
||||||
|
#include <unordered_set>
|
||||||
|
using std::unordered_set;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rlog;
|
using namespace rlog;
|
||||||
|
|
||||||
using boost::shared_ptr;
|
|
||||||
|
|
||||||
const int FSBlockSize = 256;
|
const int FSBlockSize = 256;
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -171,7 +174,7 @@ bool testNameCoding( DirNode &dirNode, bool verbose,
|
|||||||
cerr << "Checking for name collections, this will take a while..\n";
|
cerr << "Checking for name collections, this will take a while..\n";
|
||||||
// check for collision rate
|
// check for collision rate
|
||||||
char buf[64];
|
char buf[64];
|
||||||
tr1::unordered_set<string> encryptedNames;
|
unordered_set<string> encryptedNames;
|
||||||
for (long i=0; i < 10000000; i++)
|
for (long i=0; i < 10000000; i++)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%li", i);
|
snprintf(buf, sizeof(buf), "%li", i);
|
||||||
|
@ -1,223 +0,0 @@
|
|||||||
# ===========================================================================
|
|
||||||
# http://autoconf-archive.cryp.to/ax_boost_base.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_BOOST_BASE([MINIMUM-VERSION])
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Test for the Boost C++ libraries of a particular version (or newer)
|
|
||||||
#
|
|
||||||
# If no path to the installed boost library is given the macro searchs
|
|
||||||
# under /usr, /usr/local, /opt and /opt/local and evaluates the
|
|
||||||
# $BOOST_ROOT environment variable. Further documentation is available at
|
|
||||||
# <http://randspringer.de/boost/index.html>.
|
|
||||||
#
|
|
||||||
# This macro calls:
|
|
||||||
#
|
|
||||||
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
|
|
||||||
#
|
|
||||||
# And sets:
|
|
||||||
#
|
|
||||||
# HAVE_BOOST
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2008-04-12
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_BOOST_BASE],
|
|
||||||
[
|
|
||||||
AC_ARG_WITH([boost],
|
|
||||||
AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
|
|
||||||
[
|
|
||||||
if test "$withval" = "no"; then
|
|
||||||
want_boost="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
want_boost="yes"
|
|
||||||
ac_boost_path=""
|
|
||||||
else
|
|
||||||
want_boost="yes"
|
|
||||||
ac_boost_path="$withval"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_boost="yes"])
|
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_WITH([boost-libdir],
|
|
||||||
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
|
||||||
[Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
|
|
||||||
[
|
|
||||||
if test -d $withval
|
|
||||||
then
|
|
||||||
ac_boost_lib_path="$withval"
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR(--with-boost-libdir expected directory name)
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[ac_boost_lib_path=""]
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "x$want_boost" = "xyes"; then
|
|
||||||
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
|
||||||
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
|
||||||
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
|
||||||
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
|
||||||
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
|
||||||
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
|
||||||
boost_lib_version_req_sub_minor="0"
|
|
||||||
fi
|
|
||||||
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
|
||||||
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
|
||||||
succeeded=no
|
|
||||||
|
|
||||||
dnl first we check the system location for boost libraries
|
|
||||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
|
||||||
dnl or if you install boost with RPM
|
|
||||||
if test "$ac_boost_path" != ""; then
|
|
||||||
BOOST_LDFLAGS="-L$ac_boost_path/lib"
|
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
|
||||||
else
|
|
||||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
|
||||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
|
||||||
BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
|
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl overwrite ld flags if we have required special directory with
|
|
||||||
dnl --with-boost-libdir parameter
|
|
||||||
if test "$ac_boost_lib_path" != ""; then
|
|
||||||
BOOST_LDFLAGS="-L$ac_boost_lib_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
export CPPFLAGS
|
|
||||||
|
|
||||||
LDFLAGS_SAVED="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
@%:@include <boost/version.hpp>
|
|
||||||
]], [[
|
|
||||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
|
||||||
// Everything is okay
|
|
||||||
#else
|
|
||||||
# error Boost version is too old
|
|
||||||
#endif
|
|
||||||
]])],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
succeeded=yes
|
|
||||||
found_system=yes
|
|
||||||
],[
|
|
||||||
])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl if we found no boost with system layout we search for boost libraries
|
|
||||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
|
||||||
if test "x$succeeded" != "xyes"; then
|
|
||||||
_version=0
|
|
||||||
if test "$ac_boost_path" != ""; then
|
|
||||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
|
||||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
|
||||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
|
||||||
V_CHECK=`expr $_version_tmp \> $_version`
|
|
||||||
if test "$V_CHECK" = "1" ; then
|
|
||||||
_version=$_version_tmp
|
|
||||||
fi
|
|
||||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
|
|
||||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
|
||||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
|
||||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
|
||||||
V_CHECK=`expr $_version_tmp \> $_version`
|
|
||||||
if test "$V_CHECK" = "1" ; then
|
|
||||||
_version=$_version_tmp
|
|
||||||
best_path=$ac_boost_path
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
|
||||||
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
|
||||||
if test "$ac_boost_lib_path" = ""
|
|
||||||
then
|
|
||||||
BOOST_LDFLAGS="-L$best_path/lib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$BOOST_ROOT" != "x"; then
|
|
||||||
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
|
|
||||||
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
|
|
||||||
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
|
||||||
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
|
||||||
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
|
||||||
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
|
|
||||||
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
|
||||||
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
|
||||||
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
export CPPFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
@%:@include <boost/version.hpp>
|
|
||||||
]], [[
|
|
||||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
|
||||||
// Everything is okay
|
|
||||||
#else
|
|
||||||
# error Boost version is too old
|
|
||||||
#endif
|
|
||||||
]])],[
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
succeeded=yes
|
|
||||||
found_system=yes
|
|
||||||
],[
|
|
||||||
])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$succeeded" != "yes" ; then
|
|
||||||
if test "$_version" = "0" ; then
|
|
||||||
AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
|
||||||
else
|
|
||||||
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_SUBST(BOOST_CPPFLAGS)
|
|
||||||
AC_SUBST(BOOST_LDFLAGS)
|
|
||||||
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
|
||||||
LDFLAGS="$LDFLAGS_SAVED"
|
|
||||||
fi
|
|
||||||
|
|
||||||
])
|
|
@ -1,118 +0,0 @@
|
|||||||
# ===========================================================================
|
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_BOOST_FILESYSTEM
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Test for Filesystem library from the Boost C++ libraries. The macro
|
|
||||||
# requires a preceding call to AX_BOOST_BASE. Further documentation is
|
|
||||||
# available at <http://randspringer.de/boost/index.html>.
|
|
||||||
#
|
|
||||||
# This macro calls:
|
|
||||||
#
|
|
||||||
# AC_SUBST(BOOST_FILESYSTEM_LIB)
|
|
||||||
#
|
|
||||||
# And sets:
|
|
||||||
#
|
|
||||||
# HAVE_BOOST_FILESYSTEM
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
|
|
||||||
# Copyright (c) 2009 Michael Tindal
|
|
||||||
# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
#serial 22
|
|
||||||
|
|
||||||
AC_DEFUN([AX_BOOST_FILESYSTEM],
|
|
||||||
[
|
|
||||||
AC_ARG_WITH([boost-filesystem],
|
|
||||||
AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
|
|
||||||
[use the Filesystem library from boost - it is possible to specify a certain library for the linker
|
|
||||||
e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
|
|
||||||
[
|
|
||||||
if test "$withval" = "no"; then
|
|
||||||
want_boost="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
want_boost="yes"
|
|
||||||
ax_boost_user_filesystem_lib=""
|
|
||||||
else
|
|
||||||
want_boost="yes"
|
|
||||||
ax_boost_user_filesystem_lib="$withval"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_boost="yes"]
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "x$want_boost" = "xyes"; then
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
export CPPFLAGS
|
|
||||||
|
|
||||||
LDFLAGS_SAVED="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
LIBS_SAVED=$LIBS
|
|
||||||
LIBS="$LIBS $BOOST_SYSTEM_LIB"
|
|
||||||
export LIBS
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
|
|
||||||
ax_cv_boost_filesystem,
|
|
||||||
[AC_LANG_PUSH([C++])
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
|
|
||||||
[[using namespace boost::filesystem;
|
|
||||||
path my_path( "foo/bar/data.txt" );
|
|
||||||
return 0;]])],
|
|
||||||
ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
])
|
|
||||||
if test "x$ax_cv_boost_filesystem" = "xyes"; then
|
|
||||||
AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
|
|
||||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
|
||||||
if test "x$ax_boost_user_filesystem_lib" = "x"; then
|
|
||||||
for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.so* $BOOSTLIBDIR/libboost_filesystem*.dylib* $BOOSTLIBDIR/libboost_filesystem*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do
|
|
||||||
ax_lib=${libextension}
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
|
|
||||||
[link_filesystem="no"])
|
|
||||||
done
|
|
||||||
if test "x$link_filesystem" != "xyes"; then
|
|
||||||
for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do
|
|
||||||
ax_lib=${libextension}
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
|
|
||||||
[link_filesystem="no"])
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
|
|
||||||
[link_filesystem="no"])
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test "x$ax_lib" = "x"; then
|
|
||||||
AC_MSG_ERROR(Could not find a version of the library!)
|
|
||||||
fi
|
|
||||||
if test "x$link_filesystem" != "xyes"; then
|
|
||||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
|
||||||
LDFLAGS="$LDFLAGS_SAVED"
|
|
||||||
LIBS="$LIBS_SAVED"
|
|
||||||
fi
|
|
||||||
])
|
|
@ -1,117 +0,0 @@
|
|||||||
# ===========================================================================
|
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_serialization.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_BOOST_SERIALIZATION
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Test for Serialization library from the Boost C++ libraries. The macro
|
|
||||||
# requires a preceding call to AX_BOOST_BASE. Further documentation is
|
|
||||||
# available at <http://randspringer.de/boost/index.html>.
|
|
||||||
#
|
|
||||||
# This macro calls:
|
|
||||||
#
|
|
||||||
# AC_SUBST(BOOST_SERIALIZATION_LIB)
|
|
||||||
#
|
|
||||||
# And sets:
|
|
||||||
#
|
|
||||||
# HAVE_BOOST_SERIALIZATION
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
#serial 18
|
|
||||||
|
|
||||||
AC_DEFUN([AX_BOOST_SERIALIZATION],
|
|
||||||
[
|
|
||||||
AC_ARG_WITH([boost-serialization],
|
|
||||||
AS_HELP_STRING([--with-boost-serialization@<:@=special-lib@:>@],
|
|
||||||
[use the Serialization library from boost - it is possible to specify a certain library for the linker
|
|
||||||
e.g. --with-boost-serialization=boost_serialization-gcc-mt-d-1_33_1 ]),
|
|
||||||
[
|
|
||||||
if test "$withval" = "no"; then
|
|
||||||
want_boost="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
want_boost="yes"
|
|
||||||
ax_boost_user_serialization_lib=""
|
|
||||||
else
|
|
||||||
want_boost="yes"
|
|
||||||
ax_boost_user_serialization_lib="$withval"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_boost="yes"]
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "x$want_boost" = "xyes"; then
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
AC_MSG_WARN(BOOST_CPPFLAGS $BOOST_CPPFLAGS)
|
|
||||||
export CPPFLAGS
|
|
||||||
|
|
||||||
LDFLAGS_SAVED="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(whether the Boost::Serialization library is available,
|
|
||||||
ax_cv_boost_serialization,
|
|
||||||
[AC_LANG_PUSH([C++])
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <fstream>
|
|
||||||
@%:@include <boost/archive/text_oarchive.hpp>
|
|
||||||
@%:@include <boost/archive/text_iarchive.hpp>
|
|
||||||
]],
|
|
||||||
[[std::ofstream ofs("filename");
|
|
||||||
boost::archive::text_oarchive oa(ofs);
|
|
||||||
return 0;
|
|
||||||
]])],
|
|
||||||
ax_cv_boost_serialization=yes, ax_cv_boost_serialization=no)
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
])
|
|
||||||
if test "x$ax_cv_boost_serialization" = "xyes"; then
|
|
||||||
AC_DEFINE(HAVE_BOOST_SERIALIZATION,,[define if the Boost::Serialization library is available])
|
|
||||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
|
||||||
if test "x$ax_boost_user_serialization_lib" = "x"; then
|
|
||||||
for libextension in `ls $BOOSTLIBDIR/libboost_serialization*.so* $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.so.*$;\1;' -e 's;^lib\(boost_serialization.*\)\.a*$;\1;'` ; do
|
|
||||||
ax_lib=${libextension}
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break],
|
|
||||||
[link_serialization="no"])
|
|
||||||
done
|
|
||||||
if test "x$link_serialization" != "xyes"; then
|
|
||||||
for libextension in `ls $BOOSTLIBDIR/boost_serialization*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.dll.*$;\1;' -e 's;^\(boost_serialization.*\)\.a*$;\1;'` ; do
|
|
||||||
ax_lib=${libextension}
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break],
|
|
||||||
[link_serialization="no"])
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
for ax_lib in $ax_boost_user_serialization_lib boost_serialization-$ax_boost_user_serialization_lib; do
|
|
||||||
AC_CHECK_LIB($ax_lib, main,
|
|
||||||
[BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break],
|
|
||||||
[link_serialization="no"])
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test "x$ax_lib" = "x"; then
|
|
||||||
AC_MSG_ERROR(Could not find a version of the library!)
|
|
||||||
fi
|
|
||||||
if test "x$link_serialization" != "xyes"; then
|
|
||||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
|
||||||
LDFLAGS="$LDFLAGS_SAVED"
|
|
||||||
fi
|
|
||||||
])
|
|
@ -1,120 +0,0 @@
|
|||||||
# ===========================================================================
|
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_BOOST_SYSTEM
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Test for System library from the Boost C++ libraries. The macro requires
|
|
||||||
# a preceding call to AX_BOOST_BASE. Further documentation is available at
|
|
||||||
# <http://randspringer.de/boost/index.html>.
|
|
||||||
#
|
|
||||||
# This macro calls:
|
|
||||||
#
|
|
||||||
# AC_SUBST(BOOST_SYSTEM_LIB)
|
|
||||||
#
|
|
||||||
# And sets:
|
|
||||||
#
|
|
||||||
# HAVE_BOOST_SYSTEM
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
|
||||||
# Copyright (c) 2008 Michael Tindal
|
|
||||||
# Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
#serial 14
|
|
||||||
|
|
||||||
AC_DEFUN([AX_BOOST_SYSTEM],
|
|
||||||
[
|
|
||||||
AC_ARG_WITH([boost-system],
|
|
||||||
AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
|
|
||||||
[use the System library from boost - it is possible to specify a certain library for the linker
|
|
||||||
e.g. --with-boost-system=boost_system-gcc-mt ]),
|
|
||||||
[
|
|
||||||
if test "$withval" = "no"; then
|
|
||||||
want_boost="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
want_boost="yes"
|
|
||||||
ax_boost_user_system_lib=""
|
|
||||||
else
|
|
||||||
want_boost="yes"
|
|
||||||
ax_boost_user_system_lib="$withval"
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[want_boost="yes"]
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "x$want_boost" = "xyes"; then
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_REQUIRE([AC_CANONICAL_BUILD])
|
|
||||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
|
||||||
export CPPFLAGS
|
|
||||||
|
|
||||||
LDFLAGS_SAVED="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
|
||||||
export LDFLAGS
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(whether the Boost::System library is available,
|
|
||||||
ax_cv_boost_system,
|
|
||||||
[AC_LANG_PUSH([C++])
|
|
||||||
CXXFLAGS_SAVE=$CXXFLAGS
|
|
||||||
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
|
|
||||||
[[boost::system::system_category]])],
|
|
||||||
ax_cv_boost_system=yes, ax_cv_boost_system=no)
|
|
||||||
CXXFLAGS=$CXXFLAGS_SAVE
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
])
|
|
||||||
if test "x$ax_cv_boost_system" = "xyes"; then
|
|
||||||
AC_SUBST(BOOST_CPPFLAGS)
|
|
||||||
|
|
||||||
AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
|
|
||||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
|
||||||
|
|
||||||
LDFLAGS_SAVE=$LDFLAGS
|
|
||||||
if test "x$ax_boost_user_system_lib" = "x"; then
|
|
||||||
for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do
|
|
||||||
ax_lib=${libextension}
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
|
||||||
[link_system="no"])
|
|
||||||
done
|
|
||||||
if test "x$link_system" != "xyes"; then
|
|
||||||
for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
|
|
||||||
ax_lib=${libextension}
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
|
||||||
[link_system="no"])
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
|
|
||||||
AC_CHECK_LIB($ax_lib, exit,
|
|
||||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
|
||||||
[link_system="no"])
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test "x$ax_lib" = "x"; then
|
|
||||||
AC_MSG_ERROR(Could not find a version of the library!)
|
|
||||||
fi
|
|
||||||
if test "x$link_system" = "xno"; then
|
|
||||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
|
||||||
LDFLAGS="$LDFLAGS_SAVED"
|
|
||||||
fi
|
|
||||||
])
|
|
Loading…
Reference in New Issue
Block a user