Add comments to path-handling functions in DirNode.cpp

This commit is contained in:
Jakob Unterwurzacher 2014-11-30 22:42:51 +01:00
parent 34d15bbeaa
commit 8eea3be2db
2 changed files with 19 additions and 1 deletions

View File

@ -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.

View File

@ -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());