summaryrefslogtreecommitdiff
path: root/cryptfs/cryptfs_names.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-03 00:00:13 +0100
committerJakob Unterwurzacher2015-11-03 00:00:13 +0100
commitde56fe9e3503d98e359551072633c804794b94e1 (patch)
treec9748200eb69eabd2fbfe1b019380a403f20ccb7 /cryptfs/cryptfs_names.go
parent66db3ad086692d249bdf8e14921760f7a460bb99 (diff)
Implement PlainTextNames mode
Also, forbid access to "gocryptfs.conf" in the root dir.
Diffstat (limited to 'cryptfs/cryptfs_names.go')
-rw-r--r--cryptfs/cryptfs_names.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/cryptfs/cryptfs_names.go b/cryptfs/cryptfs_names.go
index 5476b17..a7a9a8c 100644
--- a/cryptfs/cryptfs_names.go
+++ b/cryptfs/cryptfs_names.go
@@ -102,14 +102,20 @@ func (be *CryptFS) translatePath(path string, op bool) (string, error) {
return strings.Join(translatedParts, "/"), err
}
-// EncryptPath - encrypt filename or path. Just hands it to TranslatePath().
+// EncryptPath - encrypt filename or path. Just hands it to translatePath().
func (be *CryptFS) EncryptPath(path string) string {
+ if be.plaintextNames {
+ return path
+ }
newPath, _ := be.translatePath(path, ENCRYPT)
return newPath
}
-// DecryptPath - decrypt filename or path. Just hands it to TranslatePath().
+// DecryptPath - decrypt filename or path. Just hands it to translatePath().
func (be *CryptFS) DecryptPath(path string) (string, error) {
+ if be.plaintextNames {
+ return path, nil
+ }
return be.translatePath(path, DECRYPT)
}