aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/main.c
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
commitc6da2cfeb05178a11c6d062a06f8078150ee492f (patch)
treef3b4021d252c52d6463a9b3c1bb7245e399b009c /fs/ecryptfs/main.c
parentc6d7c4dbff353eac7919342ae6b3299a378160a6 (diff)
downloadkernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.zip
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.gz
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.bz2
samsung update 1
Diffstat (limited to 'fs/ecryptfs/main.c')
-rw-r--r--fs/ecryptfs/main.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index b4a6bef..02d0e8d 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -39,6 +39,12 @@
#include <linux/magic.h>
#include "ecryptfs_kernel.h"
+
+#ifdef CONFIG_WTL_ENCRYPTION_FILTER
+#include <linux/ctype.h>
+#endif
+
+
/**
* Module parameter that defines the ecryptfs_verbosity level.
*/
@@ -176,6 +182,9 @@ enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig,
ecryptfs_opt_fn_cipher, ecryptfs_opt_fn_cipher_key_bytes,
ecryptfs_opt_unlink_sigs, ecryptfs_opt_mount_auth_tok_only,
ecryptfs_opt_check_dev_ruid,
+#ifdef CONFIG_WTL_ENCRYPTION_FILTER
+ ecryptfs_opt_enable_filtering,
+#endif
ecryptfs_opt_err };
static const match_table_t tokens = {
@@ -193,6 +202,9 @@ static const match_table_t tokens = {
{ecryptfs_opt_unlink_sigs, "ecryptfs_unlink_sigs"},
{ecryptfs_opt_mount_auth_tok_only, "ecryptfs_mount_auth_tok_only"},
{ecryptfs_opt_check_dev_ruid, "ecryptfs_check_dev_ruid"},
+#ifdef CONFIG_WTL_ENCRYPTION_FILTER
+ {ecryptfs_opt_enable_filtering, "ecryptfs_enable_filtering=%s"},
+#endif
{ecryptfs_opt_err, NULL}
};
@@ -233,7 +245,57 @@ static void ecryptfs_init_mount_crypt_stat(
mutex_init(&mount_crypt_stat->global_auth_tok_list_mutex);
mount_crypt_stat->flags |= ECRYPTFS_MOUNT_CRYPT_STAT_INITIALIZED;
}
+#ifdef CONFIG_WTL_ENCRYPTION_FILTER
+
+static int parse_enc_file_filter_parms(
+ struct ecryptfs_mount_crypt_stat *mcs, char *str)
+{
+ char *token = NULL;
+ int count = 0;
+ mcs->max_name_filter_len = 0;
+ while ((token = strsep(&str, "|")) != NULL) {
+ if (count >= ENC_NAME_FILTER_MAX_INSTANCE)
+ return -1;
+ strncpy(mcs->enc_filter_name[count++],
+ token, ENC_NAME_FILTER_MAX_LEN);
+ if (mcs->max_name_filter_len < strlen(token))
+ mcs->max_name_filter_len = strlen(token);
+ }
+ return 0;
+}
+
+static int parse_enc_ext_filter_parms(
+ struct ecryptfs_mount_crypt_stat *mcs, char *str)
+{
+ char *token = NULL;
+ int count = 0;
+ while ((token = strsep(&str, "|")) != NULL) {
+ if (count >= ENC_EXT_FILTER_MAX_INSTANCE)
+ return -1;
+ strncpy(mcs->enc_filter_ext[count++],
+ token, ENC_EXT_FILTER_MAX_LEN);
+ }
+ return 0;
+}
+
+static int parse_enc_filter_parms(
+ struct ecryptfs_mount_crypt_stat *mcs, char *str)
+{
+ char *token = NULL;
+ if (!strcmp("*", str)) {
+ mcs->flags |= ECRYPTFS_ENABLE_NEW_PASSTHROUGH;
+ return 0;
+ }
+ token = strsep(&str, ":");
+ if (token != NULL)
+ parse_enc_file_filter_parms(mcs, token);
+ token = strsep(&str, ":");
+ if (token != NULL)
+ parse_enc_ext_filter_parms(mcs, token);
+ return 0;
+}
+#endif
/**
* ecryptfs_parse_options
* @sb: The ecryptfs super block
@@ -389,6 +451,19 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options,
case ecryptfs_opt_check_dev_ruid:
*check_ruid = 1;
break;
+#ifdef CONFIG_WTL_ENCRYPTION_FILTER
+ case ecryptfs_opt_enable_filtering:
+ rc = parse_enc_filter_parms(mount_crypt_stat,
+ args[0].from);
+ if (rc) {
+ printk(KERN_ERR "Error attempting to parse encryption "
+ "filtering parameters.\n");
+ rc = -EINVAL;
+ goto out;
+ }
+ mount_crypt_stat->flags |= ECRYPTFS_ENABLE_FILTERING;
+ break;
+#endif
case ecryptfs_opt_err:
default:
printk(KERN_WARNING
@@ -858,6 +933,7 @@ static void __exit ecryptfs_exit(void)
ecryptfs_free_kmem_caches();
}
+
MODULE_AUTHOR("Michael A. Halcrow <mhalcrow@us.ibm.com>");
MODULE_DESCRIPTION("eCryptfs");