2006-09-17 Havoc Pennington <hp@redhat.com>
authorHavoc Pennington <hp@redhat.com>
Sun, 17 Sep 2006 17:11:31 +0000 (17:11 +0000)
committerHavoc Pennington <hp@redhat.com>
Sun, 17 Sep 2006 17:11:31 +0000 (17:11 +0000)
* dbus/dbus-transport.c (_dbus_transport_get_is_authenticated):
fix so that if unix_user_function is set on windows, we still
do the default check that the auth identity matches the bus identity

ChangeLog
dbus/dbus-transport.c

index 463185e..3b2ece0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-17  Havoc Pennington  <hp@redhat.com>
+
+       * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated):
+       fix so that if unix_user_function is set on windows, we still
+       do the default check that the auth identity matches the bus identity
+
 2006-09-16  Havoc Pennington  <hp@redhat.com>
 
        * dbus/dbus-transport.c (_dbus_transport_open): modify to delegate
index 7b8558d..89d79ff 100644 (file)
@@ -385,7 +385,16 @@ _dbus_transport_get_is_connected (DBusTransport *transport)
  */
 dbus_bool_t
 _dbus_transport_get_is_authenticated (DBusTransport *transport)
-{  
+{
+  /* We don't want to run unix_user_function on Windows, but it
+   * can exist, which allows application code to just unconditionally
+   * set it and have it only be invoked when appropriate.
+   */
+  dbus_bool_t on_windows = FALSE;
+#ifdef DBUS_WIN
+  on_windows = TRUE;
+#endif
+  
   if (transport->authenticated)
     return TRUE;
   else
@@ -457,7 +466,7 @@ _dbus_transport_get_is_authenticated (DBusTransport *transport)
 
           _dbus_auth_get_identity (transport->auth, &auth_identity);
 
-          if (transport->unix_user_function != NULL)
+          if (transport->unix_user_function != NULL && !on_windows)
             {
               dbus_bool_t allow;
               DBusConnection *connection;
@@ -473,26 +482,9 @@ _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);