]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_check_dir_is_private_to_user: check that we own it
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 19 Feb 2013 15:40:06 +0000 (15:40 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 2 Dec 2013 19:37:48 +0000 (19:37 +0000)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61303
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-sysdeps-unix.c

index b82c2bc760a736f0836f3165b7e59100e0c8e8f9..19f5ea30a5e29b013493d09622e657f9eba2dd10 100644 (file)
@@ -1999,6 +1999,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))
     {