summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-sysdeps.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-21 02:38:40 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-21 02:38:40 +0000
commitb6ffea177fccb6cc4e65992da7d8b390054277f7 (patch)
tree5194ad93d495c110c88b7730f05b9265dd6ce73d /dbus/dbus-sysdeps.c
parent056d76d809dc341b0dce160d3f79062604565c77 (diff)
2003-03-20 Havoc Pennington <hp@redhat.com>
* dbus/dbus-connection.c (dbus_connection_set_unix_user_function): new function (dbus_connection_get_unix_user): new function
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r--dbus/dbus-sysdeps.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index d653b868..cd4a82a5 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -651,6 +651,14 @@ _dbus_read_credentials_unix_socket (int client_fd,
struct cmsghdr *cmsg = (struct cmsghdr *) cmsgmem;
#endif
+ /* The POSIX spec certainly doesn't promise this, but
+ * we need these assertions to fail as soon as we're wrong about
+ * it so we can do the porting fixups
+ */
+ _dbus_assert (sizeof (pid_t) <= sizeof (credentials->pid));
+ _dbus_assert (sizeof (uid_t) <= sizeof (credentials->uid));
+ _dbus_assert (sizeof (gid_t) <= sizeof (credentials->gid));
+
credentials->pid = -1;
credentials->uid = -1;
credentials->gid = -1;
@@ -1353,6 +1361,14 @@ _dbus_credentials_from_uid_string (const DBusString *uid_str,
void
_dbus_credentials_from_current_process (DBusCredentials *credentials)
{
+ /* The POSIX spec certainly doesn't promise this, but
+ * we need these assertions to fail as soon as we're wrong about
+ * it so we can do the porting fixups
+ */
+ _dbus_assert (sizeof (pid_t) <= sizeof (credentials->pid));
+ _dbus_assert (sizeof (uid_t) <= sizeof (credentials->uid));
+ _dbus_assert (sizeof (gid_t) <= sizeof (credentials->gid));
+
credentials->pid = getpid ();
credentials->uid = getuid ();
credentials->gid = getgid ();