[gnome-keyring/trust-store] [pkcs11] Rename CKA_G_REMOTE to CKA_G_PEER (better terminology)
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/trust-store] [pkcs11] Rename CKA_G_REMOTE to CKA_G_PEER (better terminology)
- Date: Thu, 25 Nov 2010 03:24:25 +0000 (UTC)
commit e12765f3eed5de52765f0faab69b32340090e836
Author: Stef Walter <stefw collabora co uk>
Date: Wed Nov 24 19:27:13 2010 +0000
[pkcs11] Rename CKA_G_REMOTE to CKA_G_PEER (better terminology)
* Also update various locations where we used 'remote' to 'peer'
gcr/gcr-trust.c | 6 ++--
pkcs11/gkm/gkm-assertion.c | 48 ++++++++++++++++++++++++++------------
pkcs11/gkm/gkm-assertion.h | 2 +-
pkcs11/pkcs11i.h | 2 +-
pkcs11/xdg-store/gkm-xdg-trust.c | 37 +++++++++++++++-------------
5 files changed, 58 insertions(+), 37 deletions(-)
---
diff --git a/gcr/gcr-trust.c b/gcr/gcr-trust.c
index 860f7ca..f6320d7 100644
--- a/gcr/gcr-trust.c
+++ b/gcr/gcr-trust.c
@@ -119,7 +119,7 @@ prepare_is_certificate_exception (GcrCertificate *cert, const gchar *purpose, co
g_return_val_if_fail (attrs, NULL);
gck_attributes_add_string (attrs, CKA_G_PURPOSE, purpose);
- gck_attributes_add_string (attrs, CKA_G_REMOTE, remote);
+ gck_attributes_add_string (attrs, CKA_G_PEER, remote);
/*
* TODO: We need to be able to sort the modules by preference
@@ -243,7 +243,7 @@ prepare_add_certificate_exception (GcrCertificate *cert, const gchar *purpose, c
g_return_val_if_fail (attrs, NULL);
gck_attributes_add_string (attrs, CKA_G_PURPOSE, purpose);
- gck_attributes_add_string (attrs, CKA_G_REMOTE, remote);
+ gck_attributes_add_string (attrs, CKA_G_PEER, remote);
/*
* TODO: We need to be able to sort the modules by preference
@@ -400,7 +400,7 @@ prepare_remove_certificate_exception (GcrCertificate *cert, const gchar *purpose
g_return_val_if_fail (attrs, NULL);
gck_attributes_add_string (attrs, CKA_G_PURPOSE, purpose);
- gck_attributes_add_string (attrs, CKA_G_REMOTE, remote);
+ gck_attributes_add_string (attrs, CKA_G_PEER, remote);
/*
* TODO: We need to be able to sort the modules by preference
diff --git a/pkcs11/gkm/gkm-assertion.c b/pkcs11/gkm/gkm-assertion.c
index 2754c99..5302652 100644
--- a/pkcs11/gkm/gkm-assertion.c
+++ b/pkcs11/gkm/gkm-assertion.c
@@ -37,14 +37,14 @@ enum {
PROP_TRUST,
PROP_TYPE,
PROP_PURPOSE,
- PROP_REMOTE
+ PROP_PEER
};
struct _GkmAssertionPrivate {
GkmTrust *trust;
gulong type;
gchar *purpose;
- gchar *remote;
+ gchar *peer;
};
G_DEFINE_TYPE (GkmAssertion, gkm_assertion, GKM_TYPE_OBJECT);
@@ -77,10 +77,10 @@ gkm_assertion_get_attribute (GkmObject *base, GkmSession *session, CK_ATTRIBUTE_
return gkm_attribute_set_ulong (attr, self->pv->type);
case CKA_G_PURPOSE:
return gkm_attribute_set_string (attr, self->pv->purpose);
- case CKA_G_REMOTE:
- if (!self->pv->remote)
+ case CKA_G_PEER:
+ if (!self->pv->peer)
return CKR_ATTRIBUTE_TYPE_INVALID;
- return gkm_attribute_set_string (attr, self->pv->remote);
+ return gkm_attribute_set_string (attr, self->pv->peer);
/* Certificate reference values */
case CKA_SERIAL_NUMBER:
@@ -113,8 +113,8 @@ gkm_assertion_finalize (GObject *obj)
g_free (self->pv->purpose);
self->pv->purpose = NULL;
- g_free (self->pv->remote);
- self->pv->remote = NULL;
+ g_free (self->pv->peer);
+ self->pv->peer = NULL;
G_OBJECT_CLASS (gkm_assertion_parent_class)->finalize (obj);
}
@@ -139,8 +139,8 @@ gkm_assertion_set_property (GObject *obj, guint prop_id, const GValue *value,
case PROP_PURPOSE:
self->pv->purpose = g_value_dup_string (value);
break;
- case PROP_REMOTE:
- self->pv->remote = g_value_dup_string (value);
+ case PROP_PEER:
+ self->pv->peer = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -164,8 +164,8 @@ gkm_assertion_get_property (GObject *obj, guint prop_id, GValue *value,
case PROP_PURPOSE:
g_value_set_string (value, gkm_assertion_get_purpose (self));
break;
- case PROP_REMOTE:
- g_value_set_string (value, gkm_assertion_get_remote (self));
+ case PROP_PEER:
+ g_value_set_string (value, gkm_assertion_get_peer (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -185,6 +185,22 @@ gkm_assertion_class_init (GkmAssertionClass *klass)
gkm_class->get_attribute = gkm_assertion_get_attribute;
+ g_object_class_install_property (gobject_class, PROP_TRUST,
+ g_param_spec_object ("trust", "Trust", "Trust object this assertion belongs to",
+ GKM_TYPE_TRUST, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (gobject_class, PROP_TYPE,
+ g_param_spec_ulong ("type", "Type", "PKCS#11 assertion type",
+ 0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (gobject_class, PROP_PURPOSE,
+ g_param_spec_string ("purpose", "Purpose", "The purpose for the trust",
+ NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (gobject_class, PROP_PURPOSE,
+ g_param_spec_string ("peer", "Peer", "Optional peer this assertion applies to",
+ NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
g_type_class_add_private (klass, sizeof (GkmAssertionPrivate));
}
@@ -193,13 +209,15 @@ gkm_assertion_class_init (GkmAssertionClass *klass)
*/
GkmAssertion*
-gkm_assertion_new (GkmTrust *trust, gulong type, const gchar *purpose, const gchar *remote)
+gkm_assertion_new (GkmTrust *trust, gulong type, const gchar *purpose, const gchar *peer)
{
return g_object_new (GKM_TYPE_ASSERTION,
+ "module", gkm_object_get_module (GKM_OBJECT (trust)),
+ "manager", gkm_object_get_manager (GKM_OBJECT (trust)),
"trust", trust,
"type", type,
"purpose", purpose,
- "remote", remote,
+ "peer", peer,
NULL);
}
@@ -211,10 +229,10 @@ gkm_assertion_get_purpose (GkmAssertion *self)
}
const gchar*
-gkm_assertion_get_remote (GkmAssertion *self)
+gkm_assertion_get_peer (GkmAssertion *self)
{
g_return_val_if_fail (GKM_IS_ASSERTION (self), NULL);
- return self->pv->remote;
+ return self->pv->peer;
}
gulong
diff --git a/pkcs11/gkm/gkm-assertion.h b/pkcs11/gkm/gkm-assertion.h
index d9cfe7e..47fb987 100644
--- a/pkcs11/gkm/gkm-assertion.h
+++ b/pkcs11/gkm/gkm-assertion.h
@@ -57,7 +57,7 @@ GkmAssertion* gkm_assertion_new (GkmTrust *trust,
const gchar* gkm_assertion_get_purpose (GkmAssertion *self);
-const gchar* gkm_assertion_get_remote (GkmAssertion *self);
+const gchar* gkm_assertion_get_peer (GkmAssertion *self);
gulong gkm_assertion_get_trust_type (GkmAssertion *self);
diff --git a/pkcs11/pkcs11i.h b/pkcs11/pkcs11i.h
index 9e23ef5..9ac2375 100644
--- a/pkcs11/pkcs11i.h
+++ b/pkcs11/pkcs11i.h
@@ -131,7 +131,7 @@ typedef CK_G_APPLICATION* CK_G_APPLICATION_PTR;
#define CKA_G_PURPOSE (CKO_GNOME + 403)
-#define CKA_G_REMOTE (CKO_GNOME + 404)
+#define CKA_G_PEER (CKO_GNOME + 404)
typedef CK_ULONG CK_ASSERTION_TYPE;
diff --git a/pkcs11/xdg-store/gkm-xdg-trust.c b/pkcs11/xdg-store/gkm-xdg-trust.c
index a8dfba6..10a947a 100644
--- a/pkcs11/xdg-store/gkm-xdg-trust.c
+++ b/pkcs11/xdg-store/gkm-xdg-trust.c
@@ -293,7 +293,7 @@ create_assertion (GkmXdgTrust *self, GNode *asn, NetscapeFlags *netscape)
GkmAssertion *assertion;
GQuark level;
gchar *purpose;
- gchar *remote;
+ gchar *peer;
GNode *node;
/* Get the trust level */
@@ -306,24 +306,24 @@ create_assertion (GkmXdgTrust *self, GNode *asn, NetscapeFlags *netscape)
return NULL;
/* A purpose */
- purpose = egg_asn1x_get_oid_as_string (egg_asn1x_node (asn, "purpose", NULL));
+ purpose = egg_asn1x_get_string_as_utf8 (egg_asn1x_node (asn, "purpose", NULL), NULL);
g_return_val_if_fail (purpose, NULL);
- /* A remote name */
- node = egg_asn1x_node (asn, "remote", NULL);
+ /* A peer name */
+ node = egg_asn1x_node (asn, "peer", NULL);
if (egg_asn1x_have (node))
- remote = egg_asn1x_get_string_as_utf8 (node, NULL);
+ peer = egg_asn1x_get_string_as_utf8 (node, NULL);
else
- remote = NULL;
+ peer = NULL;
- assertion = gkm_assertion_new (GKM_TRUST (self), type, purpose, remote);
+ assertion = gkm_assertion_new (GKM_TRUST (self), type, purpose, peer);
/* Parse netscape trust flags */
- if (remote == NULL)
+ if (peer == NULL)
parse_netscape_trust (netscape, level, purpose);
g_free (purpose);
- g_free (remote);
+ g_free (peer);
return assertion;
}
@@ -392,7 +392,7 @@ save_assertions (GkmXdgTrust *self, GNode *asn)
GHashTableIter iter;
GNode *pair, *node;
const gchar *purpose;
- const gchar *remote;
+ const gchar *peer;
gpointer value;
GQuark level;
@@ -407,7 +407,7 @@ save_assertions (GkmXdgTrust *self, GNode *asn)
assertion = GKM_ASSERTION (value);
level = assertion_type_to_level_enum (gkm_assertion_get_trust_type (assertion));
purpose = gkm_assertion_get_purpose (assertion);
- remote = gkm_assertion_get_remote (assertion);
+ peer = gkm_assertion_get_peer (assertion);
pair = egg_asn1x_append (node);
g_return_val_if_fail (pair, FALSE);
@@ -415,9 +415,9 @@ save_assertions (GkmXdgTrust *self, GNode *asn)
egg_asn1x_set_oid_as_string (egg_asn1x_node (pair, "purpose", NULL), purpose);
egg_asn1x_set_enumerated (egg_asn1x_node (pair, "level", NULL), level);
- if (remote) {
- egg_asn1x_set_string_as_utf8 (egg_asn1x_node (pair, "remote", NULL),
- g_strdup (remote), g_free);
+ if (peer) {
+ egg_asn1x_set_string_as_utf8 (egg_asn1x_node (pair, "peer", NULL),
+ g_strdup (peer), g_free);
}
}
@@ -579,9 +579,12 @@ gkm_xdg_trust_real_load (GkmSerializable *base, GkmSecret *login, gconstpointer
copy = g_memdup (data, n_data);
- asn = egg_asn1x_create_and_decode (xdg_asn1_tab, "trust-1", copy, n_data);
- if (asn == NULL) {
- g_warning ("couldn't parse trust data");
+ asn = egg_asn1x_create (xdg_asn1_tab, "trust-1");
+ g_return_val_if_fail (asn, FALSE);
+
+ if (!egg_asn1x_decode (asn, copy, n_data)) {
+ g_warning ("couldn't parse trust data: %s", egg_asn1x_message (asn));
+ egg_asn1x_destroy (asn);
g_free (copy);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]