mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 06:52:07 +00:00
[PATCH] eCryptfs: Encrypted passthrough
Provide an option to provide a view of the encrypted files such that the metadata is always in the header of the files, regardless of whether the metadata is actually in the header or in the extended attribute. This mode of operation is useful for applications like incremental backup utilities that do not preserve the extended attributes when directly accessing the lower files. With this option enabled, the files under the eCryptfs mount point will be read-only. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
dd2a3b7ad9
commit
e77a56ddce
5 changed files with 113 additions and 11 deletions
|
@ -289,6 +289,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
|
|||
char *encoded_name;
|
||||
unsigned int encoded_namelen;
|
||||
struct ecryptfs_crypt_stat *crypt_stat = NULL;
|
||||
struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
|
||||
char *page_virt = NULL;
|
||||
struct inode *lower_inode;
|
||||
u64 file_size;
|
||||
|
@ -388,8 +389,18 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
|
|||
}
|
||||
crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR;
|
||||
}
|
||||
memcpy(&file_size, page_virt, sizeof(file_size));
|
||||
file_size = be64_to_cpu(file_size);
|
||||
mount_crypt_stat = &ecryptfs_superblock_to_private(
|
||||
dentry->d_sb)->mount_crypt_stat;
|
||||
if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) {
|
||||
if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR)
|
||||
file_size = (crypt_stat->header_extent_size
|
||||
+ i_size_read(lower_dentry->d_inode));
|
||||
else
|
||||
file_size = i_size_read(lower_dentry->d_inode);
|
||||
} else {
|
||||
memcpy(&file_size, page_virt, sizeof(file_size));
|
||||
file_size = be64_to_cpu(file_size);
|
||||
}
|
||||
i_size_write(dentry->d_inode, (loff_t)file_size);
|
||||
kmem_cache_free(ecryptfs_header_cache_2, page_virt);
|
||||
goto out;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue