libgocryptfs/internal/fusefrontend
DerDonut a611810ff4 Badname file content access
This proposal is the counterpart of the modifications from the `-badname`
parameter. It modifies the plain -> cipher mapping for filenames when using
`-badname` parameter. The new function `EncryptAndHashBadName` tries to find a
cipher filename for the given plain name with the following steps:

1. If `badname` is disabled or direct mapping is successful: Map directly
(default and current behaviour)

2. If a file with badname flag has a valid cipher file, this is returned
(=File just ends with the badname flag)

3. If a file with a badname flag exists where only the badname flag was added,
this is returned (=File cipher name could not be decrypted by function
`DecryptName` and just the badname flag was added)

4. Search for all files which cipher file name extists when cropping more and
more characters from the end. If only 1 file is found, return this

5. Return an error otherwise

This allows file access in the file browsers but most important it allows that
you rename files with undecryptable cipher names in the plain directories.
Renaming those files will then generate a proper cipher filename One
backdraft: When mounting the cipher dir with -badname parameter, you can never
create (or rename to) files whose file name ends with the badname file flag
(at the moment this is " GOCRYPTFS_BAD_NAME"). This will cause an error.

I modified the CLI test function to cover additional test cases. Test [Case
7](https://github.com/DerDonut/gocryptfs/blob/badnamecontent/tests/cli/cli_test.go#L712)
cannot be performed since the cli tests are executed in panic mode. The
testing is stopped on error. Since the function`DecryptName` produces internal
errors when hitting non-decryptable file names, this test was omitted.

This implementation is a proposal where I tried to change the minimum amount
of existing code. Another possibility would be instead of creating the new
function `EncryptAndHashBadName` to modify the signature of the existing
function `EncryptAndHashName(name string, iv []byte)` to
`EncryptAndHashName(name string, iv []byte, dirfd int)` and integrate the
functionality into this function directly. You may allow calling with dirfd=-1
or other invalid values an then performing the current functionality.
2021-06-20 18:09:21 +02:00
..
args.go v2api: -sharestorage: disable hard link tracking & add tests 2021-03-07 17:22:29 +01:00
ctlsock_interface.go v2api: implement ctlsocksrv.Interface 2020-07-17 22:14:40 +02:00
dircache.go fusefrontend: print dirCache stats after unmount 2021-04-05 18:20:17 +02:00
file.go fusefrontend: catch ReadAt integer overflow 2021-06-02 18:20:05 +02:00
file_allocate_truncate.go v2api: rename "File2" to just "File" 2020-08-16 12:50:33 +02:00
file_api_check.go v2api: clean up api TODOs 2020-08-16 13:52:27 +02:00
file_holes.go fusefrontend: rewrite Lseek SEEK_DATA / SEEK_HOLE 2021-05-29 16:05:36 +02:00
file_setattr.go v2api: rename "File2" to just "File" 2020-08-16 12:50:33 +02:00
node.go fusefronted: report plaintext size on symlink creation 2021-06-06 19:22:16 +02:00
node_api_check.go v2api: implement Getxattr, Setxattr, Removexattr, Listxattr 2020-07-14 19:55:20 +02:00
node_dir_ops.go fusefrontend: list "." and ".." in dir entries 2021-05-29 16:44:38 +02:00
node_helpers.go Badname file content access 2021-06-20 18:09:21 +02:00
node_open_create.go fusefronted: move Create() and Open() to new file 2021-03-21 09:31:05 +01:00
node_xattr.go fusefrontend: run acl Setxattr in user context 2021-06-02 19:10:36 +02:00
node_xattr_darwin.go fusefrontend: run acl Setxattr in user context 2021-06-02 19:10:36 +02:00
node_xattr_linux.go fusefrontend: run acl Setxattr in user context 2021-06-02 19:10:36 +02:00
openbackingdir_test.go tests: fusefronted: fix TestOpenBackingDir 2021-04-03 12:34:18 +02:00
root_node.go Badname file content access 2021-06-20 18:09:21 +02:00
xattr_unit_test.go nametransform: check name validity on encryption 2021-06-02 14:29:48 +02:00