From ee27481d7b7d6d9a4f41b7d641a2618dedf676dd Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 26 Feb 2005 06:37:46 +0000 Subject: 2005-02-26 Havoc Pennington * doc/TODO: remove the "guid" item * test/glib/test-profile.c (no_bus_thread_func): use open_private (with_bus_thread_func): use open_private * dbus/dbus-connection.c (dbus_connection_open_private): new function that works like the old dbus_connection_open() (dbus_connection_open): now returns an existing connection if possible * dbus/dbus-server-unix.c (handle_new_client_fd_and_unlock): pass through the GUID to the transport * dbus/dbus-server.c (_dbus_server_init_base): keep around the GUID in hex-encoded form. * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): pass GUID argument in to the transport * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd): add guid argument * dbus/dbus-transport.c (_dbus_transport_init_base): add guid argument * dbus/dbus-auth.c (_dbus_auth_server_new): add guid argument --- dbus/dbus-auth.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'dbus/dbus-auth.c') diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c index 6412185b..2a1bbd4c 100644 --- a/dbus/dbus-auth.c +++ b/dbus/dbus-auth.c @@ -211,6 +211,8 @@ typedef struct int failures; /**< Number of times client has been rejected */ int max_failures; /**< Number of times we reject before disconnect */ + + DBusString guid; /**< Our globally unique ID in hex encoding */ } DBusAuthServer; @@ -1923,20 +1925,35 @@ process_command (DBusAuth *auth) * @returns the new object or #NULL if no memory */ DBusAuth* -_dbus_auth_server_new (void) +_dbus_auth_server_new (const DBusString *guid) { DBusAuth *auth; DBusAuthServer *server_auth; + DBusString guid_copy; - auth = _dbus_auth_new (sizeof (DBusAuthServer)); - if (auth == NULL) + if (!_dbus_string_init (&guid_copy)) return NULL; + if (!_dbus_string_copy (guid, 0, &guid_copy, 0)) + { + _dbus_string_free (&guid_copy); + return NULL; + } + + auth = _dbus_auth_new (sizeof (DBusAuthServer)); + if (auth == NULL) + { + _dbus_string_free (&guid_copy); + return NULL; + } + auth->side = auth_side_server; auth->state = &server_state_waiting_for_auth; server_auth = DBUS_AUTH_SERVER (auth); + server_auth->guid = guid_copy; + /* perhaps this should be per-mechanism with a lower * max */ @@ -2012,6 +2029,12 @@ _dbus_auth_unref (DBusAuth *auth) { _dbus_list_clear (& DBUS_AUTH_CLIENT (auth)->mechs_to_try); } + else + { + _dbus_assert (DBUS_AUTH_IS_SERVER (auth)); + + _dbus_string_free (& DBUS_AUTH_SERVER (auth)->guid); + } if (auth->keyring) _dbus_keyring_unref (auth->keyring); -- cgit