From b6ffea177fccb6cc4e65992da7d8b390054277f7 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 21 Mar 2003 02:38:40 +0000 Subject: 2003-03-20 Havoc Pennington * dbus/dbus-connection.c (dbus_connection_set_unix_user_function): new function (dbus_connection_get_unix_user): new function --- dbus/dbus-sysdeps.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'dbus/dbus-sysdeps.c') 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 (); -- cgit