Project

General

Profile

Actions

Tasks #64691

closed

Tasks #63293: Implement fscrypt in libcephfs and cephfs-fuse

Symlink target not set correctly in unencrypted dir

Added by Christopher Hoffman 2 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

Tags:
Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:

Description

Symlink does not work outside of an unencrypted dir. The target does not get set

[mycephfs]$ touch filea
[mycephfs]$ ln -s filea file1
[mycephfs]$ ls -l
total 1
lrwxrwxrwx. 1 choffman choffman 5 Mar  4 16:07 file1 -> ''
-rw-------. 1 choffman choffman 0 Mar  4 16:07 filea

[mycephfs]$ cat file1
cat: file1: Is a directory
Actions #1

Updated by Christopher Hoffman 2 months ago

  • Status changed from In Progress to Resolved

in->symlink_plain wasn't being set in case of non-fscrypt.

diff --git a/src/client/Client.cc b/src/client/Client.cc
index 9d8ba1cdfda..93847da47b8 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -1635,13 +1635,17 @@ Inode* Client::insert_trace(MetaRequest *request, MetaSession *session)
                          request->perms);

     auto fscrypt_denc = fscrypt->get_fname_denc(in->fscrypt_ctx, &in->fscrypt_key_validator, true);
-    if (fscrypt_denc && in->is_symlink()) {
-      string slname;
-      int ret = fscrypt_denc->get_decrypted_symlink(in->symlink, &slname);
-      if (ret < 0) {
-        ldout(cct, 0) << __FILE__ << ":" << __LINE__ << ": failed to decrypt symlink (r=" << ret << ")" << dendl;
+    if (in->is_symlink()) {
+      if (fscrypt_denc) {
+        string slname;
+        int ret = fscrypt_denc->get_decrypted_symlink(in->symlink, &slname);
+        if (ret < 0) {
+          ldout(cct, 0) << __FILE__ << ":" << __LINE__ << ": failed to decrypt symlink (r=" << ret << ")" << dendl;
+        }
+        in->symlink_plain = slname;
+      } else {
+        in->symlink_plain = in->symlink;
       }
-      in->symlink_plain = slname;
     }
   }

Actions #2

Updated by Christopher Hoffman about 2 months ago

  • Subject changed from Symlink target not set correct in unencrypted dir to Symlink target not set correctly in unencrypted dir
  • Description updated (diff)
Actions #3

Updated by Dhairya Parmar about 2 months ago

Christopher Hoffman wrote:

in->symlink_plain wasn't being set in case of non-fscrypt.

[...]

is this patch going to be part of the master FSCrypt PR?

Actions #4

Updated by Christopher Hoffman about 1 month ago

Dhairya Parmar wrote:

Christopher Hoffman wrote:

in->symlink_plain wasn't being set in case of non-fscrypt.

[...]

is this patch going to be part of the master FSCrypt PR?

Yeah it is. It's part of the wip-fscrypt branch here: https://github.com/chrisphoffman/ceph/tree/wip-fscrypt

Actions

Also available in: Atom PDF