Excluding files/directories from directory listing does not work when using "-plaintextnames" switch
slackner opened this issue · 3 comments
slackner commented
Steps to reproduce:
mkdir local remote
gocryptfs -init -plaintextnames -reverse local
touch local/abcd
gocryptfs -reverse -exclude abcd local remote
In this example, the file abcd
should not appear in any directory listing - however, it still appears (but without being able to access it):
drwxr-xr-x 2 sebastian sebastian 4,0K Dez 17 14:48 .
drwxr-xr-x 7 sebastian sebastian 4,0K Dez 17 14:45 ..
-????????? ? ? ? ? ? abcd
-r-------- 1 sebastian sebastian 366 Dez 17 14:45 gocryptfs.conf
The problem seems to be that exclude handling was never implemented in openDirPlaintextnames
, which is used as shortcut when using plaintext names:
[...]
if rfs.args.PlaintextNames {
return rfs.openDirPlaintextnames(cipherPath, entries)
}
[...]
rfjakob commented
Hmm, this means the tests in https://github.com/rfjakob/gocryptfs/blob/master/tests/reverse/exclude_test.go are broken
rfjakob commented
And they are. The tests used ioutil.ReadDir, which tries to stat all files and filters out those it cannot.
rfjakob commented
Fixed the tests and fixed the bug, thanks