summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaman <jason@perfinion.com>2016-06-02 16:04:35 +0800
committerJason Zaman <jason@perfinion.com>2016-06-10 00:09:08 +0800
commitbd4c4a629f08f042f05dcb99ac55180dbdb511f6 (patch)
tree3ba6b96661ad930d6f93ac0a3c115534f2ee71f3 /src
parentd68000e95ae173616a0d87840468ceb6e2b94e2a (diff)
downloadConsoleKit2-bd4c4a629f08f042f05dcb99ac55180dbdb511f6.tar.gz
mount tmpfs with correct selinux labels
Signed-off-by: Jason Zaman <jason@perfinion.com>
Diffstat (limited to 'src')
-rw-r--r--src/ck-sysdeps-linux.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ck-sysdeps-linux.c b/src/ck-sysdeps-linux.c
index e4f6e86..1331cca 100644
--- a/src/ck-sysdeps-linux.c
+++ b/src/ck-sysdeps-linux.c
@@ -998,14 +998,22 @@ ck_make_tmpfs (guint uid, guint gid, const gchar *dest)
{
#ifdef HAVE_SYS_MOUNT_H
gchar *opts;
+ gchar *context;
int result;
TRACE ();
- opts = g_strdup_printf ("mode=0700,uid=%d", uid);
+ context = ck_selinux_lookup_context(dest);
+ if (context) {
+ opts = g_strdup_printf ("mode=0700,uid=%d,rootcontext=%s", uid, context);
+ } else {
+ opts = g_strdup_printf ("mode=0700,uid=%d", uid);
+ }
+ g_debug ("mounting tmpfs. uid=%d, gid=%d, dest=%s, opts=%s", uid, gid, dest, opts);
result = mount("none", dest, "tmpfs", 0, opts);
+ g_free (context);
g_free (opts);
if (result == 0) {