summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2010-04-27 22:00:07 -0400
committerDavid Zeuthen <davidz@redhat.com>2010-04-27 22:00:07 -0400
commit613d9a9ed07078feb2863fd6c5c2c1c9c8f121a1 (patch)
treeab48502d4e305d3d0e9b6e04df47e0c6ac8f04c6
parent8d4fe5aa5eceafad13d74ddc9feeb076413bff1c (diff)
Clarify that g_dbus_connection_new_for_address() is client-only
Ditto for g_dbus_address_get_stream().
-rw-r--r--gdbus/gdbusaddress.c8
-rw-r--r--gdbus/gdbusconnection.c26
2 files changed, 28 insertions, 6 deletions
diff --git a/gdbus/gdbusaddress.c b/gdbus/gdbusaddress.c
index 4ceb8e0..3eb01c3 100644
--- a/gdbus/gdbusaddress.c
+++ b/gdbus/gdbusaddress.c
@@ -352,8 +352,8 @@ get_stream_thread_func (GSimpleAsyncResult *res,
* @user_data: Data to pass to @callback.
*
* Asynchronously connects to an endpoint specified by @address and
- * sets up the connection so it is in a state to run the D-Bus
- * authentication conversation.
+ * sets up the connection so it is in a state to run the client-side
+ * of the D-Bus authentication conversation.
*
* When the operation is finished, @callback will be invoked. You can
* then call g_dbus_address_get_stream_finish() to get the result of
@@ -436,8 +436,8 @@ g_dbus_address_get_stream_finish (GAsyncResult *res,
* @error: Return location for error or %NULL.
*
* Synchronously connects to an endpoint specified by @address and
- * sets up the connection so it is in a state to run the D-Bus
- * authentication conversation.
+ * sets up the connection so it is in a state to run the client-side
+ * of the D-Bus authentication conversation.
*
* This is a synchronous failable function. See
* g_dbus_address_get_stream() for the asynchronous version.
diff --git a/gdbus/gdbusconnection.c b/gdbus/gdbusconnection.c
index 0d2e6ba..fc9fe70 100644
--- a/gdbus/gdbusconnection.c
+++ b/gdbus/gdbusconnection.c
@@ -1475,6 +1475,16 @@ initable_init (GInitable *initable,
{
g_assert (connection->priv->stream == NULL);
+ if ((connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER) ||
+ (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS))
+ {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("Unsupported flags encountered when constructing a client-side connection"));
+ goto out;
+ }
+
connection->priv->stream = g_dbus_address_get_stream_sync (connection->priv->address,
NULL, /* TODO: out_guid */
cancellable,
@@ -1754,10 +1764,16 @@ g_dbus_connection_new_sync (GIOStream *stream,
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: The data to pass to @callback.
*
- * Asynchronously connects and sets up a D-Bus connection for
+ * Asynchronously connects and sets up a D-Bus client connection for
* exchanging D-Bus messages with an endpoint specified by @address
* which must be in the D-Bus address format.
*
+ * This constructor can only be used to initiate client-side
+ * connections - use g_dbus_connection_new() if you need to act as the
+ * server. In particular, @flags cannot contain the
+ * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
+ * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
+ *
* When the operation is finished, @callback will be invoked. You can
* then call g_dbus_connection_new_finish() to get the result of the
* operation.
@@ -1822,10 +1838,16 @@ g_dbus_connection_new_for_address_finish (GAsyncResult *res,
* @cancellable: A #GCancellable or %NULL.
* @error: Return location for error or %NULL.
*
- * Synchronously connects and sets up a D-Bus connection for
+ * Synchronously connects and sets up a D-Bus client connection for
* exchanging D-Bus messages with an endpoint specified by @address
* which must be in the D-Bus address format.
*
+ * This constructor can only be used to initiate client-side
+ * connections - use g_dbus_connection_new_sync() if you need to act
+ * as the server. In particular, @flags cannot contain the
+ * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or
+ * %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.
+ *
* This is a synchronous failable constructor. See
* g_dbus_connection_new_for_address() for the asynchronous version.
*