52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
Index: util-linux-ng-2.14.1/mount/mount.c
|
|
===================================================================
|
|
--- util-linux-ng-2.14.1.orig/mount/mount.c
|
|
+++ util-linux-ng-2.14.1/mount/mount.c
|
|
@@ -329,7 +329,7 @@ append_context(const char *optname, char
|
|
security_context_t raw = NULL;
|
|
char *data = NULL;
|
|
|
|
- if (!is_selinux_enabled())
|
|
+ if (is_selinux_enabled() != 1)
|
|
/* ignore the option if we running without selinux */
|
|
return 0;
|
|
|
|
@@ -340,8 +340,8 @@ append_context(const char *optname, char
|
|
data = *optdata =='"' ? strip_quotes(optdata) : optdata;
|
|
|
|
if (selinux_trans_to_raw_context(
|
|
- (security_context_t) data, &raw)==-1 ||
|
|
- raw==NULL)
|
|
+ (security_context_t) data, &raw) == -1 ||
|
|
+ raw == NULL)
|
|
return -1;
|
|
|
|
if (verbose)
|
|
@@ -1372,6 +1372,27 @@ try_mount_one (const char *spec0, const
|
|
res = EX_FAIL;
|
|
|
|
out:
|
|
+
|
|
+#ifdef HAVE_LIBSELINUX
|
|
+ if (res != EX_FAIL && verbose && is_selinux_enabled() > 0) {
|
|
+ security_context_t raw = NULL, def = NULL;
|
|
+
|
|
+ if (getfilecon(node, &raw) > 0 &&
|
|
+ security_get_initial_context("file", &def) == 0) {
|
|
+
|
|
+ if (!selinux_file_context_cmp(raw, def))
|
|
+ printf(_("mount: %s does not contain SELinux labels.\n"
|
|
+ " You just mounted an file system that supports labels which does not\n"
|
|
+ " contain labels, onto an SELinux box. It is likely that confined\n"
|
|
+ " applications will generate AVC messages and not be allowed access to\n"
|
|
+ " this file system. For more details see restorecon(8) and mount(8).\n"),
|
|
+ node);
|
|
+ }
|
|
+ freecon(raw);
|
|
+ freecon(def);
|
|
+ }
|
|
+#endif
|
|
+
|
|
my_free(extra_opts1);
|
|
my_free(spec1);
|
|
my_free(node1);
|