daemon/dbus: error propagation support added
authorAmarnath Valluri <amarnath.valluri@linux.intel.com>
Thu, 28 Feb 2013 15:56:38 +0000 (17:56 +0200)
committerAmarnath Valluri <amarnath.valluri@linux.intel.com>
Fri, 1 Mar 2013 12:29:58 +0000 (14:29 +0200)
16 files changed:
include/gsignond/gsignond-error.h
src/common/gsignond-error.c
src/daemon/db/gsignond-db-credentials-database.c
src/daemon/db/gsignond-db-credentials-database.h
src/daemon/db/gsignond-db-metadata-database.c
src/daemon/dbus/gsignond-dbus-auth-service-adapter.c
src/daemon/dbus/gsignond-dbus-auth-session-adapter.c
src/daemon/dbus/gsignond-dbus-identity-adapter.c
src/daemon/gsignond-auth-service-iface.c
src/daemon/gsignond-auth-service-iface.h
src/daemon/gsignond-auth-session-iface.c
src/daemon/gsignond-auth-session-iface.h
src/daemon/gsignond-auth-session.c
src/daemon/gsignond-identity-iface.c
src/daemon/gsignond-identity-iface.h
src/daemon/gsignond-identity.c

index 3297cab..e308571 100644 (file)
@@ -42,68 +42,49 @@ G_BEGIN_DECLS
 typedef enum {
     GSIGNOND_ERROR_NONE,
 
-    GSIGNOND_ERROR_UNKNOWN = 1,               /**< Catch-all for errors not distinguished
-                                        by another code. */
+    GSIGNOND_ERROR_UNKNOWN = 1,                /**< Catch-all for errors not distinguished by another code. */
     GSIGNOND_ERROR_INTERNAL_SERVER = 2,        /**< Signon Daemon internal error. */
-    GSIGNOND_ERROR_INTERNAL_COMMUNICATION = 3, /**< Communication with Signon Daemon
-                                     error. */
-    GSIGNOND_ERROR_PERMISSION_DENIED = 4,      /**< The operation cannot be performed due to
-                                        insufficient client permissions. */
-    GSIGNOND_ERROR_ENCRYPTION_FAILURE,         /**< Failure during data
-                                     encryption/decryption. */
-    GSIGNOND_ERROR_AUTH_SERVICE_ERR = 100,           /* Placeholder to rearrange enumeration
-                                         - AuthService specific */
-    GSIGNOND_ERROR_METHOD_NOT_KNOWN,            /**< The method with this name is not
-                                     found. */
-    GSIGNOND_ERROR_SERVICE_NOT_AVAILABLE,       /**< The service is temporarily
-                                     unavailable. */
-    GSIGNOND_ERROR_INVALID_QUERY,              /**< Parameters for the query are invalid. */
-    GSIGNOND_ERROR_IDENTITY_ERR = 200,              /* Placeholder to rearrange enumeration
-                                         - Identity specific */
+    GSIGNOND_ERROR_INTERNAL_COMMUNICATION = 3, /**< Communication with Signon Daemon error. */
+    GSIGNOND_ERROR_PERMISSION_DENIED = 4,      /**< The operation cannot be performed due to insufficient client permissions. */
+    GSIGNOND_ERROR_ENCRYPTION_FAILURE,         /**< Failure during data encryption/decryption. */
+
+    GSIGNOND_ERROR_AUTH_SERVICE_ERR = 100,      /* Placeholder to rearrange enumeration - AuthService specific */
+    GSIGNOND_ERROR_METHOD_NOT_KNOWN,            /**< The method with this name is not found. */
+    GSIGNOND_ERROR_SERVICE_NOT_AVAILABLE,       /**< The service is temporarily unavailable. */
+    GSIGNOND_ERROR_INVALID_QUERY,               /**< Parameters for the query are invalid. */
+
+    GSIGNOND_ERROR_IDENTITY_ERR = 200,          /* Placeholder to rearrange enumeration - Identity specific */
     GSIGNOND_ERROR_METHOD_NOT_AVAILABLE,        /**< The requested method is not available. */
-    GSIGNOND_ERROR_IDENTITY_NOT_FOUND,          /**< The identity matching this Identity
-                                     object was not found on the service. */
-    GSIGNOND_ERROR_STORE_FAILED,               /**< Storing credentials failed. */
-    GSIGNOND_ERROR_REMOVE_FAILED,              /**< Removing credentials failed. */
+    GSIGNOND_ERROR_IDENTITY_NOT_FOUND,          /**< The identity matching this Identity object was not found on the service. */
+    GSIGNOND_ERROR_STORE_FAILED,                /**< Storing credentials failed. */
+    GSIGNOND_ERROR_REMOVE_FAILED,               /**< Removing credentials failed. */
     GSIGNOND_ERROR_SIGN_OUT_FAILED,             /**< SignOut failed. */
-    GSIGNOND_ERROR_IDENTITY_OPERATION_CANCELED, /**< Identity operation was canceled by
-                                     user. */
+    GSIGNOND_ERROR_IDENTITY_OPERATION_CANCELED, /**< Identity operation was canceled by user. */
     GSIGNOND_ERROR_CREDENTIALS_NOT_AVAILABLE,   /**< Query failed. */
-    GSIGNOND_ERROR_REFERENCE_NOT_FOUND,         /**< Trying to remove nonexistent
-                                     reference. */
-    GSIGNOND_ERROR_AUTH_SESSION_ERR = 300,      /* Placeholder to rearrange enumeration
-                                     - AuthSession/AuthPluginInterface
-                                     specific */
-    GSIGNOND_ERROR_MECHANISM_NOT_AVAILABLE,     /**< The requested mechanism is not
-                                     available. */
-    GSIGNOND_ERROR_MISSING_DATA,               /**< The SessionData object does not contain
-                                        necessary information. */
-    GSIGNOND_ERROR_INVALID_CREDENTIALS,        /**< The supplied credentials are invalid for
-                                        the mechanism implementation. */
+    GSIGNOND_ERROR_REFERENCE_NOT_FOUND,         /**< Trying to remove nonexistent reference. */
+
+    GSIGNOND_ERROR_AUTH_SESSION_ERR = 300,     /* Placeholder to rearrange enumeration - AuthSession/PluginInterface specific */
+    GSIGNOND_ERROR_MECHANISM_NOT_AVAILABLE,    /**< The requested mechanism is not available. */
+    GSIGNOND_ERROR_MISSING_DATA,               /**< The SessionData object does not contain necessary information. */
+    GSIGNOND_ERROR_INVALID_CREDENTIALS,        /**< The supplied credentials are invalid for the mechanism implementation. */
     GSIGNOND_ERROR_NOT_AUTHORIZED,             /**< Authorization failed. */
-    GSIGNOND_ERROR_WRONG_STATE,                /**< An operation method has been called in
-                                        a wrong state. */
-    GSIGNOND_ERROR_OPERATION_NOT_SUPPORTED,     /**< The operation is not supported by the
-                                        mechanism implementation. */
+    GSIGNOND_ERROR_WRONG_STATE,                /**< An operation method has been called in a wrong state. */
+    GSIGNOND_ERROR_OPERATION_NOT_SUPPORTED,    /**< The operation is not supported by the mechanism implementation. */
     GSIGNOND_ERROR_NO_CONNECTION,              /**< No Network connetion. */
-    GSIGNOND_ERROR_NETWORK,                   /**< Network connetion failed. */
-    GSIGNOND_ERROR_SSL,                       /**< Ssl connection failed. */
-    GSIGNOND_ERROR_RUNTIME,                   /**< Casting SessionData into subclass
-                                     failed */
+    GSIGNOND_ERROR_NETWORK,                    /**< Network connetion failed. */
+    GSIGNOND_ERROR_SSL,                        /**< Ssl connection failed. */
+    GSIGNOND_ERROR_RUNTIME,                    /**< Casting SessionData into subclass failed */
     GSIGNOND_ERROR_SESSION_CANCELED,           /**< Challenge was cancelled. */
     GSIGNOND_ERROR_TIMED_OUT,                  /**< Challenge was timed out. */
     GSIGNOND_ERROR_USER_INTERACTION,           /**< User interaction dialog failed */
     GSIGNOND_ERROR_OPERATION_FAILED,           /**< Temporary failure in authentication. */
-    GSIGNOND_ERROR_ENCRYPTION_FAILED,          /**< @deprecated Failure during data
-                                     encryption/decryption. */
-    GSIGNOND_ERROR_TOS_NOT_ACCEPTED,            /**< User declined Terms of Service. */
-    GSIGNOND_ERROR_FORGOT_PASSWORD,            /**< User requested reset password
-                                     sequence. */
-    GSIGNOND_ERROR_METHOD_OR_MECHANISM_NOT_ALLOWED, /**< Method or mechanism not allowed for
-                                       this identity. */
+    GSIGNOND_ERROR_ENCRYPTION_FAILED,          /**< @deprecated Failure during data encryption/decryption. */
+    GSIGNOND_ERROR_TOS_NOT_ACCEPTED,           /**< User declined Terms of Service. */
+    GSIGNOND_ERROR_FORGOT_PASSWORD,            /**< User requested reset password sequence. */
+    GSIGNOND_ERROR_METHOD_OR_MECHANISM_NOT_ALLOWED, /**< Method or mechanism not allowed for this identity. */
     GSIGNOND_ERROR_INCORRECT_DATE,             /**< Date time incorrect on device. */
-    GSIGNOND_ERROR_USER_ERR = 400                   /* Placeholder to rearrange enumeration
-                                         - User space specific */
+
+    GSIGNOND_ERROR_USER_ERR = 400              /* Placeholder to rearrange enumeration - User space specific */
    
 } GSignondError;
 
