[glib/gdbus-merge] GDBus: Rename ::deny-authentication-peer to ::authorize-authenticated-peer
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/gdbus-merge] GDBus: Rename ::deny-authentication-peer to ::authorize-authenticated-peer
- Date: Thu, 13 May 2010 20:22:13 +0000 (UTC)
commit cb753dfd496ae70b069c1698da8211c454953f08
Author: David Zeuthen <davidz redhat com>
Date: Thu May 13 16:20:31 2010 -0400
GDBus: Rename ::deny-authentication-peer to ::authorize-authenticated-peer
docs/reference/gio/gio-sections.txt | 2 +-
gio/gdbusauth.c | 8 ++--
gio/gdbusauthobserver.c | 74 +++++++++++++++++++++--------------
gio/gdbusauthobserver.h | 18 ++++----
gio/gdbusconnection.c | 2 -
gio/gio.symbols | 2 +-
gio/tests/gdbus-peer.c | 20 +++++-----
7 files changed, 70 insertions(+), 56 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index 3047f8e..cc0a890 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -2240,7 +2240,7 @@ g_dbus_is_interface_name
GDBusAuthObserver
GDBusAuthObserverClass
g_dbus_auth_observer_new
-g_dbus_auth_observer_deny_authenticated_peer
+g_dbus_auth_observer_authorize_authenticated_peer
<SUBSECTION Standard>
G_DBUS_AUTH_OBSERVER
G_IS_DBUS_AUTH_OBSERVER
diff --git a/gio/gdbusauth.c b/gio/gdbusauth.c
index f774eee..a94fcfa 100644
--- a/gio/gdbusauth.c
+++ b/gio/gdbusauth.c
@@ -1132,15 +1132,15 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
{
case G_DBUS_AUTH_MECHANISM_STATE_ACCEPTED:
if (observer != NULL &&
- g_dbus_auth_observer_deny_authenticated_peer (observer,
- auth->priv->stream,
- credentials))
+ !g_dbus_auth_observer_authorize_authenticated_peer (observer,
+ auth->priv->stream,
+ credentials))
{
/* disconnect */
g_set_error_literal (error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
- _("Cancelled via GDBusAuthObserver::deny-authenticated-peer"));
+ _("Cancelled via GDBusAuthObserver::authorize-authenticated-peer"));
goto out;
}
else
diff --git a/gio/gdbusauthobserver.c b/gio/gdbusauthobserver.c
index 948659b..d7fb73a 100644
--- a/gio/gdbusauthobserver.c
+++ b/gio/gdbusauthobserver.c
@@ -46,24 +46,24 @@
* processes owned by the same uid as the server, you would do this:
* <example id="auth-observer"><title>Controlling Authentication</title><programlisting>
* static gboolean
- * on_deny_authenticated_peer (GDBusAuthObserver *observer,
- * GIOStream *stream,
- * GCredentials *credentials,
- * gpointer user_data)
+ * on_authorize_authenticated_peer (GDBusAuthObserver *observer,
+ * GIOStream *stream,
+ * GCredentials *credentials,
+ * gpointer user_data)
* {
* GCredentials *me;
- * gboolean deny;
+ * gboolean authorized;
*
- * deny = TRUE;
+ * authorized = FALSE;
* me = g_credentials_new ();
*
* if (credentials != NULL &&
* !g_credentials_is_same_user (credentials, me))
- * deny = FALSE;
+ * authorized = TRUE;
*
* g_object_unref (me);
*
- * return deny;
+ * return authorized;
* }
*
* static gboolean
@@ -88,8 +88,8 @@
* NULL, /<!-- -->* GCancellable *<!-- -->/
* &error);
* g_signal_connect (observer,
- * "deny-authenticated-peer",
- * G_CALLBACK (on_deny_authenticated_peer),
+ * "authorize-authenticated-peer",
+ * G_CALLBACK (on_authorize_authenticated_peer),
* NULL);
* g_signal_connect (server,
* "new-connection",
@@ -107,7 +107,7 @@ struct _GDBusAuthObserverPrivate
enum
{
- DENY_AUTHENTICATED_PEER_SIGNAL,
+ AUTHORIZE_AUTHENTICATED_PEER_SIGNAL,
LAST_SIGNAL,
};
@@ -124,11 +124,27 @@ g_dbus_auth_observer_finalize (GObject *object)
}
static gboolean
-g_dbus_auth_observer_deny_authenticated_peer_real (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials)
+g_dbus_auth_observer_authorize_authenticated_peer_real (GDBusAuthObserver *observer,
+ GIOStream *stream,
+ GCredentials *credentials)
+{
+ return TRUE;
+}
+
+gboolean
+_g_signal_accumulator_false_handled (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy)
{
- return FALSE;
+ gboolean continue_emission;
+ gboolean signal_handled;
+
+ signal_handled = g_value_get_boolean (handler_return);
+ g_value_set_boolean (return_accu, signal_handled);
+ continue_emission = signal_handled;
+
+ return continue_emission;
}
static void
@@ -138,27 +154,27 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
gobject_class->finalize = g_dbus_auth_observer_finalize;
- klass->deny_authenticated_peer = g_dbus_auth_observer_deny_authenticated_peer_real;
+ klass->authorize_authenticated_peer = g_dbus_auth_observer_authorize_authenticated_peer_real;
/**
- * GDBusAuthObserver::deny-authenticated-peer:
+ * GDBusAuthObserver::authorize-authenticated-peer:
* @observer: The #GDBusAuthObserver emitting the signal.
* @stream: A #GIOStream for the #GDBusConnection.
* @credentials: Credentials received from the peer or %NULL.
*
* Emitted to check if a peer that is successfully authenticated
- * should be denied.
+ * is authorized.
*
- * Returns: %TRUE if the peer should be denied, %FALSE otherwise.
+ * Returns: %TRUE if the peer is authorized, %FALSE if not.
*
* Since: 2.26
*/
- signals[DENY_AUTHENTICATED_PEER_SIGNAL] =
- g_signal_new ("deny-authenticated-peer",
+ signals[AUTHORIZE_AUTHENTICATED_PEER_SIGNAL] =
+ g_signal_new ("authorize-authenticated-peer",
G_TYPE_DBUS_AUTH_OBSERVER,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GDBusAuthObserverClass, deny_authenticated_peer),
- g_signal_accumulator_true_handled,
+ G_STRUCT_OFFSET (GDBusAuthObserverClass, authorize_authenticated_peer),
+ _g_signal_accumulator_false_handled,
NULL, /* accu_data */
_gio_marshal_BOOLEAN__OBJECT_OBJECT,
G_TYPE_BOOLEAN,
@@ -197,27 +213,27 @@ g_dbus_auth_observer_new (void)
/* ---------------------------------------------------------------------------------------------------- */
/**
- * g_dbus_auth_observer_deny_authenticated_peer:
+ * g_dbus_auth_observer_authorize_authenticated_peer:
* @observer: A #GDBusAuthObserver.
* @stream: A #GIOStream for the #GDBusConnection.
* @credentials: Credentials received from the peer or %NULL.
*
- * Emits the #GDBusAuthObserver::deny-authenticated-peer signal on @observer.
+ * Emits the #GDBusAuthObserver::authorize-authenticated-peer signal on @observer.
*
* Returns: %TRUE if the peer should be denied, %FALSE otherwise.
*
* Since: 2.26
*/
gboolean
-g_dbus_auth_observer_deny_authenticated_peer (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials)
+g_dbus_auth_observer_authorize_authenticated_peer (GDBusAuthObserver *observer,
+ GIOStream *stream,
+ GCredentials *credentials)
{
gboolean denied;
denied = FALSE;
g_signal_emit (observer,
- signals[DENY_AUTHENTICATED_PEER_SIGNAL],
+ signals[AUTHORIZE_AUTHENTICATED_PEER_SIGNAL],
0,
stream,
credentials,
diff --git a/gio/gdbusauthobserver.h b/gio/gdbusauthobserver.h
index ac3e234..b408365 100644
--- a/gio/gdbusauthobserver.h
+++ b/gio/gdbusauthobserver.h
@@ -40,7 +40,7 @@ typedef struct _GDBusAuthObserverPrivate GDBusAuthObserverPrivate;
/**
* GDBusAuthObserverClass:
- * @deny_authenticated_peer: Signal class handler for the #GDBusAuthObserver::deny-authenticated-peer signal.
+ * @authorize_authenticated_peer: Signal class handler for the #GDBusAuthObserver::authorize-authenticated-peer signal.
*
* Class structure for #GDBusAuthObserverClass.
*
@@ -54,9 +54,9 @@ struct _GDBusAuthObserverClass
/*< public >*/
/* Signals */
- gboolean (*deny_authenticated_peer) (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials);
+ gboolean (*authorize_authenticated_peer) (GDBusAuthObserver *observer,
+ GIOStream *stream,
+ GCredentials *credentials);
/*< private >*/
@@ -93,11 +93,11 @@ struct _GDBusAuthObserver
GDBusAuthObserverPrivate *priv;
};
-GType g_dbus_auth_observer_get_type (void) G_GNUC_CONST;
-GDBusAuthObserver *g_dbus_auth_observer_new (void);
-gboolean g_dbus_auth_observer_deny_authenticated_peer (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials);
+GType g_dbus_auth_observer_get_type (void) G_GNUC_CONST;
+GDBusAuthObserver *g_dbus_auth_observer_new (void);
+gboolean g_dbus_auth_observer_authorize_authenticated_peer (GDBusAuthObserver *observer,
+ GIOStream *stream,
+ GCredentials *credentials);
G_END_DECLS
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 80ae8b6..ccb2729 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -100,8 +100,6 @@
* when the returned GVariant is floating.
*
* - Consistent timeout handling (25s vs 30s?)
- *
- * - Update GDBusAuthObserver (s/deny/authorize/)
*/
#include "config.h"
diff --git a/gio/gio.symbols b/gio/gio.symbols
index 0d7c106..da6eb93 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -1475,7 +1475,7 @@ g_dbus_address_get_stream_sync
#if IN_FILE(__G_DBUS_AUTH_OBSERVER_C__)
g_dbus_auth_observer_get_type G_GNUC_CONST
g_dbus_auth_observer_new
-g_dbus_auth_observer_deny_authenticated_peer
+g_dbus_auth_observer_authorize_authenticated_peer
#endif
#endif
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index b0e4977..f78aa5c 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -203,24 +203,24 @@ on_proxy_signal_received (GDBusProxy *proxy,
/* ---------------------------------------------------------------------------------------------------- */
static gboolean
-on_deny_authenticated_peer (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials,
- gpointer user_data)
+on_authorize_authenticated_peer (GDBusAuthObserver *observer,
+ GIOStream *stream,
+ GCredentials *credentials,
+ gpointer user_data)
{
PeerData *data = user_data;
- gboolean deny_peer;
+ gboolean authorized;
data->num_connection_attempts++;
- deny_peer = FALSE;
+ authorized = TRUE;
if (!data->accept_connection)
{
- deny_peer = TRUE;
+ authorized = FALSE;
g_main_loop_quit (loop);
}
- return deny_peer;
+ return authorized;
}
/* Runs in thread we created GDBusServer in (since we didn't pass G_DBUS_SERVER_FLAGS_RUN_IN_THREAD) */
@@ -280,8 +280,8 @@ service_thread_func (gpointer user_data)
G_CALLBACK (on_new_connection),
data);
g_signal_connect (observer,
- "deny-authenticated-peer",
- G_CALLBACK (on_deny_authenticated_peer),
+ "authorize-authenticated-peer",
+ G_CALLBACK (on_authorize_authenticated_peer),
data);
g_object_unref (observer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]