Commit Graph

581 Commits

Author SHA1 Message Date
Jakob Unterwurzacher
e2f0f8e3c6 fuseFhMap: translate FUSE file handles to FileNode pointers
Previously, we used raw pointers to the FileNode as FUSE file handles.

With this change, we instead pass an arbitrary value (a uint64 counter)
to the kernel as FUSE file handle, and use the "fuseFhMap" look-up table
to convert back to the FileNode pointer.

This gets rid of a lot of scary void pointer casts. The performance
cost is not measurable.
2017-07-24 22:41:35 +02:00
Jakob Unterwurzacher
9a4ea2007f withFileNode: move canary check to its own function
The do_op closure is complicated enough. Get the canary check out
of the way to not make it even more complicated.

Also, use an explicitely atomic type for the canary.
2017-07-22 21:11:41 +02:00
Jakob Unterwurzacher
d2ee96d2bd tests: print "mode=standard", "mode=paranoia" progress
We run through everything in normal.t.pl two times, once
in "standard" mode and once in "paranoia" mode. Print some
context. Also, bail out if file creation fails.

Output now looks like this:

$ ./test.sh
tests/normal.t.pl ...
runTests: mode=standard
tests/normal.t.pl ... 54/116
runTests: mode=paranoia
tests/normal.t.pl ... ok
tests/reverse.t.pl .. ok
All tests successful.
Files=2, Tests=141, 21 wallclock secs ( 0.04 usr  0.00 sys + 20.03 cusr  0.36 csys = 20.43 CPU)
Result: PASS
2017-07-22 19:05:33 +02:00
Jakob Unterwurzacher
282df21a49 DirNode: add a few comments
...to make the code easier to understand.

No code changes!
2017-07-22 12:40:28 +02:00
Jakob Unterwurzacher
30000d8e2c tests: add fsstress-encfs.sh stress test
Mount an EncFS filesystem in /tmp and run fsstress against it
in an infinite loop, only exiting on errors.

Ported over from gocryptfs
( ccf1a84e41/tests/stress_tests/fsstress-gocryptfs.bash )
2017-07-21 23:30:53 +02:00
Jakob Unterwurzacher
3bfaf792e6 writeV6Config: cast booleans to int
The tinyxml2 library used by Arch Linux represents
booleans as "true" and "false" instead of "0" and "1".

These fail to load when read back later and will always be
interpreted as false, as seen in
https://github.com/vgough/encfs/issues/343 .

Cast the booleans to int to force representation
as "0" and "1" in all tinyxml2 variants.
2017-07-19 22:57:35 +02:00
Jakob Unterwurzacher
64b01a0869 tests: check if the second mount works as well
Should prevent things like https://github.com/vgough/encfs/issues/343
from happening again.
2017-07-19 22:57:35 +02:00
Jakob Unterwurzacher
c8ff1f94e8 Add a canary value to FileNode
Adds a uint32 value to FileNode that is initialized to an
arbitrary value (CANARY_OK) in the constructor, and reset
when the reference is dropped (CANARY_RELEASED,
CANARY_DESTROYED).

The canary is checked on each withFileNode call.

