Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.25
[sfrench/cifs-2.6.git] / security / dummy.c
index c505122e22dbddec700ea967b604f1a01480399b..78d8f92310a4651e5069c3ea32c3cbbd09f77dc9 100644 (file)
@@ -36,14 +36,19 @@ static int dummy_ptrace (struct task_struct *parent, struct task_struct *child)
 static int dummy_capget (struct task_struct *target, kernel_cap_t * effective,
                         kernel_cap_t * inheritable, kernel_cap_t * permitted)
 {
-       *effective = *inheritable = *permitted = 0;
        if (target->euid == 0) {
-               *permitted |= (~0 & ~CAP_FS_MASK);
-               *effective |= (~0 & ~CAP_TO_MASK(CAP_SETPCAP) & ~CAP_FS_MASK);
+               cap_set_full(*permitted);
+               cap_set_init_eff(*effective);
+       } else {
+               cap_clear(*permitted);
+               cap_clear(*effective);
        }
-       if (target->fsuid == 0) {
-               *permitted |= CAP_FS_MASK;
-               *effective |= CAP_FS_MASK;
+
+       cap_clear(*inheritable);
+
+       if (target->fsuid != 0) {
+               *permitted = cap_drop_fs_set(*permitted);
+               *effective = cap_drop_fs_set(*effective);
        }
        return 0;
 }
@@ -176,8 +181,7 @@ static void dummy_sb_free_security (struct super_block *sb)
        return;
 }
 
-static int dummy_sb_copy_data (struct file_system_type *type,
-                              void *orig, void *copy)
+static int dummy_sb_copy_data (char *orig, char *copy)
 {
        return 0;
 }
@@ -240,19 +244,17 @@ static void dummy_sb_post_pivotroot (struct nameidata *old_nd, struct nameidata
        return;
 }
 
-static int dummy_sb_get_mnt_opts(const struct super_block *sb, char ***mount_options,
-                                int **flags, int *num_opts)
+static int dummy_sb_get_mnt_opts(const struct super_block *sb,
+                                struct security_mnt_opts *opts)
 {
-       *mount_options = NULL;
-       *flags = NULL;
-       *num_opts = 0;
+       security_init_mnt_opts(opts);
        return 0;
 }
 
-static int dummy_sb_set_mnt_opts(struct super_block *sb, char **mount_options,
-                                int *flags, int num_opts)
+static int dummy_sb_set_mnt_opts(struct super_block *sb,
+                                struct security_mnt_opts *opts)
 {
-       if (unlikely(num_opts))
+       if (unlikely(opts->num_mnt_opts))
                return -EOPNOTSUPP;
        return 0;
 }
@@ -263,6 +265,11 @@ static void dummy_sb_clone_mnt_opts(const struct super_block *oldsb,
        return;
 }
 
+static int dummy_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)
+{
+       return 0;
+}
+
 static int dummy_inode_alloc_security (struct inode *inode)
 {
        return 0;
@@ -1023,6 +1030,7 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, sb_get_mnt_opts);
        set_to_dummy_if_null(ops, sb_set_mnt_opts);
        set_to_dummy_if_null(ops, sb_clone_mnt_opts);
+       set_to_dummy_if_null(ops, sb_parse_opts_str);
        set_to_dummy_if_null(ops, inode_alloc_security);
        set_to_dummy_if_null(ops, inode_free_security);
        set_to_dummy_if_null(ops, inode_init_security);