diff options
author | Havoc Pennington <hp@redhat.com> | 2003-04-02 00:29:33 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-04-02 00:29:33 +0000 |
commit | cfa261b49dd9cafb172deae3db22dba0c2e54bf9 (patch) | |
tree | 91cd4ef8cc16d8b567a84e6f39af04de5abb3494 /dbus/dbus-sysdeps.c | |
parent | 44ed933284589134603913b05f55ca55e8c5a566 (diff) |
2003-04-01 Havoc Pennington <hp@redhat.com>
* bus/config-parser.c, bus/bus.c: implement <servicedir> and
<includedir> (at least mostly)
* dbus/dbus-sysdeps.c (_dbus_change_identity): set the group ID
first, then the user ID
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r-- | dbus/dbus-sysdeps.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 71863ef6..8aa91811 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -3185,18 +3185,21 @@ _dbus_change_identity (unsigned long uid, unsigned long gid, DBusError *error) { - if (setuid (uid) < 0) + /* Set GID first, or the setuid may remove our permission + * to change the GID + */ + if (setgid (gid) < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to set UID to %lu: %s", uid, + "Failed to set GID to %lu: %s", gid, _dbus_strerror (errno)); return FALSE; } - - if (setgid (gid) < 0) + + if (setuid (uid) < 0) { dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to set GID to %lu: %s", gid, + "Failed to set UID to %lu: %s", uid, _dbus_strerror (errno)); return FALSE; } |