forked from jollyjinx/encfs.macosx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
encfs.rb
1306 lines (1126 loc) · 44.6 KB
/
encfs.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
require 'formula'
class Encfs < Formula
version "1.7.4p4"
homepage 'http://www.arg0.net/encfs'
url 'http://encfs.googlecode.com/files/encfs-1.7.4.tgz'
sha1 '3d824ba188dbaabdc9e36621afb72c651e6e2945'
depends_on 'pkg-config' => :build
depends_on 'gettext'
depends_on 'boost'
depends_on 'rlog'
depends_on 'osxfuse'
def patches
# fixes link times and xattr on links for mac os x
DATA
end
def install
ENV['CPPFLAGS'] = "-I#{HOMEBREW_PREFIX}/include/osxfuse -I#{Formula.factory('gettext').include}"
ENV['LDFLAGS'] = "-L#{Formula.factory('gettext').lib}"
system "mkdir encfs/sys"
system "cp \"$HOMEBREW_SDKROOT/usr/include/sys/_endian.h\" encfs/sys/endian.h"
inreplace "configure", "-lfuse", "-losxfuse"
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-boost=#{HOMEBREW_PREFIX}"
system "make"
system "make install"
end
def caveats; <<-EOS.undent
Make sure to follow the directions given by 'brew info osxfuse'
before trying to use a FUSE-based file system.
EOS
end
end
__END__
diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp
index dac15bd..911728a 100644
--- a/encfs/encfs.cpp
+++ b/encfs/encfs.cpp
@@ -489,7 +489,11 @@ int encfs_rename(const char *from, const char *to)
int _do_chmod(EncFS_Context *, const string &cipherPath, mode_t mode)
{
+#ifdef __APPLE__
+ return lchmod( cipherPath.c_str(), mode );
+#else
return chmod( cipherPath.c_str(), mode );
+#endif
}
int encfs_chmod(const char *path, mode_t mode)
@@ -706,7 +710,11 @@ int encfs_statfs(const char *path, struct statvfs *st)
int _do_setxattr(EncFS_Context *, const string &cyName,
tuple<const char *, const char *, size_t, uint32_t> data)
{
- int options = 0;
+#ifdef __APPLE__
+ int options = XATTR_NOFOLLOW;
+#else
+ int options = 0;
+#endif
return ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(),
data.get<2>(), data.get<3>(), options );
}
diff --git a/configure.ac b/configure.ac
index 72d3b9b..2307f42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(encfs/encfs.h) dnl a source file from your sub dir
-AM_INIT_AUTOMAKE(encfs, 1.7.4) dnl searches for some needed programs
+AM_INIT_AUTOMAKE(encfs, 1.7.4p4) dnl searches for some needed programs
AC_CANONICAL_HOST
AM_CONDITIONAL([DARWIN],
diff --git a/configure b/configure
index 91b8f15..1bec2e8 100755
--- a/configure
+++ b/configure
@@ -2990,7 +3003,7 @@ fi
# Define the identity of the package.
PACKAGE=encfs
- VERSION=1.7.4
+ VERSION=1.7.4p4
diff --git a/encfs/BlockNameIO.cpp b/encfs/BlockNameIO.cpp
index 27a210b..d4f7855 100644
--- a/encfs/BlockNameIO.cpp
+++ b/encfs/BlockNameIO.cpp
@@ -34,14 +34,14 @@ using namespace boost;
static RLogChannel * Info = DEF_CHANNEL( "info/nameio", Log_Info );
-static shared_ptr<NameIO> NewBlockNameIO( const Interface &iface,
- const shared_ptr<Cipher> &cipher, const CipherKey &key )
+static boost::shared_ptr<NameIO> NewBlockNameIO( const Interface &iface,
+ const boost::shared_ptr<Cipher> &cipher, const CipherKey &key )
{
int blockSize = 8;
if(cipher)
blockSize = cipher->cipherBlockSize();
- return shared_ptr<NameIO>( new BlockNameIO( iface, cipher, key, blockSize));
+ return boost::shared_ptr<NameIO>( new BlockNameIO( iface, cipher, key, blockSize));
}
static bool BlockIO_registered = NameIO::Register("Block",
@@ -72,7 +72,7 @@ Interface BlockNameIO::CurrentInterface()
}
BlockNameIO::BlockNameIO( const rel::Interface &iface,
- const shared_ptr<Cipher> &cipher,
+ const boost::shared_ptr<Cipher> &cipher,
const CipherKey &key, int blockSize )
: _interface( iface.current() )
, _bs( blockSize )
diff --git a/encfs/Cipher.cpp b/encfs/Cipher.cpp
index fe00b3a..1445d9d 100644
--- a/encfs/Cipher.cpp
+++ b/encfs/Cipher.cpp
@@ -35,7 +35,6 @@
using namespace std;
using namespace rel;
-using boost::shared_ptr;
#define REF_MODULE(TYPE) \
if( !TYPE::Enabled() ) \
@@ -121,9 +120,9 @@ bool Cipher::Register(const char *name, const char *description,
return true;
}
-shared_ptr<Cipher> Cipher::New(const string &name, int keyLen)
+boost::shared_ptr<Cipher> Cipher::New(const string &name, int keyLen)
{
- shared_ptr<Cipher> result;
+ boost::shared_ptr<Cipher> result;
if(gCipherMap)
{
@@ -139,9 +138,9 @@ shared_ptr<Cipher> Cipher::New(const string &name, int keyLen)
return result;
}
-shared_ptr<Cipher> Cipher::New( const Interface &iface, int keyLen )
+boost::shared_ptr<Cipher> Cipher::New( const Interface &iface, int keyLen )
{
- shared_ptr<Cipher> result;
+ boost::shared_ptr<Cipher> result;
if(gCipherMap)
{
CipherMap_t::const_iterator it;
diff --git a/encfs/CipherFileIO.cpp b/encfs/CipherFileIO.cpp
index 11e97a0..6dedbb5 100644
--- a/encfs/CipherFileIO.cpp
+++ b/encfs/CipherFileIO.cpp
@@ -26,8 +26,6 @@
#include <fcntl.h>
#include <cerrno>
-using boost::shared_ptr;
-
/*
- Version 2:0 adds support for a per-file initialization vector with a
fixed 8 byte header. The headers are enabled globally within a
@@ -49,7 +47,7 @@ static bool checkSize( int fsBlockSize, int cipherBlockSize )
return false;
}
-CipherFileIO::CipherFileIO( const shared_ptr<FileIO> &_base,
+CipherFileIO::CipherFileIO( const boost::shared_ptr<FileIO> &_base,
const FSConfigPtr &cfg)
: BlockFileIO( cfg->config->blockSize, cfg )
, base( _base )
diff --git a/encfs/Context.cpp b/encfs/Context.cpp
index 3ab8435..493703a 100644
--- a/encfs/Context.cpp
+++ b/encfs/Context.cpp
@@ -48,9 +48,9 @@ EncFS_Context::~EncFS_Context()
openFiles.clear();
}
-shared_ptr<DirNode> EncFS_Context::getRoot(int *errCode)
+boost::shared_ptr<DirNode> EncFS_Context::getRoot(int *errCode)
{
- shared_ptr<DirNode> ret;
+ boost::shared_ptr<DirNode> ret;
do
{
{
@@ -73,7 +73,7 @@ shared_ptr<DirNode> EncFS_Context::getRoot(int *errCode)
return ret;
}
-void EncFS_Context::setRoot(const shared_ptr<DirNode> &r)
+void EncFS_Context::setRoot(const boost::shared_ptr<DirNode> &r)
{
Lock lock( contextMutex );
@@ -104,7 +104,7 @@ int EncFS_Context::openFileCount() const
return openFiles.size();
}
-shared_ptr<FileNode> EncFS_Context::lookupNode(const char *path)
+boost::shared_ptr<FileNode> EncFS_Context::lookupNode(const char *path)
{
Lock lock( contextMutex );
@@ -116,7 +116,7 @@ shared_ptr<FileNode> EncFS_Context::lookupNode(const char *path)
return (*it->second.begin())->node;
} else
{
- return shared_ptr<FileNode>();
+ return boost::shared_ptr<FileNode>();
}
}
@@ -133,7 +133,7 @@ void EncFS_Context::renameNode(const char *from, const char *to)
}
}
-shared_ptr<FileNode> EncFS_Context::getNode(void *pl)
+boost::shared_ptr<FileNode> EncFS_Context::getNode(void *pl)
{
Placeholder *ph = (Placeholder*)pl;
return ph->node;
diff --git a/encfs/DirNode.cpp b/encfs/DirNode.cpp
index 91a6580..cea3c7b 100644
--- a/encfs/DirNode.cpp
+++ b/encfs/DirNode.cpp
@@ -57,8 +57,8 @@ public:
};
-DirTraverse::DirTraverse(const shared_ptr<DIR> &_dirPtr,
- uint64_t _iv, const shared_ptr<NameIO> &_naming)
+DirTraverse::DirTraverse(const boost::shared_ptr<DIR> &_dirPtr,
+ uint64_t _iv, const boost::shared_ptr<NameIO> &_naming)
: dir( _dirPtr )
, iv( _iv )
, naming( _naming )
@@ -89,7 +89,7 @@ DirTraverse::~DirTraverse()
}
static
-bool _nextName(struct dirent *&de, const shared_ptr<DIR> &dir,
+bool _nextName(struct dirent *&de, const boost::shared_ptr<DIR> &dir,
int *fileType, ino_t *inode)
{
de = ::readdir( dir.get() );
@@ -173,11 +173,11 @@ class RenameOp
{
private:
DirNode *dn;
- shared_ptr< list<RenameEl> > renameList;
+ boost::shared_ptr< list<RenameEl> > renameList;
list<RenameEl>::const_iterator last;
public:
- RenameOp( DirNode *_dn, const shared_ptr< list<RenameEl> > &_renameList )
+ RenameOp( DirNode *_dn, const boost::shared_ptr< list<RenameEl> > &_renameList )
: dn(_dn), renameList(_renameList)
{
last = renameList->begin();
@@ -415,10 +415,10 @@ DirTraverse DirNode::openDir(const char *plaintextPath)
if(dir == NULL)
{
rDebug("opendir error %s", strerror(errno));
- return DirTraverse( shared_ptr<DIR>(), 0, shared_ptr<NameIO>() );
+ return DirTraverse( boost::shared_ptr<DIR>(), 0, boost::shared_ptr<NameIO>() );
} else
{
- shared_ptr<DIR> dp( dir, DirDeleter() );
+ boost::shared_ptr<DIR> dp( dir, DirDeleter() );
uint64_t iv = 0;
// if we're using chained IV mode, then compute the IV at this
@@ -454,7 +454,7 @@ bool DirNode::genRenameList( list<RenameEl> &renameList,
// generate the real destination path, where we expect to find the files..
rDebug("opendir %s", sourcePath.c_str() );
- shared_ptr<DIR> dir = shared_ptr<DIR>(
+ boost::shared_ptr<DIR> dir = boost::shared_ptr<DIR>(
opendir( sourcePath.c_str() ), DirDeleter() );
if(!dir)
return false;
@@ -556,18 +556,18 @@ bool DirNode::genRenameList( list<RenameEl> &renameList,
Returns a list of renamed items on success, a null list on failure.
*/
-shared_ptr<RenameOp>
+boost::shared_ptr<RenameOp>
DirNode::newRenameOp( const char *fromP, const char *toP )
{
// Do the rename in two stages to avoid chasing our tail
// Undo everything if we encounter an error!
- shared_ptr< list<RenameEl> > renameList(new list<RenameEl>);
+ boost::shared_ptr< list<RenameEl> > renameList(new list<RenameEl>);
if(!genRenameList( *renameList.get(), fromP, toP ))
{
rWarning("Error during generation of recursive rename list");
- return shared_ptr<RenameOp>();
+ return boost::shared_ptr<RenameOp>();
} else
- return shared_ptr<RenameOp>( new RenameOp(this, renameList) );
+ return boost::shared_ptr<RenameOp>( new RenameOp(this, renameList) );
}
@@ -618,9 +618,9 @@ DirNode::rename( const char *fromPlaintext, const char *toPlaintext )
rLog( Info, "rename %s -> %s", fromCName.c_str(), toCName.c_str() );
- shared_ptr<FileNode> toNode = findOrCreate( toPlaintext );
+ boost::shared_ptr<FileNode> toNode = findOrCreate( toPlaintext );
- shared_ptr<RenameOp> renameOp;
+ boost::shared_ptr<RenameOp> renameOp;
if( hasDirectoryNameDependency() && isDirectory( fromCName.c_str() ))
{
rLog( Info, "recursive rename begin" );
@@ -709,15 +709,15 @@ int DirNode::link( const char *from, const char *to )
The node is keyed by filename, so a rename means the internal node names
must be changed.
*/
-shared_ptr<FileNode> DirNode::renameNode( const char *from, const char *to )
+boost::shared_ptr<FileNode> DirNode::renameNode( const char *from, const char *to )
{
return renameNode( from, to, true );
}
-shared_ptr<FileNode> DirNode::renameNode( const char *from, const char *to,
+boost::shared_ptr<FileNode> DirNode::renameNode( const char *from, const char *to,
bool forwardMode )
{
- shared_ptr<FileNode> node = findOrCreate( from );
+ boost::shared_ptr<FileNode> node = findOrCreate( from );
if(node)
{
@@ -742,17 +742,17 @@ shared_ptr<FileNode> DirNode::renameNode( const char *from, const char *to,
return node;
}
-shared_ptr<FileNode> DirNode::directLookup( const char *path )
+boost::shared_ptr<FileNode> DirNode::directLookup( const char *path )
{
- return shared_ptr<FileNode>(
+ return boost::shared_ptr<FileNode>(
new FileNode( this,
fsConfig,
"unknown", path ));
}
-shared_ptr<FileNode> DirNode::findOrCreate( const char *plainName)
+boost::shared_ptr<FileNode> DirNode::findOrCreate( const char *plainName)
{
- shared_ptr<FileNode> node;
+ boost::shared_ptr<FileNode> node;
if(ctx)
node = ctx->lookupNode( plainName );
@@ -773,13 +773,13 @@ shared_ptr<FileNode> DirNode::findOrCreate( const char *plainName)
return node;
}
-shared_ptr<FileNode>
+boost::shared_ptr<FileNode>
DirNode::lookupNode( const char *plainName, const char * requestor )
{
(void)requestor;
Lock _lock( mutex );
- shared_ptr<FileNode> node = findOrCreate( plainName );
+ boost::shared_ptr<FileNode> node = findOrCreate( plainName );
return node;
}
@@ -789,7 +789,7 @@ DirNode::lookupNode( const char *plainName, const char * requestor )
node on sucess.. This is done in one step to avoid any race conditions
with the stored state of the file.
*/
-shared_ptr<FileNode>
+boost::shared_ptr<FileNode>
DirNode::openNode( const char *plainName, const char * requestor, int flags,
int *result )
{
@@ -797,12 +797,12 @@ DirNode::openNode( const char *plainName, const char * requestor, int flags,
rAssert( result != NULL );
Lock _lock( mutex );
- shared_ptr<FileNode> node = findOrCreate( plainName );
+ boost::shared_ptr<FileNode> node = findOrCreate( plainName );
if( node && (*result = node->open( flags )) >= 0 )
return node;
else
- return shared_ptr<FileNode>();
+ return boost::shared_ptr<FileNode>();
}
int DirNode::unlink( const char *plaintextName )
diff --git a/encfs/FileNode.cpp b/encfs/FileNode.cpp
index 4d15037..938f43b 100644
--- a/encfs/FileNode.cpp
+++ b/encfs/FileNode.cpp
@@ -77,11 +77,11 @@ FileNode::FileNode(DirNode *parent_, const FSConfigPtr &cfg,
this->fsConfig = cfg;
// chain RawFileIO & CipherFileIO
- shared_ptr<FileIO> rawIO( new RawFileIO( _cname ) );
- io = shared_ptr<FileIO>( new CipherFileIO( rawIO, fsConfig ));
+ boost::shared_ptr<FileIO> rawIO( new RawFileIO( _cname ) );
+ io = boost::shared_ptr<FileIO>( new CipherFileIO( rawIO, fsConfig ));
if(cfg->config->blockMACBytes || cfg->config->blockMACRandBytes)
- io = shared_ptr<FileIO>(new MACFileIO(io, fsConfig));
+ io = boost::shared_ptr<FileIO>(new MACFileIO(io, fsConfig));
}
FileNode::~FileNode()
@@ -111,7 +111,7 @@ string FileNode::plaintextParent() const
return parentDirectory( _pname );
}
-static bool setIV(const shared_ptr<FileIO> &io, uint64_t iv)
+static bool setIV(const boost::shared_ptr<FileIO> &io, uint64_t iv)
{
struct stat stbuf;
if((io->getAttr(&stbuf) < 0) || S_ISREG(stbuf.st_mode))
diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp
index 32afb5d..3839a87 100644
--- a/encfs/FileUtils.cpp
+++ b/encfs/FileUtils.cpp
@@ -967,7 +967,7 @@ bool selectZeroBlockPassThrough()
}
RootPtr createV6Config( EncFS_Context *ctx,
- const shared_ptr<EncFS_Opts> &opts )
+ const boost::shared_ptr<EncFS_Opts> &opts )
{
const std::string rootDir = opts->rootDir;
bool enableIdleTracking = opts->idleTracking;
@@ -1111,7 +1111,7 @@ RootPtr createV6Config( EncFS_Context *ctx,
}
}
- shared_ptr<Cipher> cipher = Cipher::New( alg.name, keySize );
+ boost::shared_ptr<Cipher> cipher = Cipher::New( alg.name, keySize );
if(!cipher)
{
rError(_("Unable to instanciate cipher %s, key size %i, block size %i"),
@@ -1123,7 +1123,7 @@ RootPtr createV6Config( EncFS_Context *ctx,
alg.name.c_str(), keySize, blockSize);
}
- shared_ptr<EncFSConfig> config( new EncFSConfig );
+ boost::shared_ptr<EncFSConfig> config( new EncFSConfig );
config->cfgType = Config_V6;
config->cipherIface = cipher->interface();
@@ -1202,7 +1202,7 @@ RootPtr createV6Config( EncFS_Context *ctx,
return rootInfo;
// fill in config struct
- shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
+ boost::shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
cipher, volumeKey );
if(!nameCoder)
{
@@ -1228,7 +1228,7 @@ RootPtr createV6Config( EncFS_Context *ctx,
rootInfo = RootPtr( new EncFS_Root );
rootInfo->cipher = cipher;
rootInfo->volumeKey = volumeKey;
- rootInfo->root = shared_ptr<DirNode>(
+ rootInfo->root = boost::shared_ptr<DirNode>(
new DirNode( ctx, rootDir, fsConfig ));
return rootInfo;
@@ -1236,7 +1236,7 @@ RootPtr createV6Config( EncFS_Context *ctx,
void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
{
- shared_ptr<Cipher> cipher = Cipher::New( config->cipherIface, -1 );
+ boost::shared_ptr<Cipher> cipher = Cipher::New( config->cipherIface, -1 );
{
cout << autosprintf(
// xgroup(diag)
@@ -1266,7 +1266,7 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
config->nameIface.revision(), config->nameIface.age());
// check if we support the filename encoding interface..
- shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
+ boost::shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
cipher, CipherKey() );
if(!nameCoder)
{
@@ -1349,7 +1349,7 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
cout << "\n";
}
-shared_ptr<Cipher> EncFSConfig::getCipher() const
+boost::shared_ptr<Cipher> EncFSConfig::getCipher() const
{
return Cipher::New( cipherIface, keySize );
}
@@ -1382,7 +1382,7 @@ unsigned char *EncFSConfig::getSaltData() const
CipherKey EncFSConfig::makeKey(const char *password, int passwdLen)
{
CipherKey userKey;
- shared_ptr<Cipher> cipher = getCipher();
+ boost::shared_ptr<Cipher> cipher = getCipher();
// if no salt is set and we're creating a new password for a new
// FS type, then initialize salt..
@@ -1580,7 +1580,7 @@ CipherKey EncFSConfig::getNewUserKey()
return userKey;
}
-RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
+RootPtr initFS( EncFS_Context *ctx, const boost::shared_ptr<EncFS_Opts> &opts )
{
RootPtr rootInfo;
boost::shared_ptr<EncFSConfig> config(new EncFSConfig);
@@ -1599,7 +1599,7 @@ RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
}
// first, instanciate the cipher.
- shared_ptr<Cipher> cipher = config->getCipher();
+ boost::shared_ptr<Cipher> cipher = config->getCipher();
if(!cipher)
{
rError(_("Unable to find cipher %s, version %i:%i:%i"),
@@ -1638,7 +1638,7 @@ RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
return rootInfo;
}
- shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
+ boost::shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
cipher, volumeKey );
if(!nameCoder)
{
@@ -1668,7 +1668,7 @@ RootPtr initFS( EncFS_Context *ctx, const shared_ptr<EncFS_Opts> &opts )
rootInfo = RootPtr( new EncFS_Root );
rootInfo->cipher = cipher;
rootInfo->volumeKey = volumeKey;
- rootInfo->root = shared_ptr<DirNode>(
+ rootInfo->root = boost::shared_ptr<DirNode>(
new DirNode( ctx, opts->rootDir, fsConfig ));
} else
{
diff --git a/encfs/MACFileIO.cpp b/encfs/MACFileIO.cpp
index 816e64b..d281a40 100644
--- a/encfs/MACFileIO.cpp
+++ b/encfs/MACFileIO.cpp
@@ -57,7 +57,7 @@ int dataBlockSize(const FSConfigPtr &cfg)
- cfg->config->blockMACRandBytes;
}
-MACFileIO::MACFileIO( const shared_ptr<FileIO> &_base,
+MACFileIO::MACFileIO( const boost::shared_ptr<FileIO> &_base,
const FSConfigPtr &cfg )
: BlockFileIO( dataBlockSize( cfg ), cfg )
, base( _base )
diff --git a/encfs/NameIO.cpp b/encfs/NameIO.cpp
index a13694f..e6eed70 100644
--- a/encfs/NameIO.cpp
+++ b/encfs/NameIO.cpp
@@ -104,10 +104,10 @@ bool NameIO::Register( const char *name, const char *description,
return true;
}
-shared_ptr<NameIO> NameIO::New( const string &name,
- const shared_ptr<Cipher> &cipher, const CipherKey &key)
+boost::shared_ptr<NameIO> NameIO::New( const string &name,
+ const boost::shared_ptr<Cipher> &cipher, const CipherKey &key)
{
- shared_ptr<NameIO> result;
+ boost::shared_ptr<NameIO> result;
if(gNameIOMap)
{
NameIOMap_t::const_iterator it = gNameIOMap->find( name );
@@ -120,10 +120,10 @@ shared_ptr<NameIO> NameIO::New( const string &name,
return result;
}
-shared_ptr<NameIO> NameIO::New( const Interface &iface,
- const shared_ptr<Cipher> &cipher, const CipherKey &key )
+boost::shared_ptr<NameIO> NameIO::New( const Interface &iface,
+ const boost::shared_ptr<Cipher> &cipher, const CipherKey &key )
{
- shared_ptr<NameIO> result;
+ boost::shared_ptr<NameIO> result;
if(gNameIOMap)
{
NameIOMap_t::const_iterator it;
diff --git a/encfs/NullCipher.cpp b/encfs/NullCipher.cpp
index fa6ca72..d5391be 100644
--- a/encfs/NullCipher.cpp
+++ b/encfs/NullCipher.cpp
@@ -28,7 +28,6 @@
using namespace std;
using namespace rel;
using namespace rlog;
-using boost::shared_ptr;
using boost::dynamic_pointer_cast;
@@ -36,10 +35,10 @@ static Interface NullInterface( "nullCipher", 1, 0, 0 );
static Range NullKeyRange(0);
static Range NullBlockRange(1,4096,1);
-static shared_ptr<Cipher> NewNullCipher(const Interface &iface, int keyLen)
+static boost::shared_ptr<Cipher> NewNullCipher(const Interface &iface, int keyLen)
{
(void)keyLen;
- return shared_ptr<Cipher>( new NullCipher( iface ) );
+ return boost::shared_ptr<Cipher>( new NullCipher( iface ) );
}
const bool HiddenCipher = true;
@@ -67,7 +66,7 @@ public:
void operator ()(NullKey *&) {}
};
-shared_ptr<AbstractCipherKey> gNullKey( new NullKey(), NullDestructor() );
+boost::shared_ptr<AbstractCipherKey> gNullKey( new NullKey(), NullDestructor() );
NullCipher::NullCipher(const Interface &iface_)
{
@@ -125,8 +124,8 @@ void NullCipher::writeKey(const CipherKey &, unsigned char *,
bool NullCipher::compareKey(const CipherKey &A_,
const CipherKey &B_) const
{
- shared_ptr<NullKey> A = dynamic_pointer_cast<NullKey>(A_);
- shared_ptr<NullKey> B = dynamic_pointer_cast<NullKey>(B_);
+ boost::shared_ptr<NullKey> A = dynamic_pointer_cast<NullKey>(A_);
+ boost::shared_ptr<NullKey> B = dynamic_pointer_cast<NullKey>(B_);
return A.get() == B.get();
}
diff --git a/encfs/NullNameIO.cpp b/encfs/NullNameIO.cpp
index 90485ef..fcd82b8 100644
--- a/encfs/NullNameIO.cpp
+++ b/encfs/NullNameIO.cpp
@@ -23,12 +23,11 @@
#include <cstring>
using namespace rel;
-using boost::shared_ptr;
-static shared_ptr<NameIO> NewNNIO( const Interface &,
- const shared_ptr<Cipher> &, const CipherKey & )
+static boost::shared_ptr<NameIO> NewNNIO( const Interface &,
+ const boost::shared_ptr<Cipher> &, const CipherKey & )
{
- return shared_ptr<NameIO>( new NullNameIO() );
+ return boost::shared_ptr<NameIO>( new NullNameIO() );
}
static Interface NNIOIface("nameio/null", 1, 0, 0);
diff --git a/encfs/SSL_Cipher.cpp b/encfs/SSL_Cipher.cpp
index a6e9290..d6ac666 100644
--- a/encfs/SSL_Cipher.cpp
+++ b/encfs/SSL_Cipher.cpp
@@ -46,7 +46,6 @@ using namespace std;
using namespace rel;
using namespace rlog;
-using boost::shared_ptr;
using boost::dynamic_pointer_cast;
const int MAX_KEYLENGTH = 32; // in bytes (256 bit)
@@ -182,7 +181,7 @@ static Interface AESInterface( "ssl/aes", 3, 0, 2 );
static Range BFKeyRange(128,256,32);
static Range BFBlockRange(64,4096,8);
-static shared_ptr<Cipher> NewBFCipher( const Interface &iface, int keyLen )
+static boost::shared_ptr<Cipher> NewBFCipher( const Interface &iface, int keyLen )
{
if( keyLen <= 0 )
keyLen = 160;
@@ -192,7 +191,7 @@ static shared_ptr<Cipher> NewBFCipher( const Interface &iface, int keyLen )
const EVP_CIPHER *blockCipher = EVP_bf_cbc();
const EVP_CIPHER *streamCipher = EVP_bf_cfb();
- return shared_ptr<Cipher>( new SSL_Cipher(iface, BlowfishInterface,
+ return boost::shared_ptr<Cipher>( new SSL_Cipher(iface, BlowfishInterface,
blockCipher, streamCipher, keyLen / 8) );
}
@@ -208,7 +207,7 @@ static bool BF_Cipher_registered = Cipher::Register("Blowfish",
static Range AESKeyRange(128,256,64);
static Range AESBlockRange(64,4096,16);
-static shared_ptr<Cipher> NewAESCipher( const Interface &iface, int keyLen )
+static boost::shared_ptr<Cipher> NewAESCipher( const Interface &iface, int keyLen )
{
if( keyLen <= 0 )
keyLen = 192;
@@ -237,7 +236,7 @@ static shared_ptr<Cipher> NewAESCipher( const Interface &iface, int keyLen )
break;
}
- return shared_ptr<Cipher>( new SSL_Cipher(iface, AESInterface,
+ return boost::shared_ptr<Cipher>( new SSL_Cipher(iface, AESInterface,
blockCipher, streamCipher, keyLen / 8) );
}
@@ -304,16 +303,16 @@ SSLKey::~SSLKey()
}
-inline unsigned char* KeyData( const shared_ptr<SSLKey> &key )
+inline unsigned char* KeyData( const boost::shared_ptr<SSLKey> &key )
{
return key->buffer;
}
-inline unsigned char* IVData( const shared_ptr<SSLKey> &key )
+inline unsigned char* IVData( const boost::shared_ptr<SSLKey> &key )
{
return key->buffer + key->keySize;
}
-void initKey(const shared_ptr<SSLKey> &key, const EVP_CIPHER *_blockCipher,
+void initKey(const boost::shared_ptr<SSLKey> &key, const EVP_CIPHER *_blockCipher,
const EVP_CIPHER *_streamCipher, int _keySize)
{
Lock lock( key->mutex );
@@ -400,7 +399,7 @@ CipherKey SSL_Cipher::newKey(const char *password, int passwdLength,
int &iterationCount, long desiredDuration,
const unsigned char *salt, int saltLen)
{
- shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
+ boost::shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
if(iterationCount == 0)
{
@@ -435,7 +434,7 @@ CipherKey SSL_Cipher::newKey(const char *password, int passwdLength,
CipherKey SSL_Cipher::newKey(const char *password, int passwdLength)
{
- shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
+ boost::shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
int bytes = 0;
if( iface.current() > 1 )
@@ -484,7 +483,7 @@ CipherKey SSL_Cipher::newRandomKey()
!randomize(saltBuf, saltLen, true))
return CipherKey();
- shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
+ boost::shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
// doesn't need to be versioned, because a random key is a random key..
// Doesn't need to be reproducable..
@@ -572,7 +571,7 @@ bool SSL_Cipher::randomize( unsigned char *buf, int len,
uint64_t SSL_Cipher::MAC_64( const unsigned char *data, int len,
const CipherKey &key, uint64_t *chainedIV ) const
{
- shared_ptr<SSLKey> mk = dynamic_pointer_cast<SSLKey>(key);
+ boost::shared_ptr<SSLKey> mk = dynamic_pointer_cast<SSLKey>(key);
uint64_t tmp = _checksum_64( mk.get(), data, len, chainedIV );
if(chainedIV)
@@ -584,7 +583,7 @@ uint64_t SSL_Cipher::MAC_64( const unsigned char *data, int len,
CipherKey SSL_Cipher::readKey(const unsigned char *data,
const CipherKey &masterKey, bool checkKey)
{
- shared_ptr<SSLKey> mk = dynamic_pointer_cast<SSLKey>(masterKey);
+ boost::shared_ptr<SSLKey> mk = dynamic_pointer_cast<SSLKey>(masterKey);
rAssert(mk->keySize == _keySize);
unsigned char tmpBuf[ MAX_KEYLENGTH + MAX_IVLENGTH ];
@@ -607,7 +606,7 @@ CipherKey SSL_Cipher::readKey(const unsigned char *data,
return CipherKey();
}
- shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
+ boost::shared_ptr<SSLKey> key( new SSLKey( _keySize, _ivLength) );
memcpy( key->buffer, tmpBuf, _keySize + _ivLength );
memset( tmpBuf, 0, sizeof(tmpBuf) );
@@ -620,11 +619,11 @@ CipherKey SSL_Cipher::readKey(const unsigned char *data,
void SSL_Cipher::writeKey(const CipherKey &ckey, unsigned char *data,
const CipherKey &masterKey)
{
- shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
+ boost::shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
rAssert(key->keySize == _keySize);
rAssert(key->ivLength == _ivLength);
- shared_ptr<SSLKey> mk = dynamic_pointer_cast<SSLKey>(masterKey);
+ boost::shared_ptr<SSLKey> mk = dynamic_pointer_cast<SSLKey>(masterKey);
rAssert(mk->keySize == _keySize);
rAssert(mk->ivLength == _ivLength);
@@ -650,8 +649,8 @@ void SSL_Cipher::writeKey(const CipherKey &ckey, unsigned char *data,
bool SSL_Cipher::compareKey( const CipherKey &A, const CipherKey &B) const
{
- shared_ptr<SSLKey> key1 = dynamic_pointer_cast<SSLKey>(A);
- shared_ptr<SSLKey> key2 = dynamic_pointer_cast<SSLKey>(B);
+ boost::shared_ptr<SSLKey> key1 = dynamic_pointer_cast<SSLKey>(A);
+ boost::shared_ptr<SSLKey> key2 = dynamic_pointer_cast<SSLKey>(B);
rAssert(key1->keySize == _keySize);
rAssert(key2->keySize == _keySize);
@@ -678,7 +677,7 @@ int SSL_Cipher::cipherBlockSize() const
}
void SSL_Cipher::setIVec( unsigned char *ivec, uint64_t seed,
- const shared_ptr<SSLKey> &key) const
+ const boost::shared_ptr<SSLKey> &key) const
{
if (iface.current() >= 3)
{
@@ -715,7 +714,7 @@ void SSL_Cipher::setIVec( unsigned char *ivec, uint64_t seed,
*/
void SSL_Cipher::setIVec_old(unsigned char *ivec,
unsigned int seed,
- const shared_ptr<SSLKey> &key) const
+ const boost::shared_ptr<SSLKey> &key) const
{
/* These multiplication constants chosen as they represent (non optimal)
Golumb rulers, the idea being to spread around the information in the
@@ -789,7 +788,7 @@ bool SSL_Cipher::streamEncode(unsigned char *buf, int size,
uint64_t iv64, const CipherKey &ckey) const
{
rAssert( size > 0 );
- shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
+ boost::shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
rAssert(key->keySize == _keySize);
rAssert(key->ivLength == _ivLength);
@@ -827,7 +826,7 @@ bool SSL_Cipher::streamDecode(unsigned char *buf, int size,
uint64_t iv64, const CipherKey &ckey) const
{
rAssert( size > 0 );
- shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
+ boost::shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
rAssert(key->keySize == _keySize);
rAssert(key->ivLength == _ivLength);
@@ -866,7 +865,7 @@ bool SSL_Cipher::blockEncode(unsigned char *buf, int size,
uint64_t iv64, const CipherKey &ckey ) const
{
rAssert( size > 0 );
- shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
+ boost::shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
rAssert(key->keySize == _keySize);
rAssert(key->ivLength == _ivLength);
@@ -900,7 +899,7 @@ bool SSL_Cipher::blockDecode(unsigned char *buf, int size,
uint64_t iv64, const CipherKey &ckey ) const
{
rAssert( size > 0 );
- shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
+ boost::shared_ptr<SSLKey> key = dynamic_pointer_cast<SSLKey>(ckey);
rAssert(key->keySize == _keySize);
rAssert(key->ivLength == _ivLength);
diff --git a/encfs/StreamNameIO.cpp b/encfs/StreamNameIO.cpp
index cd7f4a4..93ce132 100644
--- a/encfs/StreamNameIO.cpp
+++ b/encfs/StreamNameIO.cpp
@@ -29,10 +29,10 @@
using namespace rel;
using namespace std;
-static shared_ptr<NameIO> NewStreamNameIO( const Interface &iface,
- const shared_ptr<Cipher> &cipher, const CipherKey &key)
+static boost::shared_ptr<NameIO> NewStreamNameIO( const Interface &iface,
+ const boost::shared_ptr<Cipher> &cipher, const CipherKey &key)
{
- return shared_ptr<NameIO>( new StreamNameIO( iface, cipher, key ) );
+ return boost::shared_ptr<NameIO>( new StreamNameIO( iface, cipher, key ) );
}
static bool StreamIO_registered = NameIO::Register("Stream",
@@ -69,7 +69,7 @@ Interface StreamNameIO::CurrentInterface()
}
StreamNameIO::StreamNameIO( const rel::Interface &iface,
- const shared_ptr<Cipher> &cipher,
+ const boost::shared_ptr<Cipher> &cipher,
const CipherKey &key )
: _interface( iface.current() )
, _cipher( cipher )
diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp
index dac15bd..ec1fb7e 100644
--- a/encfs/encfs.cpp
+++ b/encfs/encfs.cpp
@@ -82,7 +82,7 @@ static int withCipherPath( const char *opName, const char *path,
EncFS_Context *ctx = context();
int res = -EIO;
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(!FSRoot)
return res;
@@ -117,13 +117,13 @@ static int withFileNode( const char *opName,
EncFS_Context *ctx = context();
int res = -EIO;
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(!FSRoot)
return res;
try
{
- shared_ptr<FileNode> fnode;
+ boost::shared_ptr<FileNode> fnode;
if(fi != NULL)
fnode = GET_FN(ctx, fi);
@@ -161,7 +161,7 @@ int _do_getattr(FileNode *fnode, struct stat *stbuf)
if(res == ESUCCESS && S_ISLNK(stbuf->st_mode))
{
EncFS_Context *ctx = context();
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(FSRoot)
{
// determine plaintext link size.. Easiest to read and decrypt..
@@ -201,7 +201,7 @@ int encfs_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
EncFS_Context *ctx = context();
int res = ESUCCESS;
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(!FSRoot)
return res;
@@ -246,13 +246,13 @@ int encfs_mknod(const char *path, mode_t mode, dev_t rdev)
EncFS_Context *ctx = context();
int res = -EIO;
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(!FSRoot)
return res;
try
{
- shared_ptr<FileNode> fnode = FSRoot->lookupNode( path, "mknod" );
+ boost::shared_ptr<FileNode> fnode = FSRoot->lookupNode( path, "mknod" );
rLog(Info, "mknod on %s, mode %i, dev %" PRIi64,
fnode->cipherName(), mode, (int64_t)rdev);
@@ -272,7 +272,7 @@ int encfs_mknod(const char *path, mode_t mode, dev_t rdev)
// try again using the parent dir's group
string parent = fnode->plaintextParent();
rInfo("trying public filesystem workaround for %s", parent.c_str());
- shared_ptr<FileNode> dnode =
+ boost::shared_ptr<FileNode> dnode =
FSRoot->lookupNode( parent.c_str(), "mknod" );
struct stat st;
@@ -293,7 +293,7 @@ int encfs_mkdir(const char *path, mode_t mode)
EncFS_Context *ctx = context();
int res = -EIO;
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(!FSRoot)
return res;
@@ -312,7 +312,7 @@ int encfs_mkdir(const char *path, mode_t mode)
{
// try again using the parent dir's group
string parent = parentDirectory( path );
- shared_ptr<FileNode> dnode =
+ boost::shared_ptr<FileNode> dnode =
FSRoot->lookupNode( parent.c_str(), "mkdir" );
struct stat st;
@@ -332,7 +332,7 @@ int encfs_unlink(const char *path)
EncFS_Context *ctx = context();
int res = -EIO;
- shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
+ boost::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
if(!FSRoot)
return res;