mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-27 02:10:11 +01:00
2006-09-16 Havoc Pennington <hp@redhat.com>
Attempt auditing public API to remove all cases where a Unix function returns weird emulated goo to Windows. This probably breaks the bus daemon on Windows, to fix it again we may need to stop processing unix-specific config options on Windows, and may need to add Windows-specific public API or config options. * configure.in (LT_CURRENT, LT_AGE): increment current and age, to reflect added interfaces; should not break soname. * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): do not invoke unix user function on Windows. Kind of a hacky fix, but we don't want a "unix uid" leaking out on Windows. * dbus/dbus-connection.c (dbus_connection_get_socket): add new API to get the socket fd on Windows or UNIX (dbus_connection_get_unix_fd): make this always fail on Windows
This commit is contained in:
parent
8027efc97b
commit
e001455a03
6 changed files with 89 additions and 6 deletions
19
ChangeLog
19
ChangeLog
|
|
@ -1,3 +1,22 @@
|
|||
2006-09-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
Attempt auditing public API to remove all cases where a Unix
|
||||
function returns weird emulated goo to Windows. This probably
|
||||
breaks the bus daemon on Windows, to fix it again we may
|
||||
need to stop processing unix-specific config options on Windows,
|
||||
and may need to add Windows-specific public API or config options.
|
||||
|
||||
* configure.in (LT_CURRENT, LT_AGE): increment current and age,
|
||||
to reflect added interfaces; should not break soname.
|
||||
|
||||
* dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): do
|
||||
not invoke unix user function on Windows. Kind of a hacky fix, but
|
||||
we don't want a "unix uid" leaking out on Windows.
|
||||
|
||||
* dbus/dbus-connection.c (dbus_connection_get_socket): add new API
|
||||
to get the socket fd on Windows or UNIX
|
||||
(dbus_connection_get_unix_fd): make this always fail on Windows
|
||||
|
||||
2006-09-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* dbus/dbus-server.c (dbus_server_listen): change how this works
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ AM_MAINTAINER_MODE
|
|||
#
|
||||
|
||||
## increment if the interface has additions, changes, removals.
|
||||
LT_CURRENT=3
|
||||
LT_CURRENT=4
|
||||
|
||||
## increment any time the source changes; set to
|
||||
## 0 if you increment CURRENT
|
||||
|
|
@ -34,7 +34,7 @@ LT_REVISION=0
|
|||
## increment if any interfaces have been added; set to 0
|
||||
## if any interfaces have been changed or removed. removal has
|
||||
## precedence over adding, so set to 0 if both happened.
|
||||
LT_AGE=0
|
||||
LT_AGE=1
|
||||
|
||||
AC_SUBST(LT_CURRENT)
|
||||
AC_SUBST(LT_REVISION)
|
||||
|
|
|
|||
|
|
@ -606,6 +606,9 @@ dbus_bus_get_unique_name (DBusConnection *connection)
|
|||
* Asks the bus to return the uid of the named
|
||||
* connection.
|
||||
*
|
||||
* Not going to work on Windows, the bus should return
|
||||
* an error then.
|
||||
*
|
||||
* @param connection the connection
|
||||
* @param name a name owned by the connection
|
||||
* @param error location to store the error
|
||||
|
|
|
|||
|
|
@ -4224,8 +4224,12 @@ dbus_connection_set_dispatch_status_function (DBusConnection *connec
|
|||
* connections will have a file descriptor. So for adding descriptors
|
||||
* to the main loop, use dbus_watch_get_fd() and so forth.
|
||||
*
|
||||
* @todo this function should be called get_socket_fd or something;
|
||||
* there's no reason it can't work on Windows sockets also.
|
||||
* If the connection is socket-based, you can also use
|
||||
* dbus_connection_get_socket(), which will work on Windows too.
|
||||
* This function always fails on Windows.
|
||||
*
|
||||
* Right now the returned descriptor is always a socket, but
|
||||
* that is not guaranteed.
|
||||
*
|
||||
* @param connection the connection
|
||||
* @param fd return location for the file descriptor.
|
||||
|
|
@ -4234,6 +4238,36 @@ dbus_connection_set_dispatch_status_function (DBusConnection *connec
|
|||
dbus_bool_t
|
||||
dbus_connection_get_unix_fd (DBusConnection *connection,
|
||||
int *fd)
|
||||
{
|
||||
_dbus_return_val_if_fail (connection != NULL, FALSE);
|
||||
_dbus_return_val_if_fail (connection->transport != NULL, FALSE);
|
||||
|
||||
#ifdef DBUS_WIN
|
||||
/* FIXME do this on a lower level */
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return dbus_connection_get_socket(connection, fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the underlying Windows or UNIX socket file descriptor
|
||||
* of the connection, if any. DO NOT read or write to the file descriptor, or try to
|
||||
* select() on it; use DBusWatch for main loop integration. Not all
|
||||
* connections will have a socket. So for adding descriptors
|
||||
* to the main loop, use dbus_watch_get_fd() and so forth.
|
||||
*
|
||||
* If the connection is not socket-based, this function will return FALSE,
|
||||
* even if the connection does have a file descriptor of some kind.
|
||||
* i.e. this function always returns specifically a socket file descriptor.
|
||||
*
|
||||
* @param connection the connection
|
||||
* @param fd return location for the file descriptor.
|
||||
* @returns #TRUE if fd is successfully obtained.
|
||||
*/
|
||||
dbus_bool_t
|
||||
dbus_connection_get_socket(DBusConnection *connection,
|
||||
int *fd)
|
||||
{
|
||||
dbus_bool_t retval;
|
||||
|
||||
|
|
@ -4250,6 +4284,7 @@ dbus_connection_get_unix_fd (DBusConnection *connection,
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the UNIX user ID of the connection if any.
|
||||
* Returns #TRUE if the uid is filled in.
|
||||
|
|
@ -4340,6 +4375,13 @@ dbus_connection_get_unix_process_id (DBusConnection *connection,
|
|||
* only the same UID as the server process will be allowed to
|
||||
* connect.
|
||||
*
|
||||
* On Windows, the function will be set and its free_data_function will
|
||||
* be invoked when the connection is freed or a new function is set.
|
||||
* However, the function will never be called, because there are
|
||||
* no UNIX user ids to pass to it.
|
||||
*
|
||||
* @todo add a Windows API analogous to dbus_connection_set_unix_user_function()
|
||||
*
|
||||
* @param connection the connection
|
||||
* @param function the predicate
|
||||
* @param data data to pass to the predicate
|
||||
|
|
|
|||
|
|
@ -255,6 +255,8 @@ dbus_bool_t dbus_connection_list_registered (DBusConnection
|
|||
|
||||
dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
|
||||
int *fd);
|
||||
dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
|
||||
int *fd);
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -524,11 +524,28 @@ _dbus_transport_get_is_authenticated (DBusTransport *transport)
|
|||
|
||||
_dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
|
||||
_dbus_connection_unlock (connection);
|
||||
|
||||
|
||||
#ifdef DBUS_WIN
|
||||
/* FIXME this is a bad hack for now because we want to ship 1.0
|
||||
* without leaking any weird unix-emulation implementation details
|
||||
* to the public API. The correct fix will be to move this
|
||||
* unix user function invocation into dbus-transport-unix.c, and
|
||||
* have a separate, appropriate function for Windows, if any.
|
||||
* On Windows we may only use the session (not system) daemon
|
||||
* anyway, so it might not matter.
|
||||
*
|
||||
* The windows and unix callbacks should both be stored/set
|
||||
* in cross-platform code, so apps can unconditionally set
|
||||
* them both, but only the platform-appropriate one
|
||||
* should ever be invoked.
|
||||
*/
|
||||
allow = TRUE;
|
||||
#else
|
||||
allow = (* unix_user_function) (connection,
|
||||
auth_identity.uid,
|
||||
unix_user_data);
|
||||
|
||||
#endif
|
||||
|
||||
_dbus_verbose ("lock %s post unix user function\n", _DBUS_FUNCTION_NAME);
|
||||
_dbus_connection_lock (connection);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue