mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-17 18:20:37 +01:00
patches from Michael Krivoruchko <misha at sun.com>:
* dbus/dbus-connection.c (_dbus_connection_queue_received_message_link, _dbus_connection_message_sent, _dbus_connection_send_preallocated_unlocked_no_update, _dbus_connection_pop_message_link_unlocked): handle the case when path is NULL when calling _dbus_verbose * configure.in: check for functions getpeerucred and getpeereid * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): provides support of auth EXTERNAL on Solaris 10+ (getpeerucred), FreeBSD 4.6+, OpenBSD 3.0+ and FreeBSD 5.0+ as well as MacOSX 10.2+ (getpeereid). Patch was only tested on Solaris 10 x86 so it might be issues with other platforms (i.e. BSDs and MacOSX)
This commit is contained in:
parent
f9e96c54cd
commit
8d2fe98783
4 changed files with 62 additions and 6 deletions
19
ChangeLog
19
ChangeLog
|
|
@ -1,3 +1,22 @@
|
|||
2005-10-12 John (J5) Palmieri <johnp@redhat.com>
|
||||
|
||||
patches from Michael Krivoruchko <misha at sun.com>:
|
||||
|
||||
* dbus/dbus-connection.c (_dbus_connection_queue_received_message_link,
|
||||
_dbus_connection_message_sent,
|
||||
_dbus_connection_send_preallocated_unlocked_no_update,
|
||||
_dbus_connection_pop_message_link_unlocked): handle the case when path
|
||||
is NULL when calling _dbus_verbose
|
||||
|
||||
* configure.in: check for functions getpeerucred and getpeereid
|
||||
|
||||
* dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): provides
|
||||
support of auth EXTERNAL on Solaris 10+ (getpeerucred), FreeBSD 4.6+,
|
||||
OpenBSD 3.0+ and FreeBSD 5.0+ as well as MacOSX 10.2+ (getpeereid).
|
||||
Patch was only tested on Solaris 10 x86 so it might be issues
|
||||
with other platforms (i.e. BSDs and MacOSX)
|
||||
|
||||
|
||||
2005-10-05 John (J5) Palmieri <johnp@redhat.com>
|
||||
|
||||
* glib/dbus-gvalue.c (marshal_variant): call _dbus_gvalue_marshal
|
||||
|
|
|
|||
|
|
@ -653,6 +653,7 @@ if test x$dbus_have_struct_cmsgcred = xyes; then
|
|||
AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(getpeerucred getpeereid)
|
||||
|
||||
#### Abstract sockets
|
||||
|
||||
|
|
|
|||
|
|
@ -391,7 +391,9 @@ _dbus_connection_queue_received_message_link (DBusConnection *connection,
|
|||
_dbus_verbose ("Message %p (%d %s %s %s '%s' reply to %u) added to incoming queue %p, %d incoming\n",
|
||||
message,
|
||||
dbus_message_get_type (message),
|
||||
dbus_message_get_path (message),
|
||||
dbus_message_get_path (message) ?
|
||||
dbus_message_get_path (message) :
|
||||
"no path",
|
||||
dbus_message_get_interface (message) ?
|
||||
dbus_message_get_interface (message) :
|
||||
"no interface",
|
||||
|
|
@ -515,7 +517,9 @@ _dbus_connection_message_sent (DBusConnection *connection,
|
|||
_dbus_verbose ("Message %p (%d %s %s %s '%s') removed from outgoing queue %p, %d left to send\n",
|
||||
message,
|
||||
dbus_message_get_type (message),
|
||||
dbus_message_get_path (message),
|
||||
dbus_message_get_path (message) ?
|
||||
dbus_message_get_path (message) :
|
||||
"no path",
|
||||
dbus_message_get_interface (message) ?
|
||||
dbus_message_get_interface (message) :
|
||||
"no interface",
|
||||
|
|
@ -2163,7 +2167,9 @@ _dbus_connection_send_preallocated_unlocked_no_update (DBusConnection *con
|
|||
_dbus_verbose ("Message %p (%d %s %s %s '%s') for %s added to outgoing queue %p, %d pending to send\n",
|
||||
message,
|
||||
dbus_message_get_type (message),
|
||||
dbus_message_get_path (message),
|
||||
dbus_message_get_path (message) ?
|
||||
dbus_message_get_path (message) :
|
||||
"no path",
|
||||
dbus_message_get_interface (message) ?
|
||||
dbus_message_get_interface (message) :
|
||||
"no interface",
|
||||
|
|
@ -3046,7 +3052,9 @@ _dbus_connection_pop_message_link_unlocked (DBusConnection *connection)
|
|||
_dbus_verbose ("Message %p (%d %s %s %s '%s') removed from incoming queue %p, %d incoming\n",
|
||||
link->data,
|
||||
dbus_message_get_type (link->data),
|
||||
dbus_message_get_path (link->data),
|
||||
dbus_message_get_path (link->data) ?
|
||||
dbus_message_get_path (link->data) :
|
||||
"no path",
|
||||
dbus_message_get_interface (link->data) ?
|
||||
dbus_message_get_interface (link->data) :
|
||||
"no interface",
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@
|
|||
#ifdef HAVE_BACKTRACE
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETPEERUCRED
|
||||
#include <ucred.h>
|
||||
#endif
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
|
|
@ -923,7 +925,33 @@ _dbus_read_credentials_unix_socket (int client_fd,
|
|||
credentials->pid = cmsg.cred.cmcred_pid;
|
||||
credentials->uid = cmsg.cred.cmcred_euid;
|
||||
credentials->gid = cmsg.cred.cmcred_groups[0];
|
||||
#else /* !SO_PEERCRED && !HAVE_CMSGCRED */
|
||||
#elif defined(HAVE_GETPEEREID)
|
||||
uid_t euid;
|
||||
gid_t egid;
|
||||
if (getpeereid (client_fd, &euid, &egid) == 0)
|
||||
{
|
||||
credentials->uid = euid;
|
||||
credentials->gid = egid;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dbus_verbose ("Failed to getpeereid() credentials: %s\n", _dbus_strerror (errno));
|
||||
}
|
||||
#elif defined(HAVE_GETPEERUCRED)
|
||||
ucred_t * ucred = NULL;
|
||||
if (getpeerucred (client_fd, &ucred) == 0)
|
||||
{
|
||||
credentials->pid = ucred_getpid (ucred);
|
||||
credentials->uid = ucred_geteuid (ucred);
|
||||
credentials->gid = ucred_getegid (ucred);
|
||||
}
|
||||
else
|
||||
{
|
||||
_dbus_verbose ("Failed to getpeerucred() credentials: %s\n", _dbus_strerror (errno));
|
||||
}
|
||||
if (ucred != NULL)
|
||||
ucred_free (ucred);
|
||||
#else /* !SO_PEERCRED && !HAVE_CMSGCRED && !HAVE_GETPEEREID && !HAVE_GETPEERUCRED */
|
||||
_dbus_verbose ("Socket credentials not supported on this OS\n");
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue