summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_mount.c
diff options
context:
space:
mode:
authorKarel Zak2012-08-01 17:52:22 +0200
committerKarel Zak2012-08-01 17:52:22 +0200
commitf1f9a46abd47ff7c681fd22ecf81a31260498f2c (patch)
tree9dc23fe09bc63263712e17a56befccf68435612c /libmount/src/context_mount.c
parentlibmount: add mnt_optstr_deduplicate_option() (diff)
downloadkernel-qcow2-util-linux-f1f9a46abd47ff7c681fd22ecf81a31260498f2c.tar.gz
kernel-qcow2-util-linux-f1f9a46abd47ff7c681fd22ecf81a31260498f2c.tar.xz
kernel-qcow2-util-linux-f1f9a46abd47ff7c681fd22ecf81a31260498f2c.zip
libmount: deduplicate SELinux mount options
We already have a clue about SELinux specific mount options in libmount, so it makes sense to deduplicate the options as Linux kernel does not support duplicate SELinux options. (SELinux kernel stuff somehow ignores standard Linux mount conventions...) Requested-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_mount.c')
-rw-r--r--libmount/src/context_mount.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index 36dc414ae..f3d8ff103 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -117,6 +117,15 @@ static int fix_optstr(struct libmnt_context *cxt)
else
/* For normal mount we have translate the contexts */
se_fix = 1;
+
+ if (!se_rem) {
+ /* de-duplicate SELinux options */
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "context");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "fscontext");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "defcontext");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "rootcontext");
+ mnt_optstr_deduplicate_option(&fs->fs_optstr, "seclabel");
+ }
#endif
while (!mnt_optstr_next_option(&next, &name, &namesz, &val, &valsz)) {