Rename access control check macros and correct some cases
authorJussi Laako <jussi.laako@linux.intel.com>
Wed, 18 Jun 2014 14:18:55 +0000 (17:18 +0300)
committerJussi Laako <jussi.laako@linux.intel.com>
Wed, 18 Jun 2014 14:18:55 +0000 (17:18 +0300)
src/daemon/gsignond-auth-session.c
src/daemon/gsignond-daemon.c
src/daemon/gsignond-identity.c

index 68482c1..e873ece 100644 (file)
@@ -72,7 +72,7 @@ G_DEFINE_TYPE (GSignondAuthSession, gsignond_auth_session, G_TYPE_OBJECT)
     G_TYPE_INSTANCE_GET_PRIVATE ((obj), GSIGNOND_TYPE_AUTH_SESSION, \
                                  GSignondAuthSessionPrivate)
 
-#define VALIDATE_READ_ACCESS(info, ctx, ret) \
+#define VALIDATE_X_ACCESS(info, ctx, ret) \
 { \
     GSignondAccessControlManager *acm = gsignond_get_access_control_manager(); \
     GSignondSecurityContextList *acl = gsignond_identity_info_get_access_control_list (info); \
@@ -171,7 +171,7 @@ gsignond_auth_session_query_available_mechanisms (GSignondAuthSession *self,
         return NULL;
     }
 
-    VALIDATE_READ_ACCESS (self->priv->identity_info, ctx, NULL);
+    VALIDATE_X_ACCESS (self->priv->identity_info, ctx, NULL);
 
     gchar **mechanisms, **iter;
     const gchar **src_iter;
@@ -213,7 +213,7 @@ gsignond_auth_session_process (GSignondAuthSession *self,
         return FALSE;
     }
 
-    VALIDATE_READ_ACCESS (self->priv->identity_info, ctx, FALSE);
+    VALIDATE_X_ACCESS (self->priv->identity_info, ctx, FALSE);
 
     _create_mechanism_cache (self);
     if (!g_sequence_lookup (self->priv->available_mechanisms,
@@ -267,7 +267,7 @@ gsignond_auth_session_cancel (GSignondAuthSession *self,
         if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Unknown error");
         return FALSE;
     }
-    VALIDATE_READ_ACCESS (self->priv->identity_info, ctx, FALSE);
+    VALIDATE_X_ACCESS (self->priv->identity_info, ctx, FALSE);
 
     gsignond_plugin_proxy_cancel(self->priv->proxy, self);
     g_signal_emit (self, signals[SIG_PROCESS_CANCELED], 0, NULL);
index 7a05b63..24b76d1 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * This file is part of gsignond
  *
- * Copyright (C) 2012 - 2013 Intel Corporation.
+ * Copyright (C) 2012 - 2014 Intel Corporation.
  *
  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
  *
@@ -491,7 +491,7 @@ gsignond_daemon_get_identity (GSignondDaemon *daemon,
     GSignondIdentity *identity = NULL;
     GSignondIdentityInfo *identity_info = NULL;
 
-#define VALIDATE_IDENTITY_READ_ACCESS(info, ctx, ret) \
+#define VALIDATE_IDENTITY_X_ACCESS(info, ctx, ret) \
 { \
     GSignondAccessControlManager *acm = daemon->priv->acm; \
     GSignondSecurityContextList *acl = gsignond_identity_info_get_access_control_list (info); \
@@ -513,7 +513,7 @@ gsignond_daemon_get_identity (GSignondDaemon *daemon,
     if (identity) {
         identity_info = gsignond_identity_get_identity_info (identity);
         gsignond_identity_info_ref (identity_info);
-        VALIDATE_IDENTITY_READ_ACCESS (identity_info, ctx, NULL);
+        VALIDATE_IDENTITY_X_ACCESS (identity_info, ctx, NULL);
         DBG ("using cased Identity '%p' for id %d", identity, id);
         gsignond_identity_info_unref (identity_info);
 
@@ -532,7 +532,7 @@ gsignond_daemon_get_identity (GSignondDaemon *daemon,
         return NULL;
     }
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity_info, ctx, NULL);
+    VALIDATE_IDENTITY_X_ACCESS (identity_info, ctx, NULL);
 
     identity = gsignond_identity_new (daemon, identity_info);
     if (!identity) {
index 7e3657a..536a7b9 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * This file is part of gsignond
  *
- * Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2012 - 2014 Intel Corporation.
  *
  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
             Amarnath Valluri <amarnath.valluri@linux.intel.com>
@@ -80,7 +80,7 @@ static void _on_store_token (GSignondAuthSession *session, GSignondDictionary *t
 
 #define GSIGNOND_IDENTITY_PRIV(obj) G_TYPE_INSTANCE_GET_PRIVATE ((obj), GSIGNOND_TYPE_IDENTITY, GSignondIdentityPrivate)
 
-#define VALIDATE_IDENTITY_READ_ACCESS(identity, ctx, ret) \
+#define VALIDATE_IDENTITY_X_ACCESS(identity, ctx, ret) \
 { \
     GSignondAccessControlManager *acm = gsignond_daemon_get_access_control_manager (identity->priv->owner); \
     GSignondSecurityContextList *acl = gsignond_identity_info_get_access_control_list (identity->priv->info); \
@@ -95,7 +95,7 @@ static void _on_store_token (GSignondAuthSession *session, GSignondDictionary *t
     } \
 }
 
-#define VALIDATE_IDENTITY_WRITE_ACCESS(identity, ctx, ret) \
+#define VALIDATE_IDENTITY_RW_ACCESS(identity, ctx, ret) \
 { \
     GSignondAccessControlManager *acm = gsignond_daemon_get_access_control_manager (identity->priv->owner); \
     GSignondSecurityContext *owner = gsignond_identity_info_get_owner (identity->priv->info); \
@@ -299,7 +299,7 @@ gsignond_identity_get_info (GSignondIdentity *identity, const GSignondSecurityCo
         return NULL;
     }
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, NULL);
+    VALIDATE_IDENTITY_RW_ACCESS (identity, ctx, NULL);
 
     /* prepare identity info, excluding password and username if secret */
     vinfo = gsignond_identity_info_to_variant (identity->priv->info);
@@ -499,7 +499,7 @@ gsignond_identity_get_auth_session (GSignondIdentity *identity,
     guint32 identity_id ;
     GSignondDictionary *token_data = NULL;
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, NULL);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, NULL);
 
     if (!method) {
         WARN ("assertion (method) failed");
@@ -646,7 +646,7 @@ gsignond_identity_request_credentials_update (GSignondIdentity *identity,
         return FALSE;
     }
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, FALSE);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, FALSE);
 
     if (!gsignond_identity_info_get_store_secret (identity->priv->info)) {
         if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_CREDENTIALS_NOT_AVAILABLE, "Password can not be stored.");
@@ -741,7 +741,7 @@ gsignond_identity_verify_user (GSignondIdentity *identity,
         return FALSE;
     }
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, FALSE);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, FALSE);
 
     if (!gsignond_identity_info_get_store_secret (identity->priv->info) ||
         !(passwd = gsignond_identity_info_get_secret (identity->priv->info)) ||
@@ -776,7 +776,7 @@ gsignond_identity_verify_secret (GSignondIdentity *identity,
         return FALSE;
     }
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, FALSE);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, FALSE);
 
     if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Not supported");
 
@@ -796,7 +796,7 @@ gsignond_identity_sign_out (GSignondIdentity *identity,
     gboolean success = FALSE;
     guint32 identity_id = GSIGNOND_IDENTITY_INFO_NEW_IDENTITY;
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, FALSE);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, FALSE);
 
     identity_id = gsignond_identity_info_get_id (identity->priv->info);
 
@@ -870,7 +870,7 @@ gsignond_identity_store (GSignondIdentity *identity,
 
     priv = identity->priv;
 
-    VALIDATE_IDENTITY_WRITE_ACCESS (identity, ctx, 0);
+    VALIDATE_IDENTITY_RW_ACCESS (identity, ctx, 0);
 
     was_new_identity = gsignond_identity_info_get_is_identity_new (priv->info);
 
@@ -951,7 +951,7 @@ gsignond_identity_remove (GSignondIdentity *identity,
     }
     gboolean is_removed = FALSE;
     
-    VALIDATE_IDENTITY_WRITE_ACCESS (identity, ctx, FALSE);
+    VALIDATE_IDENTITY_RW_ACCESS (identity, ctx, FALSE);
 
     is_removed = gsignond_identity_clear (identity);
 
@@ -1002,7 +1002,7 @@ gsignond_identity_add_reference (GSignondIdentity *identity,
     guint32 res = 0;
     guint32 identity_id = 0;
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, 0);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, 0);
 
     identity_id = gsignond_identity_info_get_id (identity->priv->info);
     if (!identity_id) {
@@ -1033,7 +1033,7 @@ gsignond_identity_remove_reference (GSignondIdentity *identity,
     gboolean res = 0;
     guint32 identity_id = 0;
 
-    VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, 0);
+    VALIDATE_IDENTITY_X_ACCESS (identity, ctx, 0);
 
     identity_id = gsignond_identity_info_get_id (identity->priv->info);
     if (!identity_id) {