mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
GDBus: Add GDBusAuthObserver param in g_dbus_connection_new_for_address()
This is to match g_dbus_connection_new(). This extension allows us to extend GDBusAuthObserver to also be used in client-side authentication in the future (right now it's only used on the server-side).
This commit is contained in:
parent
cb753dfd49
commit
60e7ae26af
@ -424,6 +424,7 @@ connection_get_dbus_connection (GError **error)
|
||||
{
|
||||
c = g_dbus_connection_new_for_address_sync (opt_connection_address,
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
NULL, /* GCancellable */
|
||||
error);
|
||||
}
|
||||
|
@ -1948,8 +1948,7 @@ async_initable_iface_init (GAsyncInitableIface *async_initable_iface)
|
||||
* Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
|
||||
* with the end represented by @stream.
|
||||
*
|
||||
* If %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER is set in @flags,
|
||||
* @observer (if not %NULL) is used to assist in the client
|
||||
* If @observer is not %NULL it may be used to control the
|
||||
* authentication process.
|
||||
*
|
||||
* When the operation is finished, @callback will be invoked. You can
|
||||
@ -2029,8 +2028,7 @@ g_dbus_connection_new_finish (GAsyncResult *res,
|
||||
* Synchronously sets up a D-Bus connection for exchanging D-Bus messages
|
||||
* with the end represented by @stream.
|
||||
*
|
||||
* If %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER is set in @flags,
|
||||
* @observer (if not %NULL) is used to assist in the client
|
||||
* If @observer is not %NULL it may be used to control the
|
||||
* authentication process.
|
||||
*
|
||||
* This is a synchronous failable constructor. See
|
||||
@ -2066,6 +2064,7 @@ g_dbus_connection_new_sync (GIOStream *stream,
|
||||
* g_dbus_connection_new_for_address:
|
||||
* @address: A D-Bus address.
|
||||
* @flags: Flags describing how to make the connection.
|
||||
* @observer: A #GDBusAuthObserver or %NULL.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
||||
* @user_data: The data to pass to @callback.
|
||||
@ -2084,6 +2083,9 @@ g_dbus_connection_new_sync (GIOStream *stream,
|
||||
* then call g_dbus_connection_new_finish() to get the result of the
|
||||
* operation.
|
||||
*
|
||||
* If @observer is not %NULL it may be used to control the
|
||||
* authentication process.
|
||||
*
|
||||
* This is a asynchronous failable constructor. See
|
||||
* g_dbus_connection_new_for_address_sync() for the synchronous
|
||||
* version.
|
||||
@ -2093,6 +2095,7 @@ g_dbus_connection_new_sync (GIOStream *stream,
|
||||
void
|
||||
g_dbus_connection_new_for_address (const gchar *address,
|
||||
GDBusConnectionFlags flags,
|
||||
GDBusAuthObserver *observer,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@ -2105,6 +2108,7 @@ g_dbus_connection_new_for_address (const gchar *address,
|
||||
user_data,
|
||||
"address", address,
|
||||
"flags", flags,
|
||||
"authentication-observer", observer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -2145,6 +2149,7 @@ g_dbus_connection_new_for_address_finish (GAsyncResult *res,
|
||||
* g_dbus_connection_new_for_address_sync:
|
||||
* @address: A D-Bus address.
|
||||
* @flags: Flags describing how to make the connection.
|
||||
* @observer: A #GDBusAuthObserver or %NULL.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @error: Return location for error or %NULL.
|
||||
*
|
||||
@ -2161,6 +2166,9 @@ g_dbus_connection_new_for_address_finish (GAsyncResult *res,
|
||||
* This is a synchronous failable constructor. See
|
||||
* g_dbus_connection_new_for_address() for the asynchronous version.
|
||||
*
|
||||
* If @observer is not %NULL it may be used to control the
|
||||
* authentication process.
|
||||
*
|
||||
* Returns: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
|
||||
*
|
||||
* Since: 2.26
|
||||
@ -2168,6 +2176,7 @@ g_dbus_connection_new_for_address_finish (GAsyncResult *res,
|
||||
GDBusConnection *
|
||||
g_dbus_connection_new_for_address_sync (const gchar *address,
|
||||
GDBusConnectionFlags flags,
|
||||
GDBusAuthObserver *observer,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@ -2178,6 +2187,7 @@ g_dbus_connection_new_for_address_sync (const gchar *address,
|
||||
error,
|
||||
"address", address,
|
||||
"flags", flags,
|
||||
"authentication-observer", observer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,7 @@ GDBusConnection *g_dbus_connection_new_sync (GIOStream
|
||||
|
||||
void g_dbus_connection_new_for_address (const gchar *address,
|
||||
GDBusConnectionFlags flags,
|
||||
GDBusAuthObserver *observer,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
@ -124,6 +125,7 @@ GDBusConnection *g_dbus_connection_new_for_address_finish (GAsyncResult
|
||||
GError **error);
|
||||
GDBusConnection *g_dbus_connection_new_for_address_sync (const gchar *address,
|
||||
GDBusConnectionFlags flags,
|
||||
GDBusAuthObserver *observer,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
|
@ -259,6 +259,7 @@ main (int argc, char *argv[])
|
||||
error = NULL;
|
||||
connection = g_dbus_connection_new_for_address_sync (opt_address,
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
NULL, /* GCancellable */
|
||||
&error);
|
||||
if (connection == NULL)
|
||||
|
@ -478,6 +478,7 @@ test_peer (void)
|
||||
* will fail because the nonce file doesn't exist */
|
||||
"nonce-tcp:host=localhost,port=12345,noncefile=this-does-not-exist-gdbus",
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
NULL, /* cancellable */
|
||||
&error);
|
||||
_g_assert_error_domain (error, G_IO_ERROR);
|
||||
@ -500,6 +501,7 @@ test_peer (void)
|
||||
error = NULL;
|
||||
c = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
NULL, /* cancellable */
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
@ -624,6 +626,7 @@ test_peer (void)
|
||||
error = NULL;
|
||||
c2 = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
NULL, /* cancellable */
|
||||
&error);
|
||||
_g_assert_error_domain (error, G_IO_ERROR);
|
||||
@ -639,6 +642,7 @@ test_peer (void)
|
||||
data.accept_connection = TRUE;
|
||||
c2 = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
NULL, /* cancellable */
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
|
@ -147,6 +147,7 @@ _g_bus_get_priv (GBusType bus_type,
|
||||
ret = g_dbus_connection_new_for_address_sync (address,
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
|
||||
G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
|
||||
NULL, /* GDBusAuthObserver */
|
||||
cancellable,
|
||||
error);
|
||||
g_free (address);
|
||||
|
Loading…
Reference in New Issue
Block a user