From aa248bdb35413f8dfb1606af4dcf602b698b615f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 19 Feb 2013 15:40:06 +0000 Subject: [PATCH 4/8] _dbus_check_dir_is_private_to_user: check that we own it --- dbus/dbus-sysdeps-unix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 654eaee..e7ad017 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1989,6 +1989,16 @@ _dbus_check_dir_is_private_to_user (DBusString *dir, DBusError *error) return FALSE; } + if (sb.st_uid != geteuid ()) + { + dbus_set_error (error, DBUS_ERROR_FAILED, + "%s directory is owned by user %lu, not %lu", + directory, + (unsigned long) sb.st_uid, + (unsigned long) geteuid ()); + return FALSE; + } + if ((S_IROTH & sb.st_mode) || (S_IWOTH & sb.st_mode) || (S_IRGRP & sb.st_mode) || (S_IWGRP & sb.st_mode)) { -- 1.7.10.4