diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-02-19 15:40:06 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-12-02 19:37:48 +0000 |
commit | 00211794ed8e85cb49538ee32703f71566cb48f2 (patch) | |
tree | 87bacfd59a5ac963638f213dfafccce4b168368e | |
parent | 723da23545aa1b742c7ac37df6934040a805526b (diff) | |
download | dbus-00211794ed8e85cb49538ee32703f71566cb48f2.tar.gz |
_dbus_check_dir_is_private_to_user: check that we own it
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>
-rw-r--r-- | dbus/dbus-sysdeps-unix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index b82c2bc7..19f5ea30 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -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)) { |