mirror of
https://github.com/vgough/encfs.git
synced 2025-02-18 10:41:11 +01:00
Add comments to path-handling functions in DirNode.cpp
This commit is contained in:
parent
34d15bbeaa
commit
8eea3be2db
@ -275,14 +275,32 @@ string DirNode::rootDirectory() {
|
|||||||
return string(rootDir, 0, rootDir.length() - 1);
|
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) {
|
string DirNode::cipherPath(const char *plaintextPath) {
|
||||||
return rootDir + naming->encodePath(plaintextPath);
|
return rootDir + naming->encodePath(plaintextPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as cipherPath(), but does not prefix the ciphertext root directory
|
||||||
|
*/
|
||||||
string DirNode::cipherPathWithoutRoot(const char *plaintextPath) {
|
string DirNode::cipherPathWithoutRoot(const char *plaintextPath) {
|
||||||
return naming->encodePath(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_) {
|
string DirNode::plainPath(const char *cipherPath_) {
|
||||||
try {
|
try {
|
||||||
// Handle special absolute path encodings.
|
// Handle special absolute path encodings.
|
||||||
|
@ -374,8 +374,8 @@ int encfs_symlink(const char *to, const char *from) {
|
|||||||
if (!FSRoot) return res;
|
if (!FSRoot) return res;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// allow fully qualified names in symbolic links.
|
|
||||||
string fromCName = FSRoot->cipherPath(from);
|
string fromCName = FSRoot->cipherPath(from);
|
||||||
|
// allow fully qualified names in symbolic links.
|
||||||
string toCName = FSRoot->relativeCipherPath(to);
|
string toCName = FSRoot->relativeCipherPath(to);
|
||||||
|
|
||||||
rLog(Info, "symlink %s -> %s", fromCName.c_str(), toCName.c_str());
|
rLog(Info, "symlink %s -> %s", fromCName.c_str(), toCName.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user