@@ -135,6 +116,9 @@ gsignond_concat_domain_and_error (
 GString*
 gsignond_prepend_domain_to_error_msg (const GError *err);
 
+#define gsignond_get_gerror_for_id(err, message, args...) \
+    g_error_new (gsignond_error_quark(), err, message, ##args);
+
 G_END_DECLS
 
 #endif /* __GSIGNOND_ERROR_H__ */
index 03149d3..245b07e 100644 (file)
  * 02110-1301 USA
  */
 
+#include "gsignond/gsignond-error.h"
 #include <string.h>
+#include <gio/gio.h>
 
-#include "gsignond/gsignond-error.h"
+#define _ERROR_PREFIX "com.google.code.AccountsSSO.gSingleSignOn.Error"
+
+GDBusErrorEntry _gsignond_errors[] = 
+{
+    {GSIGNOND_ERROR_UNKNOWN, _ERROR_PREFIX".Unknown"},
+    {GSIGNOND_ERROR_INTERNAL_SERVER, _ERROR_PREFIX".InternalServerError"},
+    {GSIGNOND_ERROR_INTERNAL_COMMUNICATION, _ERROR_PREFIX".InternalCommunicationError"},
+    {GSIGNOND_ERROR_PERMISSION_DENIED, _ERROR_PREFIX".PermissionDenied"},
+    {GSIGNOND_ERROR_ENCRYPTION_FAILURE, _ERROR_PREFIX".EncryptionFailure"},
+
+    {GSIGNOND_ERROR_METHOD_NOT_KNOWN, _ERROR_PREFIX".MethodNotKnown"},
+    {GSIGNOND_ERROR_SERVICE_NOT_AVAILABLE, _ERROR_PREFIX".ServiceNotAvailable"},
+    {GSIGNOND_ERROR_INVALID_QUERY, _ERROR_PREFIX".InvalidQuery"},
+
+    {GSIGNOND_ERROR_METHOD_NOT_AVAILABLE, _ERROR_PREFIX".MethodNotAvailable"},
+    {GSIGNOND_ERROR_IDENTITY_NOT_FOUND, _ERROR_PREFIX".IdentityNotFound"},
+    {GSIGNOND_ERROR_STORE_FAILED, _ERROR_PREFIX".IdentityStoreFailed"},
+    {GSIGNOND_ERROR_REMOVE_FAILED, _ERROR_PREFIX".IdentityRemoveFailed"},
+    {GSIGNOND_ERROR_SIGN_OUT_FAILED, _ERROR_PREFIX".SignOutFailed"},
+    {GSIGNOND_ERROR_IDENTITY_OPERATION_CANCELED, _ERROR_PREFIX".OperationCancled"},
+    {GSIGNOND_ERROR_CREDENTIALS_NOT_AVAILABLE, _ERROR_PREFIX".CredentialsNotAvailable"},
+    {GSIGNOND_ERROR_REFERENCE_NOT_FOUND, _ERROR_PREFIX".ReferenceNotFound"},
+
+    {GSIGNOND_ERROR_MECHANISM_NOT_AVAILABLE, _ERROR_PREFIX".MechanismNotAvailable"},
+    {GSIGNOND_ERROR_MISSING_DATA, _ERROR_PREFIX".MissingData"},
+    {GSIGNOND_ERROR_INVALID_CREDENTIALS, _ERROR_PREFIX".InvalidCredentials"},
+    {GSIGNOND_ERROR_NOT_AUTHORIZED, _ERROR_PREFIX".NotAutherized"},
+    {GSIGNOND_ERROR_WRONG_STATE, _ERROR_PREFIX".WrongState"},
+    {GSIGNOND_ERROR_OPERATION_NOT_SUPPORTED, _ERROR_PREFIX".OperationNotSupported"},
+    {GSIGNOND_ERROR_NO_CONNECTION, _ERROR_PREFIX".NoConnection"},
+    {GSIGNOND_ERROR_NETWORK, _ERROR_PREFIX".NoNetwork"},
+    {GSIGNOND_ERROR_SSL, _ERROR_PREFIX".SSLError"},
+    {GSIGNOND_ERROR_RUNTIME, _ERROR_PREFIX".RuntimeError"},
+    {GSIGNOND_ERROR_SESSION_CANCELED, _ERROR_PREFIX".Cancled"},
+    {GSIGNOND_ERROR_TIMED_OUT, _ERROR_PREFIX".TimedOut"},
+    {GSIGNOND_ERROR_USER_INTERACTION, _ERROR_PREFIX".UserInteractionFailed"},
+    {GSIGNOND_ERROR_OPERATION_FAILED, _ERROR_PREFIX".OperationFailed"},
+    {GSIGNOND_ERROR_ENCRYPTION_FAILED, _ERROR_PREFIX".EncryptionFailed"},
+    {GSIGNOND_ERROR_TOS_NOT_ACCEPTED, _ERROR_PREFIX".TOSNotAccepted"},
+
+    {GSIGNOND_ERROR_FORGOT_PASSWORD, _ERROR_PREFIX".ForgotPassword"},
+    {GSIGNOND_ERROR_METHOD_OR_MECHANISM_NOT_ALLOWED, _ERROR_PREFIX".MethodOrMechanismNotAllowed"},
+    {GSIGNOND_ERROR_INCORRECT_DATE, _ERROR_PREFIX".IncorrectDate"},
+} ;
 
 GQuark
 gsignond_error_quark (void)
 {
-    static GQuark quark = 0;
-    if (quark == 0) {
-        quark = g_quark_from_static_string (GSIGNOND_ERROR_DOMAIN);
-    }
-    return quark;
+    static volatile gsize quark_volatile = 0;
+
+    g_dbus_error_register_error_domain (GSIGNOND_ERROR_DOMAIN,
+                                        &quark_volatile,
+                                        _gsignond_errors,
+                                        G_N_ELEMENTS (_gsignond_errors));
+
+    return (GQuark) quark_volatile;
 }
 
 GString*
index 0e4ac46..8b7e231 100644 (file)
@@ -768,3 +768,13 @@ gsignond_db_credentials_database_get_identity_owner (
     return ctx;
 }
 
+const GError *
+gsignond_db_credentials_database_get_last_error (
+    GSignondDbCredentialsDatabase *self)
+{
+    g_return_val_if_fail (self && GSIGNOND_DB_IS_CREDENTIALS_DATABASE (self), NULL);
+
+    return gsignond_db_sql_database_get_last_error (
+        GSIGNOND_DB_SQL_DATABASE (self->priv->metadata_db));
+}
+
index ffee678..f1c5227 100644 (file)
@@ -187,6 +187,10 @@ gsignond_db_credentials_database_get_identity_owner (
         GSignondDbCredentialsDatabase *self,
         const guint32 identity_id);
 
+const GError *
+gsignond_db_credentials_database_get_last_error (
+        GSignondDbCredentialsDatabase *self);
+
 G_END_DECLS
 
 #endif /* __GSIGNOND_DB_CREDENTIALS_DATABASE_H__ */
index 45412dd..b9f40af 100644 (file)
@@ -333,9 +333,8 @@ _gsignond_db_metadata_database_insert_methods (
     g_return_val_if_fail (GSIGNOND_DB_IS_METADATA_DATABASE (self), FALSE);
     g_return_val_if_fail (identity != NULL, FALSE);
 
-    methods = gsignond_identity_info_get_methods (identity);
-
     if (!methods || g_hash_table_size (methods) <=0) {
+        DBG ("no authentication methods found to store identity");
         return FALSE;
     }
 
@@ -1049,8 +1048,6 @@ gsignond_db_metadata_database_update_identity (
     if (!_gsignond_db_metadata_database_insert_methods (self, identity,
             methods)) {
         DBG ("Update methods failed");
-        gsignond_db_sql_database_rollback_transaction (sql);
-        goto finished;
     }
 
     /* realms */
index 4b4e3df..5dfb957 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include "gsignond/gsignond-log.h"
-#include "gsignond/gsignond-error.h"
 #include "gsignond-dbus-auth-service-adapter.h"
 #include "gsignond-dbus.h"
 
@@ -209,6 +208,7 @@ _handle_register_new_identity (GSignondDbusAuthServiceAdapter *self,
     GSignondAccessControlManager *acm = gsignond_auth_service_iface_get_acm (self->priv->parent); 
     GSignondSecurityContext sec_context = {0, 0};
     const gchar *object_path = NULL;
+    GError *error = NULL;
 
     gsignond_access_control_manager_security_context_of_peer(
             acm,
@@ -217,7 +217,7 @@ _handle_register_new_identity (GSignondDbusAuthServiceAdapter *self,
             sender,
             app_context);
 
-    object_path = gsignond_auth_service_iface_register_new_identity (self->priv->parent, &sec_context);
+    object_path = gsignond_auth_service_iface_register_new_identity (self->priv->parent, &sec_context, &error);
 
     if (object_path) {
         g_bus_watch_name_on_connection (connection, 
@@ -231,12 +231,8 @@ _handle_register_new_identity (GSignondDbusAuthServiceAdapter *self,
         gsignond_dbus_auth_service_complete_register_new_identity (iface, invocation, object_path);
     }
     else {
-        /* 
-         * TODO: Prepare error
-         * GError *err = g_error_new ();
-         * g_dbus_method_invocation_return_gerror (invocation, err);
-         * g_error_free (err);
-         */
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 
     return TRUE;
@@ -256,6 +252,7 @@ _handle_get_identity (GSignondDbusAuthServiceAdapter *self,
     GSignondAccessControlManager *acm = gsignond_auth_service_iface_get_acm (self->priv->parent); 
     GSignondSecurityContext sec_context = {0, 0};
     const gchar *object_path = NULL;
+    GError *error = NULL;
 
     gsignond_access_control_manager_security_context_of_peer(
             acm,
@@ -264,7 +261,7 @@ _handle_get_identity (GSignondDbusAuthServiceAdapter *self,
             sender,
             app_context);
 
-    object_path = gsignond_auth_service_iface_get_identity (self->priv->parent, id, &sec_context, &identity_data);
+    object_path = gsignond_auth_service_iface_get_identity (self->priv->parent, id, &sec_context, &identity_data, &error);
 
     if (object_path) {
         g_bus_watch_name_on_connection (connection, 
@@ -278,12 +275,8 @@ _handle_get_identity (GSignondDbusAuthServiceAdapter *self,
         gsignond_dbus_auth_service_complete_get_identity (iface, invocation, object_path, identity_data);
     }
     else {
-        /*
-         * TODO: Prepare error
-         * GError *err = g_error_new ();
-         * g_dbus_method_invocation_return_gerror (invocation, err);
-         * g_error_free (err);
-         */
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 
     return TRUE;
@@ -295,16 +288,16 @@ _handle_query_methods (GSignondDbusAuthServiceAdapter   *self,
                        gpointer               user_data)
 {
     GSignondDbusAuthService *iface = GSIGNOND_DBUS_AUTH_SERVICE (self);
-    const gchar **methods = gsignond_auth_service_iface_query_methods (self->priv->parent);
+    const gchar **methods = NULL;
+    GError *error = NULL;
+    
+    methods = gsignond_auth_service_iface_query_methods (self->priv->parent, &error);
 
     if (methods)
         gsignond_dbus_auth_service_complete_query_methods (iface, invocation, (const gchar * const*)methods);
     else {
-        g_dbus_method_invocation_return_error (invocation,
-                                               GSIGNOND_ERROR,
-                                               GSIGNOND_ERROR_METHOD_NOT_AVAILABLE,
-                                               "no authentication methods available");
-
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 
     return TRUE;
@@ -316,17 +309,17 @@ _handle_query_mechanisms (GSignondDbusAuthServiceAdapter *self,
                           const gchar *method,
                           gpointer user_data)
 {
+    GSignondDbusAuthService *iface = GSIGNOND_DBUS_AUTH_SERVICE (self);    
     const gchar **mechanisms = 0;
-    GSignondDbusAuthService *iface = GSIGNOND_DBUS_AUTH_SERVICE (self);
+    GError *error = NULL;
 
-    mechanisms = gsignond_auth_service_iface_query_mechanisms (self->priv->parent, method);
+    mechanisms = gsignond_auth_service_iface_query_mechanisms (self->priv->parent, method, &error);
 
     if (mechanisms)
         gsignond_dbus_auth_service_complete_query_mechanisms (iface, invocation, (const gchar* const*)mechanisms);
     else {
-        g_dbus_method_invocation_return_error (invocation, GSIGNOND_ERROR,
-                    GSIGNOND_ERROR_MECHANISM_NOT_AVAILABLE,
-                    "no mechanisms available");
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 
     return TRUE;
@@ -339,9 +332,16 @@ _handle_query_identities (GSignondDbusAuthServiceAdapter *self,
                           gpointer user_data)
 {
     GSignondDbusAuthService *iface = GSIGNOND_DBUS_AUTH_SERVICE (self);
-    GVariant *identities = gsignond_auth_service_iface_query_identities (self->priv->parent, filter);
+    GVariant *identities = NULL;
+    GError *error = NULL;
+    
+    identities = gsignond_auth_service_iface_query_identities (self->priv->parent, filter, &error);
 
-    gsignond_dbus_auth_service_complete_query_identities (iface, invocation, identities);
+    if (!error) gsignond_dbus_auth_service_complete_query_identities (iface, invocation, identities);
+    else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
@@ -351,12 +351,17 @@ _handle_clear (GSignondDbusAuthServiceAdapter *self,
                GDBusMethodInvocation *invocation,
                gpointer user_data)
 {
-    gboolean res ;
     GSignondDbusAuthService *iface = GSIGNOND_DBUS_AUTH_SERVICE (self);
+    gboolean res ;
+    GError *error = NULL;
 
-    res = gsignond_auth_service_iface_clear (self->priv->parent);
+    res = gsignond_auth_service_iface_clear (self->priv->parent, &error);
 
-    gsignond_dbus_auth_service_complete_clear (iface, invocation, res);
+    if (!error) gsignond_dbus_auth_service_complete_clear (iface, invocation, res);
+    else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
index 37349a5..36ffc07 100644 (file)
@@ -206,19 +206,18 @@ _handle_query_available_mechanisms (GSignondDbusAuthSessionAdapter *self,
                                     gpointer user_data)
 {
     GSignondDbusAuthSession *iface = GSIGNOND_DBUS_AUTH_SESSION (self);
-    gchar **mechanisms = gsignond_auth_session_iface_query_available_mechanisms (self->priv->parent, wanted_mechanisms);
+    gchar **mechanisms = NULL;
+    GError *error = NULL;
+    
+    mechanisms = gsignond_auth_session_iface_query_available_mechanisms (self->priv->parent, wanted_mechanisms, &error);
 
     if (mechanisms) {
         gsignond_dbus_auth_session_complete_query_available_mechanisms (iface, invocation, (const gchar * const *)mechanisms);
         g_strfreev (mechanisms);
     }
     else {
-        /* 
-         * TODO: Prepare error
-         * GError *err = g_error_new ();
-         * g_dbus_method_invocation_return_gerror (invocation, err);
-         * g_error_free (err);
-         */
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 }
 
@@ -232,10 +231,13 @@ static void
 _on_process_result (GSignondAuthSessionIface *auth_session, const GSignondSessionData *data, gpointer user_data)
 {
     _AuthSessionDbusInfo *info = (_AuthSessionDbusInfo *) user_data;
-    g_assert (info && info->adapter);
-    GSignondDbusAuthSessionAdapter *self = info->adapter;
+    GSignondDbusAuthSessionAdapter *self = NULL;
+    GVariant *result = NULL;
+    
+    if (!info) return ;
 
-    GVariant *result = gsignond_dictionary_to_variant ((GSignondDictionary *)data);
+    self = info->adapter;
+    result = gsignond_dictionary_to_variant ((GSignondDictionary *)data);
 
     gsignond_dbus_auth_session_complete_process (
         GSIGNOND_DBUS_AUTH_SESSION(self),
@@ -251,7 +253,11 @@ static void
 _on_process_error (GSignondAuthSessionIface *auth_session, const GError *error, gpointer user_data)
 {
     _AuthSessionDbusInfo *info = (_AuthSessionDbusInfo *) user_data;
-    GSignondDbusAuthSessionAdapter *self = info->adapter;
+    GSignondDbusAuthSessionAdapter *self = NULL;
+
+    if (!info) return ;
+
+    self = info->adapter;
 
     g_dbus_method_invocation_return_gerror (info->invocation, error);
 
@@ -269,7 +275,7 @@ _handle_process (GSignondDbusAuthSessionAdapter *self,
                  gpointer user_data)
 {
     _AuthSessionDbusInfo *info = 0;
-
+    GError *error = NULL;
     GSignondSessionData *data = (GSignondSessionData *)gsignond_dictionary_new_from_variant ((GVariant *)session_data);
 
     info = g_new0 (_AuthSessionDbusInfo, 1);
@@ -281,7 +287,15 @@ _handle_process (GSignondDbusAuthSessionAdapter *self,
     self->priv->process_result_handler_id = 
         g_signal_connect (self->priv->parent, "process-result", G_CALLBACK (_on_process_result), info);
 
-    gsignond_auth_session_iface_process (self->priv->parent, data, mechanisms);
+    if (!gsignond_auth_session_iface_process (self->priv->parent, data, mechanisms, &error)) {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    
+        g_signal_handler_disconnect (self->priv->parent, self->priv->process_error_handler_id);
+        g_signal_handler_disconnect (self->priv->parent, self->priv->process_result_handler_id);
+
+        self->priv->process_error_handler_id = self->priv->process_result_handler_id = 0;
+    }
 
     gsignond_dictionary_free (data);
 }
@@ -292,10 +306,14 @@ _handle_cancel (GSignondDbusAuthSessionAdapter *self,
                 gpointer user_data)
 {
     GSignondDbusAuthSession *iface = GSIGNOND_DBUS_AUTH_SESSION (self);
+    GError *error = NULL;
     
-    gsignond_auth_session_iface_cancel (self->priv->parent);
-
-    gsignond_dbus_auth_session_complete_cancel (iface, invocation);
+    if (gsignond_auth_session_iface_cancel (self->priv->parent, &error))
+        gsignond_dbus_auth_session_complete_cancel (iface, invocation);
+    else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 }
 
 static void
index e27d4b7..67ce875 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include "gsignond/gsignond-log.h"
-#include "gsignond/gsignond-error.h"
 #include "gsignond-dbus-identity-adapter.h"
 #include "gsignond-dbus.h"
 
@@ -39,6 +38,12 @@ enum
 
 static GParamSpec *properties[N_PROPERTIES];
 
+typedef struct {
+    GSignondDbusIdentityAdapter *adapter;
+    GDBusMethodInvocation *invocation;
+    gpointer user_data;
+} _IdentityDbusInfo;
+
 struct _GSignondDbusIdentityAdapterPrivate
 {
     GDBusConnection       *connection;
@@ -46,6 +51,10 @@ struct _GSignondDbusIdentityAdapterPrivate
     gchar *object_path;
     gchar *app_context;
     GSignondSecurityContext sec_context;
+    /* signal handler ids */
+    guint info_updated_handler_id;
+    guint verify_user_handler_id;
+    guint verify_secret_handler_id;
 };
 
 G_DEFINE_TYPE (GSignondDbusIdentityAdapter, gsignond_dbus_identity_adapter, GSIGNOND_DBUS_TYPE_IDENTITY_SKELETON)
@@ -89,10 +98,22 @@ gsignond_dbus_identity_adapter_set_property (GObject *object,
             gpointer iface = g_value_peek_pointer (value);
             if (iface) {
                 if (self->priv->identity) {
-                    g_signal_handlers_disconnect_by_func (self->priv->identity, _emit_info_updated, self);
+                    if (self->priv->info_updated_handler_id) {
+                        g_signal_handler_disconnect (self->priv->identity, self->priv->info_updated_handler_id);
+                        self->priv->info_updated_handler_id = 0;
+                    }
+                    if (self->priv->verify_user_handler_id) {
+                        g_signal_handler_disconnect (self->priv->identity, self->priv->verify_user_handler_id);
+                        self->priv->verify_user_handler_id = 0;
+                    }
+                    if (self->priv->verify_secret_handler_id) {
+                        g_signal_handler_disconnect (self->priv->identity, self->priv->verify_secret_handler_id);
+                        self->priv->verify_secret_handler_id = 0;
+                    }
                 }
                 self->priv->identity = GSIGNOND_IDENTITY_IFACE (iface);
-                g_signal_connect (self->priv->identity, "info-updated", G_CALLBACK (_emit_info_updated), self);
+                self->priv->info_updated_handler_id = g_signal_connect (
+                        self->priv->identity, "info-updated", G_CALLBACK (_emit_info_updated), self);
             }
             break;
         }
@@ -138,6 +159,21 @@ gsignond_dbus_identity_adapter_dispose (GObject *object)
         g_object_unref (self->priv->connection);
         self->priv->connection = NULL;
     }
+    
+    if (self->priv->identity) {
+        if (self->priv->info_updated_handler_id) {
+            g_signal_handler_disconnect (self->priv->identity, self->priv->info_updated_handler_id);
+            self->priv->info_updated_handler_id = 0;
+        }
+        if (self->priv->verify_user_handler_id) {
+            g_signal_handler_disconnect (self->priv->identity, self->priv->verify_user_handler_id);
+            self->priv->verify_user_handler_id = 0;
+        }
+        if (self->priv->verify_secret_handler_id) {
+            g_signal_handler_disconnect (self->priv->identity, self->priv->verify_secret_handler_id);
+            self->priv->verify_secret_handler_id = 0;
+        }
+    }
 
     G_OBJECT_CLASS (gsignond_dbus_identity_adapter_parent_class)->dispose (object);
 }
@@ -246,20 +282,17 @@ _handle_request_credentials_update (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     guint32 id;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
     
-    id = gsignond_identity_iface_request_credentials_update (self->priv->identity, message, &self->priv->sec_context);
+    id = gsignond_identity_iface_request_credentials_update (self->priv->identity, message, &self->priv->sec_context, &error);
     if (id) {
         gsignond_dbus_identity_complete_request_credentials_update (iface, invocation, id);
     }
     else {
-        /* 
-         * TODO: Prepare error
-         * GError *err = g_error_new ();
-         * g_dbus_method_invocation_return_gerror (invocation, err);
-         * g_error_free (err);
-         */
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 
     return TRUE;
@@ -272,20 +305,17 @@ _handle_get_info (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     GVariant *identity_data = 0;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
-    identity_data = gsignond_identity_iface_get_info (self->priv->identity, &self->priv->sec_context);
+    identity_data = gsignond_identity_iface_get_info (self->priv->identity, &self->priv->sec_context, &error);
 
     if (identity_data) {
         gsignond_dbus_identity_complete_get_info (iface, invocation, identity_data);
     }
     else {
-        /*
-         * TODO: Prepare error
-         * GError *err = g_error_new ();
-         * g_dbus_method_invocation_return_gerror (invocation, err);
-         * g_error_free (err);
-         */
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
     }
 
     return TRUE;
@@ -299,56 +329,130 @@ _handle_get_auth_session (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     const gchar *object_path = NULL;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    DBG ("get auth session for method : %s", method);
-    object_path = gsignond_identity_iface_get_auth_session (self->priv->identity, method, &self->priv->sec_context);
+    object_path = gsignond_identity_iface_get_auth_session (self->priv->identity, method, &self->priv->sec_context, &error);
 
-    if (!object_path) {
-        g_dbus_method_invocation_return_error (invocation, 
-                                               GSIGNOND_ERROR,
-                                               GSIGNOND_ERROR_METHOD_NOT_KNOWN,
-                                               "'%s' method not supported", method);
-    }
-    else
+    if (object_path) {
         gsignond_dbus_identity_complete_get_auth_session (iface, invocation, object_path);
+    }
+    else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
 
+static void
+_on_user_verfied (GSignondIdentityIface *identity, gboolean res, const GError *error, gpointer user_data)
+{
+    _IdentityDbusInfo *info = (_IdentityDbusInfo *)user_data;
+   
+    if (G_UNLIKELY (info)) {
+        WARN ("assertion G_UNLIKELY (info) fialed");
+        return ;
+    }
+
+    g_signal_handler_disconnect (identity, info->adapter->priv->verify_user_handler_id);
+    info->adapter->priv->verify_user_handler_id = 0;
+
+    if (error) {
+        g_dbus_method_invocation_return_gerror (info->invocation, error);
+    }
+    else {
+        gsignond_dbus_identity_complete_verify_user (
+            GSIGNOND_DBUS_IDENTITY (info->adapter), info->invocation, res);
+    }
+
+    g_free (info);
+}
+
 static gboolean
 _handle_verify_user (GSignondDbusIdentityAdapter *self,
                      GDBusMethodInvocation *invocation,
                      const GVariant *params,
                      gpointer user_data)
 {
-    GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     gboolean res = FALSE;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    res = gsignond_identity_iface_verify_user (self->priv->identity, params, &self->priv->sec_context);
+    res = gsignond_identity_iface_verify_user (self->priv->identity, params, &self->priv->sec_context, &error);
 
-    gsignond_dbus_identity_complete_verify_user (iface, invocation, res);
+    if (!res) {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
+    else {
+        _IdentityDbusInfo *info = g_new0(_IdentityDbusInfo, 1);
+
+        info->adapter = self;
+        info->invocation = invocation;
+        info->user_data = NULL;
+
+        /* FIXME: Do we allow multiple calls at a given point of time */
+        self->priv->verify_user_handler_id = g_signal_connect (self->priv->identity, 
+                    "user-verified", G_CALLBACK (_on_user_verfied), (gpointer)info);
+    }
 
     return TRUE;
 }
 
+static void
+_on_secret_verfied (GSignondIdentityIface *identity, gboolean res, const GError *error, gpointer user_data)
+{
+    _IdentityDbusInfo *info = (_IdentityDbusInfo *)user_data;
+
+    g_signal_handler_disconnect (identity, info->adapter->priv->verify_secret_handler_id);
+    info->adapter->priv->verify_secret_handler_id = 0;
+
+    if (G_UNLIKELY (info)) {
+        WARN ("assertion G_UNLIKELY (info) fialed");
+        return ;
+    }
+    if (error) {
+        g_dbus_method_invocation_return_gerror (info->invocation, error);
+    }
+    else {
+        gsignond_dbus_identity_complete_verify_secret (
+            GSIGNOND_DBUS_IDENTITY (info->adapter), info->invocation, res);
+    }
+
+    g_free (info);
+}
+
 static gboolean
 _handle_verify_secret (GSignondDbusIdentityAdapter *self,
                       GDBusMethodInvocation *invocation,
                       const gchar *secret,
                       gpointer user_data)
 {
-    GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     gboolean res = FALSE;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
     
-    res = gsignond_identity_iface_verify_secret (self->priv->identity, secret, &self->priv->sec_context);
+    res = gsignond_identity_iface_verify_secret (self->priv->identity, secret, &self->priv->sec_context, &error);
+
+    if (!res) {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
+    else {
+        _IdentityDbusInfo *info = g_new0(_IdentityDbusInfo, 1);
 
-    gsignond_dbus_identity_complete_verify_secret (iface, invocation, res);
+        info->adapter = self;
+        info->invocation = invocation;
+        info->user_data = NULL;
+
+        /* FIXME: Do we allow multiple calls at a given point of time */
+        self->priv->verify_secret_handler_id = g_signal_connect (self->priv->identity, 
+                "secret-verified", G_CALLBACK (_on_secret_verfied), (gpointer)info);
+    }
 
     return TRUE;
 }
@@ -359,12 +463,17 @@ _handle_remove (GSignondDbusIdentityAdapter   *self,
                 gpointer               user_data)
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
+    GError *error = NULL;
     
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    gsignond_identity_iface_remove (self->priv->identity, &self->priv->sec_context);
-
-    gsignond_dbus_identity_complete_remove (iface, invocation);
+    if (!gsignond_identity_iface_remove (self->priv->identity, &self->priv->sec_context, &error)) {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
+    else {
+        gsignond_dbus_identity_complete_remove (iface, invocation);
+    }
 
     return TRUE;
 }
@@ -376,12 +485,19 @@ _handle_sign_out (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     gboolean res = FALSE;
+    GError *error = NULL;
     
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    res = gsignond_identity_iface_sign_out (self->priv->identity, &self->priv->sec_context);
+    res = gsignond_identity_iface_sign_out (self->priv->identity, &self->priv->sec_context, &error);
 
-    gsignond_dbus_identity_complete_sign_out (iface, invocation, res);
+    if (res) {
+        gsignond_dbus_identity_complete_sign_out (iface, invocation, res);
+    }
+    else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
@@ -394,12 +510,18 @@ _handle_store (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     guint id = 0;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    id = gsignond_identity_iface_store (self->priv->identity, info, &self->priv->sec_context);
+    id = gsignond_identity_iface_store (self->priv->identity, info, &self->priv->sec_context, &error);
 
-    gsignond_dbus_identity_complete_store (iface, invocation, id);
+    if (id) {
+        gsignond_dbus_identity_complete_store (iface, invocation, id);
+    } else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
@@ -412,12 +534,19 @@ _handle_add_reference (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     gint32 id = 0;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    id = gsignond_identity_iface_add_reference (self->priv->identity, reference, &self->priv->sec_context);
+    id = gsignond_identity_iface_add_reference (self->priv->identity, reference, &self->priv->sec_context, &error);
 
-    gsignond_dbus_identity_complete_add_reference (iface, invocation, id);
+    if (id) {
+        gsignond_dbus_identity_complete_add_reference (iface, invocation, id);
+    }
+    else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
@@ -430,12 +559,18 @@ _handle_remove_reference (GSignondDbusIdentityAdapter *self,
 {
     GSignondDbusIdentity *iface = GSIGNOND_DBUS_IDENTITY (self);
     gint32 id = 0;
+    GError *error = NULL;
 
     PREPARE_SECURITY_CONTEXT (self, invocation);
 
-    id = gsignond_identity_iface_remove_reference (self->priv->identity, reference, &self->priv->sec_context);
+    id = gsignond_identity_iface_remove_reference (self->priv->identity, reference, &self->priv->sec_context, &error);
 
-    gsignond_dbus_identity_complete_remove_reference (iface, invocation, id);
+    if (id) {
+        gsignond_dbus_identity_complete_remove_reference (iface, invocation, id);
+    } else {
+        g_dbus_method_invocation_return_gerror (invocation, error);
+        g_error_free (error);
+    }
 
     return TRUE;
 }
index ec404a6..734b423 100644 (file)
@@ -29,10 +29,12 @@ G_DEFINE_INTERFACE (GSignondAuthServiceIface, gsignond_auth_service_iface, G_TYP
 
 static const gchar * 
 _dummy_register_new_identity (GSignondAuthServiceIface *self,
-                              const GSignondSecurityContext *ctx)
+                              const GSignondSecurityContext *ctx,
+                              GError **error)
 {
     (void) self;
     (void) ctx;
+    (void) error;
     return NULL;
 }
 
@@ -40,45 +42,54 @@ static const gchar *
 _dummy_get_identity (GSignondAuthServiceIface *self, 
                      guint32 id,
                      const GSignondSecurityContext *ctx, 
-                     GVariant **identity_data)
+                     GVariant **identity_data,
+                     GError **error)
 {
     (void) self;
     (void) id;
     (void) ctx;
     (void) identity_data;
+    (void) error;
     return NULL;
 }
 
 static const gchar **
-_dummy_query_methods (GSignondAuthServiceIface *self)
+_dummy_query_methods (GSignondAuthServiceIface *self,
+                      GError **error)
 {
     (void) self;
+    (void) error;
     return NULL;
 }
 
 static const gchar **
 _dummy_query_mechanisms (GSignondAuthServiceIface *self, 
-                         const gchar *method)
+                         const gchar *method,
+                         GError **error)
 {
     (void) self;
     (void) method;
+    (void) error;
     return NULL;
 }
 
 static GVariant *
 _dummy_query_identities (GSignondAuthServiceIface *self, 
-                         const GVariant *filter)
+                         const GVariant *filter,
+                         GError **error)
 {
     (void) self;
     (void) filter;
+    (void) error;
     return NULL;
 }
 
 static gboolean
-_dummy_clear (GSignondAuthServiceIface *self)
+_dummy_clear (GSignondAuthServiceIface *self,
+              GError **error)
 {
     (void) self;
-
+    (void) error;
     return FALSE;
 }
 
@@ -107,6 +118,7 @@ gsignond_auth_service_iface_default_init (
  * gsignond_auth_service_iface_register_new_identity:
  * @self: instance of #GSignondAuthServiceIfacea
  * @ctx: security context
+ * @error: return location for error
  *
  *
  * Returns: (transfer none) object path of newly created identity.
@@ -114,10 +126,11 @@ gsignond_auth_service_iface_default_init (
 const gchar *
 gsignond_auth_service_iface_register_new_identity (
                                                  GSignondAuthServiceIface *self,
-                                                 const GSignondSecurityContext *ctx)
+                                                 const GSignondSecurityContext *ctx,
+                                                 GError **error)
 {
     return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->
-        register_new_identity (self, ctx);
+        register_new_identity (self, ctx, error);
 }
 
 /**
@@ -127,6 +140,7 @@ gsignond_auth_service_iface_register_new_identity (
  * @ctx: security context
  * @object_path:  return location for object path of the identity
  * @identity_data: return location for identity data
+ * @error: return location for error
  *
  * Retrives object path and identity info stored for the given @id.
  *
@@ -136,30 +150,34 @@ const gchar *
 gsignond_auth_service_iface_get_identity (GSignondAuthServiceIface *self,
                                           guint32 id,
                                           const GSignondSecurityContext *ctx,
-                                          GVariant **identity_data)
+                                          GVariant **identity_data,
+                                          GError **error)
 {
     return GSIGNOND_AUTH_SERVICE_GET_INTERFACE(self)->
-        get_identity (self, id, ctx, identity_data);
+        get_identity (self, id, ctx, identity_data, error);
 }
 
 /**
  * gsignond_auth_service_iface_query_methods:
  * @self: instance of #GSignondAuthServiceIface
+ * @error: return location for error
  *
  * Retrieves the available authentication methods. 
  *
  * Returns: (transfer none): list of methods
  */
 const gchar **
-gsignond_auth_service_iface_query_methods (GSignondAuthServiceIface *self)
+gsignond_auth_service_iface_query_methods (GSignondAuthServiceIface *self,
+                                           GError **error)
 {
-    return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->query_methods (self);
+    return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->query_methods (self, error);
 }
 
 /**
  * gsignond_auth_service_iface_query_mechanisms:
  * @self: instance of #GSignondAuthServiceIface
  * @method: method to query
+ * @error: return location for error
  *
  * Retrieves the available mechanisms for authentication method @method.
  *
@@ -167,16 +185,18 @@ gsignond_auth_service_iface_query_methods (GSignondAuthServiceIface *self)
  */
 const gchar **
 gsignond_auth_service_iface_query_mechanisms (GSignondAuthServiceIface *self,
-                                              const gchar *method)
+                                              const gchar *method,
+                                              GError **error)
 {
     return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->
-        query_mechanisms (self, method);
+        query_mechanisms (self, method, error);
 }
 
 /**
  * gsignond_auth_service_iface_query_identities:
  * @self: instance of #GSignondAuthServiceIface
  * @filter: filter should be applited
+ * @error: return location for error
  *
  * Retrieves the identities that satisifies the filter @filter.
  *
@@ -184,24 +204,27 @@ gsignond_auth_service_iface_query_mechanisms (GSignondAuthServiceIface *self,
  */
 GVariant *
 gsignond_auth_service_iface_query_identities (GSignondAuthServiceIface *self,
-                                              const GVariant *filter)
+                                              const GVariant *filter,
+                                              GError **error)
 {
     return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->
-        query_identities (self, filter);
+        query_identities (self, filter, error);
 }
 
 /**
  * gsignond_auth_service_iface_clear:
  * @self: instance of #GSignondAuthServiceIface
+ * @error: return location for error
  *  
  * Clears the cache.
  *
  * Returns: TRUE on successful, FALSE otherwise
  */
 gboolean
-gsignond_auth_service_iface_clear (GSignondAuthServiceIface *self)
+gsignond_auth_service_iface_clear (GSignondAuthServiceIface *self,
+                                   GError **error)
 {
-    return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->clear(self);
+    return GSIGNOND_AUTH_SERVICE_GET_INTERFACE (self)->clear(self, error);
 }
 
 GSignondAccessControlManager *
index 2f7cbed..65ffbf1 100644 (file)
@@ -48,13 +48,14 @@ struct _GSignondAuthServiceIfaceInterface {
      * register_new_identity:
      * @auth_service: An instance of #GSignondAuthServiceIface
      * @ctx: Security context
+     * @error: return location for error
      *
      * Creates new identity object and registers it on the DBus. Returns the
      * dbus object of the newly created identity.
      *
      * Returns: (transfer null) object of the newly created identity if success, @NULL otherwise.
      */
-    const gchar * (*register_new_identity) (GSignondAuthServiceIface *auth_service, const GSignondSecurityContext *ctx);
+    const gchar * (*register_new_identity) (GSignondAuthServiceIface *auth_service, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * get_identity:
@@ -63,54 +64,59 @@ struct _GSignondAuthServiceIfaceInterface {
      * @ctx: Security context
      * @object_path: (transfers full) holds the object path of the identity
      * @identity_data: (transfers full) holds the identity data
+     * @error: return location for error
      *
      * Retrives idnetity information stored and object path on DBus with the given id @id.
      *
      * Returns: (transfer null) object of the newly created identity if success, @NULL otherwise.
      */
-    const gchar* (*get_identity) (GSignondAuthServiceIface *auth_service, guint32 id, const GSignondSecurityContext *ctx, GVariant **identity_data);
+    const gchar* (*get_identity) (GSignondAuthServiceIface *auth_service, guint32 id, const GSignondSecurityContext *ctx, GVariant **identity_data, GError **error);
 
     /**
      * query_methods:
      * @auth_service: An instance of #GSignondAuthServiceIface
+     * @error: return location for error
      *
      * Retrieves the supported authentication methods on this service object.
      *
      * Returns: (transfer none): list of authentication methods. 
      */
-    const gchar ** (*query_methods) (GSignondAuthServiceIface *auth_service);
+    const gchar ** (*query_methods) (GSignondAuthServiceIface *auth_service, GError **error);
 
     /**
      * query_mechanisms:
      * @auth_service: An instance of #GSignondAuthServiceIface
      * @method: authentication method
+     * @error: return location for error
      *
      * Retrieves the supported authentication mechanisms for given @method on this service object.
      *
      * Returns: (transfer full): list of authentication mechanisms.
      */
-    const gchar ** (*query_mechanisms) (GSignondAuthServiceIface *auth_service, const gchar *method);
+    const gchar ** (*query_mechanisms) (GSignondAuthServiceIface *auth_service, const gchar *method, GError **error);
 
     /**
      * query_identities:
      * @auth_service: An instance of #GSignondAuthServiceIface
      * @filter: filter to be applied
+     * @error: return location for error
      *
      * Query for stored identities which satisifies the given filter @filter.
      *
      * Returns: (transfers full) identity list
      */
-    GVariant * (*query_identities) (GSignondAuthServiceIface *auth_service, const GVariant *filter);
+    GVariant * (*query_identities) (GSignondAuthServiceIface *auth_service, const GVariant *filter, GError **error);
 
     /**
      * clear:
      * @auth_service: An instance of #GSignondAuthServiceIface
+     * @error: return location for error
      *
      * Clears all the identity information stored.
      *
      * Retruns: @TRUE on success, @FALSE otherwise
      */
-    gboolean (*clear) (GSignondAuthServiceIface *auth_service);
+    gboolean (*clear) (GSignondAuthServiceIface *auth_service, GError **error);
 
     /**
      * get_acm
@@ -128,22 +134,28 @@ GType gsignond_auth_service_iface_get_type (void);
 const gchar * 
 gsignond_auth_service_iface_register_new_identity (
                                                 GSignondAuthServiceIface *self,
-                                                const GSignondSecurityContext *ctx);
+                                                const GSignondSecurityContext *ctx,
+                                                GError **error);
 const gchar *
 gsignond_auth_service_iface_get_identity (GSignondAuthServiceIface *self,
                                           guint32 id,
                                           const GSignondSecurityContext *ctx,
-                                          GVariant **identity_data);
+                                          GVariant **identity_data,
+                                          GError **error);
 const gchar **
-gsignond_auth_service_iface_query_methods (GSignondAuthServiceIface *self);
+gsignond_auth_service_iface_query_methods (GSignondAuthServiceIface *self,
+                                           GError **error);
 const gchar **
 gsignond_auth_service_iface_query_mechanisms (GSignondAuthServiceIface *self,
-                                              const gchar *method);
+                                              const gchar *method,
+                                              GError **error);
 GVariant *
 gsignond_auth_service_iface_query_identities (GSignondAuthServiceIface *self,
-                                              const GVariant *filter);
+                                              const GVariant *filter,
+                                              GError **error);
 gboolean
-gsignond_auth_service_iface_clear (GSignondAuthServiceIface *self);
+gsignond_auth_service_iface_clear (GSignondAuthServiceIface *self,
+                                   GError **error);
 
 GSignondAccessControlManager *
 gsignond_auth_service_iface_get_acm (GSignondAuthServiceIface *self);
index d84da32..d065001 100644 (file)
@@ -125,30 +125,33 @@ gsignond_auth_session_iface_default_init (
 gchar **
 gsignond_auth_session_iface_query_available_mechanisms (
                                                 GSignondAuthSessionIface *self,
-                                                const gchar **wanted_mechanisms)
+                                                const gchar **wanted_mechanisms,
+                                                GError **error)
 {
     return GSIGNOND_AUTH_SESSION_GET_INTERFACE (self)->
-        query_available_mechanisms (self, wanted_mechanisms);
+        query_available_mechanisms (self, wanted_mechanisms, error);
 }
 
 gboolean
 gsignond_auth_session_iface_process (GSignondAuthSessionIface *self,
                                      GSignondSessionData *session_data,
-                                     const gchar *mechanism)
+                                     const gchar *mechanism,
+                                     GError **error)
 {
     return GSIGNOND_AUTH_SESSION_GET_INTERFACE (self)->
-        process (self, session_data, mechanism);
+        process (self, session_data, mechanism, error);
 }
 
-void
-gsignond_auth_session_iface_cancel (GSignondAuthSessionIface *self)
+gboolean
+gsignond_auth_session_iface_cancel (GSignondAuthSessionIface *self,
+                                    GError **error)
 {
-    return GSIGNOND_AUTH_SESSION_GET_INTERFACE (self)->cancel (self);
+    return GSIGNOND_AUTH_SESSION_GET_INTERFACE (self)->cancel (self, error);
 }
 
 void 
 gsignond_auth_session_iface_user_action_finished (GSignondAuthSessionIface *self, 
-                                           GSignondSessionData *session_data)
+                                                  GSignondSessionData *session_data)
 {
     return GSIGNOND_AUTH_SESSION_GET_INTERFACE (self)->
         user_action_finished (self, session_data);
@@ -156,38 +159,36 @@ gsignond_auth_session_iface_user_action_finished (GSignondAuthSessionIface *self
 
 void 
 gsignond_auth_session_iface_refresh (GSignondAuthSessionIface *self, 
-                              GSignondSessionData *session_data)
+                                     GSignondSessionData *session_data)
 {
     return GSIGNOND_AUTH_SESSION_GET_INTERFACE (self)->
         refresh (self, session_data);
 }
 
 void
-gsignond_auth_session_iface_notify_process_result (
-                                                GSignondAuthSessionIface *iface,
-                                                GSignondSessionData *result)
+gsignond_auth_session_iface_notify_process_result (GSignondAuthSessionIface *iface,
+                                                   GSignondSessionData *result)
 {
     g_signal_emit (iface, signals[SIG_PROCESS_RESULT], 0, result);
 }
 
 void
-gsignond_auth_session_iface_notify_process_error (
-                                                GSignondAuthSessionIface *iface,
-                                                const GError *error)
+gsignond_auth_session_iface_notify_process_error (GSignondAuthSessionIface *iface,
+                                                  const GError *error)
 {
     g_signal_emit (iface, signals[SIG_PROCESS_ERROR], 0, error);
 }
 
 void 
 gsignond_auth_session_iface_notify_store (GSignondAuthSessionIface *self, 
-                            GSignondSessionData *session_data)
+                                          GSignondSessionData *session_data)
 {
     g_signal_emit (self, signals[SIG_PROCESS_STORE], 0, session_data);
 }
 
 void 
 gsignond_auth_session_iface_notify_user_action_required (GSignondAuthSessionIface *self, 
-                                           GSignondSessionData *session_data)
+                                                         GSignondSessionData *session_data)
 {
     g_signal_emit (self, signals[SIG_PROCESS_USER_ACTION_REQUIRED], 0, 
                    session_data);
@@ -195,16 +196,17 @@ gsignond_auth_session_iface_notify_user_action_required (GSignondAuthSessionIfac
 
 void 
 gsignond_auth_session_iface_notify_refreshed (GSignondAuthSessionIface *self, 
-                                GSignondSessionData *session_data)
+                                              GSignondSessionData *session_data)
 {
     g_signal_emit (self, signals[SIG_PROCESS_REFRESHED], 0, session_data);
 }
 
 void 
 gsignond_auth_session_iface_notify_state_changed (GSignondAuthSessionIface *self,
-                                     gint state,
-                                     const gchar *message)
+                                                  gint state,
+                                                  const gchar *message)
 {
     g_signal_emit (self, signals[SIG_PROCESS_STATE_CHANGED], 0, state,
         message);
 }
+
index 9cd2362..625cf91 100644 (file)
@@ -47,6 +47,7 @@ struct _GSignondAuthSessionIfaceInterface {
      * query_available_mechanisms:
      * @session: instance of #GSignondAuthSessionIface
      * @desired_mechanisms: desired authentication mechanisms
+     * @error: return location for error
      *
      * Checks for support of desired authentication mechanisms #desired_mechanisms for this
      * authentication session, The result will be interseciton of desired authenticaiton mechansims 
@@ -56,13 +57,15 @@ struct _GSignondAuthSessionIfaceInterface {
      * Caller should use g_strfreev() when done with return value.
      */
     gchar **   (*query_available_mechanisms) (GSignondAuthSessionIface *session,
-                                              const gchar **desired_mechanisms);
+                                              const gchar **desired_mechanisms,
+                                              GError **error);
 
     /**
      * process:
      * @session: instance of #GSignondAuthSessionIface
      * @session_data: authentication session data to use
      * @mechansims: authentication mechanism to use
+     * @error: return location for error
      *
      * Initiates authentication process on #session, On successful authentication #gsignond_auth_session_iface_notify_process_result will be called.
      * In case failure occured in authentication process, the error is informed via #gsignond_auth_session_iface_notify_process_error.
@@ -71,14 +74,17 @@ struct _GSignondAuthSessionIfaceInterface {
      */
     gboolean   (*process) (GSignondAuthSessionIface *session,
                            GSignondSessionData *session_data,
-                           const gchar *mechanism);
+                           const gchar *mechanism,
+                           GError **error);
 
     /**
      * cancel:
      * @session: instance of #GSignondAuthSessionIface
+     * @error: return location for error
      *
      */
-    void       (*cancel) (GSignondAuthSessionIface *session);
+    gboolean   (*cancel) (GSignondAuthSessionIface *session,
+                          GError **error);
 
     void (*user_action_finished) (GSignondAuthSessionIface *session, 
                                   GSignondSessionData *session_data);
@@ -91,21 +97,23 @@ struct _GSignondAuthSessionIfaceInterface {
 GType gsignond_auth_session_iface_get_type (void);
 
 gchar ** 
-gsignond_auth_session_iface_query_available_mechanisms (
-                                            GSignondAuthSessionIface *self,
-                                            const gchar **wanted_mechanisms);
+gsignond_auth_session_iface_query_available_mechanisms (GSignondAuthSessionIface *self,
+                                                        const gchar **wanted_mechanisms,
+                                                        GError **error);
 gboolean 
 gsignond_auth_session_iface_process (GSignondAuthSessionIface *self,
-                                              GSignondSessionData *session_data,
-                                              const gchar *mechanism);
-void 
-gsignond_auth_session_iface_cancel (GSignondAuthSessionIface *self);
+                                     GSignondSessionData *session_data,
+                                     const gchar *mechanism,
+                                     GError **error);
+gboolean
+gsignond_auth_session_iface_cancel (GSignondAuthSessionIface *self,
+                                    GError **error);
 void 
 gsignond_auth_session_iface_user_action_finished (GSignondAuthSessionIface *self, 
-                                           GSignondSessionData *session_data);
+                                                  GSignondSessionData *session_data);
 void 
 gsignond_auth_session_iface_refresh (GSignondAuthSessionIface *self, 
-                              GSignondSessionData *session_data);
+                                     GSignondSessionData *session_data);
 
 
 /* handlers */
@@ -117,9 +125,8 @@ gsignond_auth_session_iface_refresh (GSignondAuthSessionIface *self,
   * Function to be called with #results on authentication process success.
   */
 void
-gsignond_auth_session_iface_notify_process_result (
-                                                GSignondAuthSessionIface *iface,
-                                                GSignondSessionData *result);
+gsignond_auth_session_iface_notify_process_result (GSignondAuthSessionIface *iface,
+                                                   GSignondSessionData *result);
 
 /**
   * process_error:
@@ -129,23 +136,22 @@ gsignond_auth_session_iface_notify_process_result (
   * Function to be called with #error on authentication process failure.
   */
 void
-gsignond_auth_session_iface_notify_process_error (
-                                                GSignondAuthSessionIface *iface,
-                                                const GError *error);
+gsignond_auth_session_iface_notify_process_error (GSignondAuthSessionIface *iface,
+                                                  const GError *error);
 
 void 
 gsignond_auth_session_iface_notify_store (GSignondAuthSessionIface *self, 
-                            GSignondSessionData *session_data);
+                                          GSignondSessionData *session_data);
 void 
 gsignond_auth_session_iface_notify_user_action_required (GSignondAuthSessionIface *self, 
-                                           GSignondSessionData *session_data);
+                                                         GSignondSessionData *session_data);
 void 
 gsignond_auth_session_iface_notify_refreshed (GSignondAuthSessionIface *self, 
-                                GSignondSessionData *session_data);
+                                              GSignondSessionData *session_data);
 void 
 gsignond_auth_session_iface_notify_state_changed (GSignondAuthSessionIface *self, 
-                                     gint state,
-                                     const gchar *message);
+                                                  gint state,
+                                                  const gchar *message);
 
 G_END_DECLS
 
index ec708fd..d67bd6f 100644 (file)
@@ -24,6 +24,8 @@
  */
 
 #include "gsignond-auth-session-iface.h"
+#include "gsignond/gsignond-error.h"
+#include "gsignond/gsignond-log.h"
 #include "dbus/gsignond-dbus.h"
 #include "dbus/gsignond-dbus-auth-session-adapter.h"
 #include "gsignond-auth-session.h"
@@ -59,8 +61,14 @@ G_DEFINE_TYPE_WITH_CODE (GSignondAuthSession, gsignond_auth_session,
 
 static gchar **
 _query_available_mechanisms (GSignondAuthSessionIface *iface,
-                             const gchar **wanted_mechanisms)
+                             const gchar **wanted_mechanisms,
+                             GError **error)
 {
+    if (G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0)) {
+        WARN ("assertion G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0) failed");
+        if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Unknown error");
+        return NULL;
+    }
     GSignondAuthSession *self = GSIGNOND_AUTH_SESSION (iface);
     gchar** available_mechanisms;
     g_object_get(self->priv->proxy, 
@@ -75,22 +83,35 @@ _query_available_mechanisms (GSignondAuthSessionIface *iface,
 
 static gboolean
 _process (GSignondAuthSessionIface *iface, GSignondSessionData *session_data,
-          const gchar *mechanism)
+          const gchar *mechanism,
+          GError **error)
 {
+    if (G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0)) {
+        WARN ("assertion G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0) failed");
+        if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Unknown error");
+        return FALSE;
+    }
     GSignondAuthSession *self = GSIGNOND_AUTH_SESSION (iface);
 
     gsignond_plugin_proxy_process(self->priv->proxy, iface, session_data,
                                   mechanism);
 
-     return TRUE;
+    return TRUE;
 }
 
-static void 
-_cancel (GSignondAuthSessionIface *iface)
+static gboolean
+_cancel (GSignondAuthSessionIface *iface, GError **error)
 {
+    if (G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0)) {
+        WARN ("assertion G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0) failed");
+        if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Unknown error");
+        return FALSE;
+    }
     GSignondAuthSession *self = GSIGNOND_AUTH_SESSION (iface);
 
     gsignond_plugin_proxy_cancel(self->priv->proxy, iface);
+
+    return TRUE;
 }
 
 void 
@@ -127,7 +148,6 @@ _get_property (GObject *object, guint property_id, GValue *value,
     }
 }
 
-
 static void
 _set_property (GObject *object, guint property_id, const GValue *value,
                GParamSpec *pspec)
@@ -259,7 +279,6 @@ gboolean gsignond_auth_session_set_id(GSignondAuthSession *session, gint id)
         gsignond_get_plugin_proxy_factory(), id, session->priv->proxy);
 }
 
-
 /**
  * gsignond_auth_session_new:
  * @owner: instance of #GSignondIdentityIface
@@ -290,4 +309,3 @@ gsignond_auth_session_new (gint id, const gchar *method)
 
     return auth_session;
 }
-
index 86fb3d6..a198e62 100644 (file)
@@ -42,96 +42,109 @@ G_DEFINE_INTERFACE (GSignondIdentityIface, gsignond_identity_iface, G_TYPE_OBJEC
 static gboolean
 _dummy_request_credentials_update (GSignondIdentityIface *self,
                                    const gchar *message,
-                                   const GSignondSecurityContext *ctx)
+                                   const GSignondSecurityContext *ctx,
+                                   GError **error)
 {
     (void) self;
     (void) message;
     (void) ctx;
+    (void) error;
 
     return FALSE;
 }
 
 static GVariant *
-_dummy_get_info (GSignondIdentityIface *self, const GSignondSecurityContext *ctx)
+_dummy_get_info (GSignondIdentityIface *self, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) ctx;
+    (void) error;
 
     return 0;
 }
 
 static const gchar *
-_dummy_get_auth_session (GSignondIdentityIface *self, const gchar *method, const GSignondSecurityContext *ctx)
+_dummy_get_auth_session (GSignondIdentityIface *self, const gchar *method, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) method;
     (void) ctx;
+    (void) error;
 
     return NULL;
 }
 
 static gboolean
-_dummy_verify_user (GSignondIdentityIface *self, const GVariant *params, const GSignondSecurityContext *ctx)
+_dummy_verify_user (GSignondIdentityIface *self, const GVariant *params, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) params;
     (void) ctx;
+    (void) error;
 
     return FALSE;
 }
 
 static gboolean
-_dummy_verify_secret (GSignondIdentityIface *self, const gchar *secret, const GSignondSecurityContext *ctx)
+_dummy_verify_secret (GSignondIdentityIface *self, const gchar *secret, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) secret;
     (void) ctx;
+    (void) error;
 
     return FALSE;
 }
 
-static void
-_dummy_remove (GSignondIdentityIface *self, const GSignondSecurityContext *ctx)
+static gboolean
+_dummy_remove (GSignondIdentityIface *self, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) ctx;
+    (void) error;
+
+    return FALSE;
 }
 
 static gboolean
-_dummy_sign_out (GSignondIdentityIface *self, const GSignondSecurityContext *ctx)
+_dummy_sign_out (GSignondIdentityIface *self, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) ctx;
+    (void) error;
 
     return FALSE;
 }
 
 static guint32
-_dummy_store (GSignondIdentityIface *self, const GVariant *info, const GSignondSecurityContext *ctx)
+_dummy_store (GSignondIdentityIface *self, const GVariant *info, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) info;
     (void) ctx;
+    (void) error;
 
     return 0;
 }
 
 static gint32
-_dummy_add_reference (GSignondIdentityIface *self, const gchar *reference, const GSignondSecurityContext *ctx)
+_dummy_add_reference (GSignondIdentityIface *self, const gchar *reference, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) reference;
     (void) ctx;
+    (void) error;
 
     return 0;
 }
 
 static gint32
-_dummy_remove_reference (GSignondIdentityIface *self, const gchar *reference, const GSignondSecurityContext *ctx)
+_dummy_remove_reference (GSignondIdentityIface *self, const gchar *reference, const GSignondSecurityContext *ctx, GError **error)
 {
     (void) self;
     (void) reference;
     (void) ctx;
+    (void) error;
 
     return 0;
 }
@@ -201,6 +214,7 @@ gsignond_identity_iface_default_init (GSignondIdentityIfaceInterface *self)
  * @self: instance of #GSignondIdentityIface
  * @message: message to be shown to user
  * @ctx: security context of the caller
+ * @error: return location for error or @NULL.
  *
  * Requests user to update username and password for this identity @identity.
  * Once the process is done, emits "credentials-updated" signal
@@ -210,10 +224,11 @@ gsignond_identity_iface_default_init (GSignondIdentityIfaceInterface *self)
 gboolean
 gsignond_identity_iface_request_credentials_update (GSignondIdentityIface *self,
                                                     const gchar *message,
-                                                    const GSignondSecurityContext *ctx)
+                                                    const GSignondSecurityContext *ctx,
+                                                    GError **error)
 {
     return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->
-        request_credentials_update (self, message, ctx);
+        request_credentials_update (self, message, ctx, error);
 }
 
 /**
@@ -221,15 +236,16 @@ gsignond_identity_iface_request_credentials_update (GSignondIdentityIface *self,
  * @self: instance of #GSignondIdentityIface
  * @message: message to be shown to user
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Retrieves the identity information for this identity, in the form of key, value pairs.
  *
  * Returns: (transfers full): identity info
  */
 GVariant *
-gsignond_identity_iface_get_info (GSignondIdentityIface *self, const GSignondSecurityContext *ctx)
+gsignond_identity_iface_get_info (GSignondIdentityIface *self, const GSignondSecurityContext *ctx, GError **error)
 {
-    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->get_info (self, ctx);
+    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->get_info (self, ctx, error);
 }
 
 /**
@@ -237,6 +253,7 @@ gsignond_identity_iface_get_info (GSignondIdentityIface *self, const GSignondSec
  * @self: instance of #GSignondIdentityIface
  * @method: authentication method to use
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Creates new authentication process on #identity using #method, and returns
  * dbus object path for newly created object.
@@ -246,10 +263,11 @@ gsignond_identity_iface_get_info (GSignondIdentityIface *self, const GSignondSec
 const gchar *
 gsignond_identity_iface_get_auth_session (GSignondIdentityIface *self,
                                           const gchar *method,
-                                          const GSignondSecurityContext *ctx)
+                                          const GSignondSecurityContext *ctx,
+                                          GError **error)
 {
     return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->
-        get_auth_session (self, method, ctx);
+        get_auth_session (self, method, ctx, error);
 }
 
 /**
@@ -257,6 +275,7 @@ gsignond_identity_iface_get_auth_session (GSignondIdentityIface *self,
  * @self: instance of #GSignondIdentityIface
  * @params: authentication parameters to be verified
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Initiates user verification process.
  *
@@ -265,10 +284,11 @@ gsignond_identity_iface_get_auth_session (GSignondIdentityIface *self,
 gboolean
 gsignond_identity_iface_verify_user (GSignondIdentityIface *self,
                                      const GVariant *params,
-                                     const GSignondSecurityContext *ctx)
+                                     const GSignondSecurityContext *ctx,
+                                     GError **error)
 {
     return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->
-        verify_user (self, params, ctx);
+        verify_user (self, params, ctx, error);
 }
 
 /**
@@ -276,6 +296,7 @@ gsignond_identity_iface_verify_user (GSignondIdentityIface *self,
  * @self: instance of #GSignondIdentityIface
  * @secret: secret to be verified
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Initiates secret verification process.
  *
@@ -284,30 +305,36 @@ gsignond_identity_iface_verify_user (GSignondIdentityIface *self,
 gboolean
 gsignond_identity_iface_verify_secret (GSignondIdentityIface *self,
                                        const gchar *secret,
-                                       const GSignondSecurityContext *ctx)
+                                       const GSignondSecurityContext *ctx,
+                                       GError **error)
 {
     return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->
-        verify_secret (self, secret, ctx);
+        verify_secret (self, secret, ctx, error);
 }
 
 /**
  * gsignond_identity_iface_remove:
  * @self: instance of #GSignondIdentityIface
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Removes identity information from underlined database
+ *
+ * Returns: @TRUE if success, @FALSE otherwise
  */
-void
+gboolean
 gsignond_identity_iface_remove (GSignondIdentityIface *self,
-                                const GSignondSecurityContext *ctx)
+                                const GSignondSecurityContext *ctx,
+                                GError **error)
 {
-    GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->remove (self, ctx);
+    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->remove (self, ctx, error);
 }
 
 /**
  * gsignond_identity_iface_sign_out:
  * @self: instance of #GSignondIdentityIface
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * TODO: add description
  *
@@ -315,9 +342,10 @@ gsignond_identity_iface_remove (GSignondIdentityIface *self,
  */
 gboolean
 gsignond_identity_iface_sign_out (GSignondIdentityIface *self,
-                                  const GSignondSecurityContext *ctx)
+                                  const GSignondSecurityContext *ctx,
+                                  GError **error)
 {
-    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->sign_out (self, ctx);
+    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->sign_out (self, ctx, error);
 }
 
 /**
@@ -325,6 +353,7 @@ gsignond_identity_iface_sign_out (GSignondIdentityIface *self,
  * @self: instance of #GSignondIdentityIface
  * @info: identity information to store
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Saves given identity information #info to database
  *
@@ -333,9 +362,10 @@ gsignond_identity_iface_sign_out (GSignondIdentityIface *self,
 guint32
 gsignond_identity_iface_store (GSignondIdentityIface *self,
                                const GVariant *info,
-                               const GSignondSecurityContext *ctx)
+                               const GSignondSecurityContext *ctx,
+                               GError **error)
 {
-    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->store (self, info, ctx);
+    return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->store (self, info, ctx, error);
 }
 
 /**
@@ -343,6 +373,7 @@ gsignond_identity_iface_store (GSignondIdentityIface *self,
  * @self: instance of #GSignondIdentityIface
  * @reference: reference name
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Adds a named reference #reference to identity
  *
@@ -351,10 +382,11 @@ gsignond_identity_iface_store (GSignondIdentityIface *self,
 gint32
 gsignond_identity_iface_add_reference (GSignondIdentityIface *self,
                                        const gchar *reference,
-                                       const GSignondSecurityContext *ctx)
+                                       const GSignondSecurityContext *ctx,
+                                       GError **error)
 {
     return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->
-        add_reference (self, reference, ctx);
+        add_reference (self, reference, ctx, error);
 }
 
 /**
@@ -362,6 +394,7 @@ gsignond_identity_iface_add_reference (GSignondIdentityIface *self,
  * @self: instance of #GSignondIdentityIface
  * @reference: reference name
  * @ctx: security context of the caller
+ * @error: Return location for error or @NULL.
  *
  * Removes a named reference #reference to identity
  *
@@ -370,10 +403,11 @@ gsignond_identity_iface_add_reference (GSignondIdentityIface *self,
 gint32
 gsignond_identity_iface_remove_reference (GSignondIdentityIface *self,
                                           const gchar *reference,
-                                          const GSignondSecurityContext *ctx)
+                                          const GSignondSecurityContext *ctx,
+                                          GError **error)
 {
     return GSIGNOND_IDENTITY_IFACE_GET_INTERFACE (self)->
-        add_reference (self, reference, ctx);
+        add_reference (self, reference, ctx, error);
 }
 
 GSignondAccessControlManager *
@@ -441,4 +475,3 @@ gsignond_identity_iface_notify_info_updated (GSignondIdentityIface *self,
 {
     g_signal_emit (self, signals[SIG_INFO_UPDATED], 0, change);
 }
-
index 17c14d6..b788881 100644 (file)
@@ -56,116 +56,128 @@ struct _GSignondIdentityIfaceInterface {
      * @identity: Instance of #GSignondIdentityIface
      * @message: message to be shown to user
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Requests user to update username and password for this identity @identity.
      * Once the process is done, emits "credentials-updated" signal
      *
      * Returns: @TRUE on success, @FALSE otherwise
      */
-    gboolean (*request_credentials_update) (GSignondIdentityIface *identity, const gchar *message, const GSignondSecurityContext *ctx);
+    gboolean (*request_credentials_update) (GSignondIdentityIface *identity, const gchar *message, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * get_info:
      * @identity: Instance of #GSignondIdentityIface
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Retrives identity information stroed for this identity.
      *
      * Returns: (transfer full)identity information
      */
-    GVariant *(*get_info) (GSignondIdentityIface *identity, const GSignondSecurityContext *ctx);
+    GVariant *(*get_info) (GSignondIdentityIface *identity, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * get_auth_session:
      * @identity: Instance of #GSignondIdentityIface
      * @method: authentication method to use
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Opens an authentication session for #identity using authentication method #method.
      *
      * Returns: (transfers none) Dbus object path of the session object
      */
-    const gchar *   (*get_auth_session) (GSignondIdentityIface *identity, const gchar *method, const GSignondSecurityContext *ctx);
+    const gchar * (*get_auth_session) (GSignondIdentityIface *identity, const gchar *method, const GSignondSecurityContext *ctx, GError **error);
  
     /**
      * verify_user:
      * @identity: Instance of #GSignondIdentityIface
      * @params:
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Starts user verification process. Once the verification process completed
      * that is informed via #user_verified.
      *
      * Returns: @TRUE on success, @FALSE otherwise
      */
-    gboolean  (*verify_user) (GSignondIdentityIface *identity, const GVariant *params, const GSignondSecurityContext *ctx);
+    gboolean  (*verify_user) (GSignondIdentityIface *identity, const GVariant *params, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * verify_secret:
      * @identity: Instance of #GSignondIdentityIface
      * @secret: secret to verify
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Starts secret verification process. Once the verification process completed
      * that is informed via #secret_verified
      *
      * Returns: @TRUE on success, @FALSE otherwise
      */
-    gboolean  (*verify_secret) (GSignondIdentityIface *identity, const gchar *secret, const GSignondSecurityContext *ctx);
+    gboolean  (*verify_secret) (GSignondIdentityIface *identity, const gchar *secret, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * remove:
      * @identity: Instance of #GSignondIdentityIface
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Removes identity from database
+     *
+     * Returns: @TRUE on success, @FALSE otherwise
      */
-    void      (*remove) (GSignondIdentityIface *identity, const GSignondSecurityContext *ctx);
+    gboolean  (*remove) (GSignondIdentityIface *identity, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * store:
      * @identity: Instance of #GSignondIdentityIface
      * @info: information to be stored
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Stores the given identity information @info to database.
      *
      * Returns: id of the identity
      */
-    guint32   (*store) (GSignondIdentityIface *identity, const GVariant *info, const GSignondSecurityContext *ctx);
+    guint32   (*store) (GSignondIdentityIface *identity, const GVariant *info, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * sign_out:
      * @identity: Instance of #GSignondIdentityIface
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Returns: @TRUE on success, @FALSE otherwise.
      */
-    gboolean  (*sign_out) (GSignondIdentityIface *identity, const GSignondSecurityContext *ctx);
+    gboolean  (*sign_out) (GSignondIdentityIface *identity, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * add_reference:
      * @identity: Instance of #GSignondIdentityIface
      * @reference: named referece
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Adds a named referece to identity.
      *
      * Returns: identity id
      */
-    gint32    (*add_reference) (GSignondIdentityIface *identity, const gchar *reference, const GSignondSecurityContext *ctx);
+    gint32    (*add_reference) (GSignondIdentityIface *identity, const gchar *reference, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * remove_reference:
      * @identity: Instance of #GSignondIdentityIface
      * @reference: name of the reference to be removed
      * @ctx: security context of the caller
+     * @error: Return location for error or @NULL.
      *
      * Removes named reference @reference form list of references of identity @identity.
      *
      * Returns: identity id
      */
-    gint32    (*remove_reference) (GSignondIdentityIface *identity, const gchar *reference, const GSignondSecurityContext *ctx);
+    gint32    (*remove_reference) (GSignondIdentityIface *identity, const gchar *reference, const GSignondSecurityContext *ctx, GError **error);
 
     /**
      * get_acm:
@@ -184,48 +196,58 @@ gboolean
 gsignond_identity_iface_request_credentials_update (
                                                     GSignondIdentityIface *self,
                                                     const gchar *message,
-                                                    const GSignondSecurityContext *ctx);
+                                                    const GSignondSecurityContext *ctx,
+                                                    GError **error);
 GVariant * 
 gsignond_identity_iface_get_info (GSignondIdentityIface *self,
-                                  const GSignondSecurityContext *ctx);
+                                  const GSignondSecurityContext *ctx,
+                                  GError **error);
 
 const gchar *
 gsignond_identity_iface_get_auth_session (GSignondIdentityIface *iface,
                                           const gchar *method,
-                                          const GSignondSecurityContext *ctx);
+                                          const GSignondSecurityContext *ctx,
+                                          GError **error);
 
 gboolean 
 gsignond_identity_iface_verify_user (GSignondIdentityIface *self,
                                      const GVariant *params,
-                                     const GSignondSecurityContext *ctx);
+                                     const GSignondSecurityContext *ctx,
+                                     GError **error);
 
 gboolean 
 gsignond_identity_iface_verify_secret (GSignondIdentityIface *self,
                                        const gchar *secret,
-                                       const GSignondSecurityContext *ctx);
+                                       const GSignondSecurityContext *ctx,
+                                       GError **error);
 
-void 
+gboolean
 gsignond_identity_iface_remove (GSignondIdentityIface *self,
-                                const GSignondSecurityContext *ctx);
+                                const GSignondSecurityContext *ctx,
+                                GError **error);
 
 gboolean 
 gsignond_identity_iface_sign_out (GSignondIdentityIface *self,
-                                  const GSignondSecurityContext *ctx);
+                                  const GSignondSecurityContext *ctx,
+                                  GError **error);
 
 guint32 
 gsignond_identity_iface_store (GSignondIdentityIface *self,
                                const GVariant *info,
-                               const GSignondSecurityContext *ctx);
+                               const GSignondSecurityContext *ctx,
+                               GError **error);
 
 gint32 
 gsignond_identity_iface_add_reference (GSignondIdentityIface *self,
                                        const gchar *reference,
-                                       const GSignondSecurityContext *ctx);
+                                       const GSignondSecurityContext *ctx,
+                                       GError **error);
 
 gint32 
 gsignond_identity_iface_remove_reference (GSignondIdentityIface *self,
                                           const gchar *reference,
-                                          const GSignondSecurityContext *ctx);
+                                          const GSignondSecurityContext *ctx,
+                                          GError **error);
 
 GSignondAccessControlManager *
 gsignond_identity_iface_get_acm (GSignondIdentityIface *self);
index dd1dc32..aee0008 100644 (file)
@@ -247,8 +247,8 @@ gsignond_identity_class_init (GSignondIdentityClass *klass)
                   NULL, NULL,
                   NULL,
                   G_TYPE_BOOLEAN,
-                  1,
-                  GSIGNOND_TYPE_IDENTITY_INFO);
+                  0,
+                  G_TYPE_NONE);
     signals[SIG_STORE] = g_signal_new ("store",
                   GSIGNOND_TYPE_IDENTITY,
                   G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,