From 8eea3be2db9cfe0f19a04bfd06a3a11eb0fac8a3 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 30 Nov 2014 22:42:51 +0100 Subject: [PATCH] Add comments to path-handling functions in DirNode.cpp --- encfs/DirNode.cpp | 18 ++++++++++++++++++ encfs/encfs.cpp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/encfs/DirNode.cpp b/encfs/DirNode.cpp index a3f44c0..3b88c37 100644 --- a/encfs/DirNode.cpp +++ b/encfs/DirNode.cpp @@ -275,14 +275,32 @@ string DirNode::rootDirectory() { return string(rootDir, 0, rootDir.length() - 1); } +/** + * Encrypt a plain-text file path to the ciphertext path with the + * ciphertext root directory name prefixed. + * + * Example: + * $ encfs -f -v cipher plain + * $ cd plain + * $ touch foobar + * cipherPath: /foobar encoded to cipher/NKAKsn2APtmquuKPoF4QRPxS + */ string DirNode::cipherPath(const char *plaintextPath) { return rootDir + naming->encodePath(plaintextPath); } +/** + * Same as cipherPath(), but does not prefix the ciphertext root directory + */ string DirNode::cipherPathWithoutRoot(const char *plaintextPath) { return naming->encodePath(plaintextPath); } +/** + * Return the decrypted version of cipherPath + * + * In reverse mode, returns the encrypted version of cipherPath + */ string DirNode::plainPath(const char *cipherPath_) { try { // Handle special absolute path encodings. diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index 40c5933..42beac4 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -374,8 +374,8 @@ int encfs_symlink(const char *to, const char *from) { if (!FSRoot) return res; try { - // allow fully qualified names in symbolic links. string fromCName = FSRoot->cipherPath(from); + // allow fully qualified names in symbolic links. string toCName = FSRoot->relativeCipherPath(to); rLog(Info, "symlink %s -> %s", fromCName.c_str(), toCName.c_str());