Makes it much easier to trigger the bug seen in
https://github.com/vgough/encfs/issues/214 .
2017-07-19 22:57:35 +02:00
Jakob Unterwurzacher
319f7b4525 tests: circleci: drop fuse tests
circleci does not support fuse. Just run checkops.
2017-06-25 18:37:08 +02:00
Maya Rashish
d75851d339 Accept netbsd's librefuse as a FUSE library 2017-06-25 13:47:26 +02:00
benrubson
8d8506f2eb Correctly detect attr binary during tests 2017-06-25 13:22:45 +02:00
benrubson
d216cc4208 Improve auto unmount 2017-06-10 18:51:15 +02:00
benrubson
af6c593b38 Properly check for fdatasync() 2017-06-01 15:41:37 +02:00
benrubson
8cc6639f64 Make CircleCI run make check 2017-05-28 17:45:24 +02:00
Johannes Bornhold
ea67ef11f5 Add check for reading the configuration from a pipe 2017-05-28 16:24:35 +02:00
Johannes Bornhold
59378ae7fe Read config into memory and pass its content to tinyxml2 (#253)
tinyxml2 does not support to read from a named pipe, since it uses seek to
figure out the file size. In the case of a pipe this is not possible.

Reading the file content into memory and passing the content to tinyxml2 allows
to mitigate this problem.
2017-05-28 16:24:35 +02:00
Ben RUBSON
f75854cd31 Update cmake (#309)
* Update cmake

* Update cmake, make Travis use it

* Enable all tests in a single command : make check

* Make cmake flawlessly run with Debian jessie cmake 3.0.2

* Make Travis use our own cmake 3.0.2 compiled version

* Typo in preferred version

* Be sure travis will have gettext
2017-05-28 16:20:21 +02:00
benrubson
c270963df8 Use INITIALIZE_EASYLOGGINGPP in Error.cpp 2017-04-23 14:21:36 +02:00
benrubson
fc39c4dd20 Delete grow() test file
so that next tests do not depend on it
2017-04-13 20:20:57 +02:00
benrubson
c68c130724 Add option 't' to set syslog tag 2017-04-02 23:52:29 +02:00
benrubson
b1a7e0ff5e Remove timestamp from loglines
when syslog is used
2017-04-02 23:52:29 +02:00
benrubson
42ef6ee0c7 Update easylogging++ to v9.94.1 2017-04-02 19:31:05 +02:00
Ben RUBSON
7295b3369b Check that llistxattr exists (#307)
This PR solves
https://github.com/vgough/encfs/issues/305 "llistxattr breaks compilation on Mac OS X"
checking whether llistxattr exists or not.
2017-04-01 19:58:05 +02:00
Ben RUBSON
7cc6efa60c Display default yes/no choice when creating initial directories
Currently the text displayed is

    The directory "..." does not exist. Should it be created? (y,n)

This patch changes it to

    The directory "..." does not exist. Should it be created? (y,N)
2017-03-25 13:55:53 +01:00
Aikhjarto
e4d1679c10 Fixed Typo (#304) 2017-03-25 13:50:56 +01:00
benrubson
11a83b85ba Remove not needed try/catch block 2017-03-20 15:57:37 +01:00
benrubson
f024ae86f8 Make sure errno is correctly used 2017-03-20 15:11:17 +01:00
benrubson
13ae4de830 Verify open/read/write/truncate returned values 2017-03-20 14:23:19 +01:00
benrubson
b88da06a08 Make (stream|block)(Encode|Decode) return false 2017-03-17 23:40:50 +01:00
benrubson
6f4ff008bc Make initHeader return -EBADMSG when encode fails
instead of throwing an exception, as with read/write
2017-03-17 09:07:14 +01:00
Charles Duffy
a17f7366c2 Fix up encfssh (#258)
* Fix up encfssh

The original implementation of encfssh had several issues:

- Could not safely handle directory names with spaces
- Could not safely handle paths starting with a dash (`-`)
- Option strings could not be passed with spaces
- Could print incorrect help based on filenames in current directory
- Used `test` syntax deprecated in current POSIX.2 standard
- Had shell injection vulnerabilities based on both current working directory
  and mount-point directory names.
- Failures of the canonicalize function could silently return the current
  directory rather than the target.

In this version, shell injection is only permitted through the (explicitly
defined) `FUSE_UMOUNT` mechanism.

This version also adds support for the GNU-style "--help" argument.
2017-03-16 22:21:02 +01:00
benrubson
36f3505af0 Make readOneBlock return -EBADMSG when decode fails
instead of throwing an exception, as with writeOneBlock
2017-03-16 15:48:19 +01:00
benrubson
63d11e6989 Return errno in case of write failed
so make ::pwrite return an int
2017-03-11 19:38:17 +01:00
Ben RUBSON
618db2374c Get idle counters at once (#294)
to avoid a race with usage==0 & openCount>0
2017-03-10 08:47:04 +01:00
Ben RUBSON
efbdd29716 Allow read/write in standard reverse mode (#301) 2017-03-09 22:56:37 +01:00
rfjakob
62505fa240 Merge pull request #287 from dinoboy197/resolve_extattrs_for_symlinks
Resolve xattrs for symlinks (resolves #247, resolves #283)
2017-02-20 21:35:18 +01:00
rfjakob
544275f24b Merge pull request #289 from antcc/master
Change Spanish initials to English in es_ES.po
2017-02-17 10:32:05 +01:00
Antonio CC
4d51bafb5e Change Spanish initials to English in es_ES.po
Change 's' to 'y' when asked to create a directory if it does not already exist.
2017-02-17 10:13:33 +01:00
Taylor Raack
10e26bf488 Resolve xattrs for symlinks (resolves #247, resolves #283) 2017-02-13 22:03:43 -08:00
rfjakob
424275208c Merge pull request #285 from dinoboy197/turn_on_all_integration_tests
Turn on all integration tests in Travis build
2017-02-12 12:11:45 +01:00
Taylor Raack
693d7f94aa Turn on all integration tests in Travis build 2017-02-11 21:38:48 -08:00
rfjakob
3b1b07fc14 Merge pull request #282 from rfjakob/issue280
Revert "-S" ABI change

Revert c3a7da5eff and enforce empty password ban.

Context:
https://github.com/tomm/cryptkeeper/issues/23
https://github.com/vgough/encfs/issues/280
2017-02-06 22:37:44 +01:00
Jakob Unterwurzacher
5994b28542 Exit with a fatal error on empty password
The requirement that the password is not empty was not enforced
properly in all getUserKey() variants. Add the check to makeKey()
instead that is called in every code path.

This also fixes the crash desribed at https://github.com/vgough/encfs/issues/241 .
2017-02-05 14:06:19 +01:00
Jakob Unterwurzacher
e9592fade4 Revert "Fix a segfault when password is zero length."
The change intended to fix a segfault when encfs is passed a zero-length
password (https://github.com/vgough/encfs/issues/241).

However, it also changed the CLI ABI which caused breakage in Cryptkeeper
(https://github.com/tomm/cryptkeeper/issues/23) and other third-party
projects that call EncFS.

Fixes https://github.com/vgough/encfs/issues/280 .

This reverts commit c3a7da5eff.
2017-02-05 14:05:36 +01:00
Marcus Frex
3444ccd1a2 Added Camellia support with 128/196/256 bits key size support 2017-01-08 17:23:14 +03:00
Valient Gough
ac87a8ba0e Merge pull request #257 from charles-dyfis-net/shell-pedantry
Suggest "$@", not $*, in documentation
2017-01-07 22:55:37 -08:00
Charles Duffy
ecc364df0d Suggest "$@", not $*, in documentation
`$*` operates by:

- Concatenating all arguments with the first character in `IFS` (by default a space) into a single string
- Splitting that string on all characters found in `IFS` to join a list of words
- Expanding each of those words as a glob character

Thus, using `$*` in a wrapper means that an argument such as `"one word"` becomes two arguments, `one` and `word`, and an argument `'*.txt'` can be replaced with an entirely unknown number of arguments (`one.txt`, `two.txt`) despite its quoting.

Use `"$@"` to pass an argument vector through literally without any kind of expansion.
2016-12-22 16:37:15 -06:00
Valient Gough
2be5bc7a11 Merge pull request #248 from Code7R/master
Declare minimum cmake version to have the Intl module
2016-12-15 15:08:01 -08:00
Valient Gough
d9bd3d260e Merge pull request #251 from enodata/master
Fix misplaced namespace closing brace
2016-12-15 12:49:38 -08:00
Dmitri Goutnik
afe67ab9a0 fix misplaced namespace closing brace 2016-12-10 09:59:03 -05:00