mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +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
|
@ -250,6 +250,17 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
|
|||
struct ecryptfs_file_info *file_info;
|
||||
int lower_flags;
|
||||
|
||||
mount_crypt_stat = &ecryptfs_superblock_to_private(
|
||||
ecryptfs_dentry->d_sb)->mount_crypt_stat;
|
||||
if ((mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
|
||||
&& ((file->f_flags & O_WRONLY) || (file->f_flags & O_RDWR)
|
||||
|| (file->f_flags & O_CREAT) || (file->f_flags & O_TRUNC)
|
||||
|| (file->f_flags & O_APPEND))) {
|
||||
printk(KERN_WARNING "Mount has encrypted view enabled; "
|
||||
"files may only be read\n");
|
||||
rc = -EPERM;
|
||||
goto out;
|
||||
}
|
||||
/* Released in ecryptfs_release or end of function if failure */
|
||||
file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
|
||||
ecryptfs_set_file_private(file, file_info);
|
||||
|
@ -261,8 +272,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
|
|||
}
|
||||
lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
|
||||
crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
|
||||
mount_crypt_stat = &ecryptfs_superblock_to_private(
|
||||
ecryptfs_dentry->d_sb)->mount_crypt_stat;
|
||||
mutex_lock(&crypt_stat->cs_mutex);
|
||||
if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED)) {
|
||||
ecryptfs_printk(KERN_DEBUG, "Setting flags for stat...\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue