[gnome-keyring/trust-store] [xdg-store] Tests and fixes for removing trust assertions.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/trust-store] [xdg-store] Tests and fixes for removing trust assertions.
- Date: Fri, 26 Nov 2010 21:55:58 +0000 (UTC)
commit e02a125f045aa9d0508c398ec4a6275e244dbb94
Author: Stef Walter <stefw collabora co uk>
Date: Fri Nov 26 21:55:17 2010 +0000
[xdg-store] Tests and fixes for removing trust assertions.
pkcs11/xdg-store/gkm-xdg-trust.c | 12 ++++++++-
pkcs11/xdg-store/tests/test-xdg-trust.c | 35 +++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/pkcs11/xdg-store/gkm-xdg-trust.c b/pkcs11/xdg-store/gkm-xdg-trust.c
index 3012f46..71f7659 100644
--- a/pkcs11/xdg-store/gkm-xdg-trust.c
+++ b/pkcs11/xdg-store/gkm-xdg-trust.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include "gkm-xdg-assertion.h"
#include "gkm-xdg-trust.h"
#include "egg/egg-asn1x.h"
@@ -295,7 +296,14 @@ create_assertion (GkmXdgTrust *self, GNode *asn)
else
peer = NULL;
- assertion = gkm_assertion_new (GKM_TRUST (self), type, purpose, peer);
+ assertion = g_object_new (GKM_XDG_TYPE_ASSERTION,
+ "module", gkm_object_get_module (GKM_OBJECT (self)),
+ "manager", gkm_object_get_manager (GKM_OBJECT (self)),
+ "trust", self,
+ "type", type,
+ "purpose", purpose,
+ "peer", peer,
+ NULL);
g_free (purpose);
g_free (peer);
@@ -871,7 +879,7 @@ gkm_xdg_trust_remove_assertion (GkmXdgTrust *self, GkmAssertion *assertion,
g_return_if_fail (key);
/* Assertion needs to be from this trust object */
- g_return_if_fail (g_hash_table_lookup (self->pv->assertions, key) != assertion);
+ g_return_if_fail (g_hash_table_lookup (self->pv->assertions, key) == assertion);
remove_assertion_from_trust (self, assertion, transaction);
}
diff --git a/pkcs11/xdg-store/tests/test-xdg-trust.c b/pkcs11/xdg-store/tests/test-xdg-trust.c
index d2c2471..8a7ff45 100644
--- a/pkcs11/xdg-store/tests/test-xdg-trust.c
+++ b/pkcs11/xdg-store/tests/test-xdg-trust.c
@@ -556,6 +556,41 @@ TESTING_TEST (trust_create_assertion_complete_on_token)
gkm_assert_cmpulong (results[0], ==, check);
}
+TESTING_TEST (trust_destroy_assertion_on_token)
+{
+ CK_ASSERTION_TYPE atype = CKT_G_CERTIFICATE_TRUST_EXCEPTION;
+ CK_OBJECT_HANDLE results[8];
+ CK_BBOOL token = CK_TRUE;
+ CK_ULONG n_objects = 0;
+ CK_RV rv;
+
+ CK_ATTRIBUTE attrs[] = {
+ { CKA_G_ASSERTION_TYPE, &atype, sizeof (atype) },
+ { CKA_TOKEN, &token, sizeof (token) },
+ };
+
+ rv = gkm_session_C_FindObjectsInit (session, attrs, G_N_ELEMENTS (attrs));
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+ rv = gkm_session_C_FindObjects (session, results, G_N_ELEMENTS (results), &n_objects);
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+ rv = gkm_session_C_FindObjectsFinal (session);
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+
+ gkm_assert_cmpulong (n_objects, ==, 1);
+
+ rv = gkm_session_C_DestroyObject (session, results[0]);
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+
+ rv = gkm_session_C_FindObjectsInit (session, attrs, G_N_ELEMENTS (attrs));
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+ rv = gkm_session_C_FindObjects (session, results, G_N_ELEMENTS (results), &n_objects);
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+ rv = gkm_session_C_FindObjectsFinal (session);
+ gkm_assert_cmprv (rv, ==, CKR_OK);
+
+ gkm_assert_cmpulong (n_objects, ==, 0);
+}
+
static void
_assert_positive_netscape (CK_ASSERTION_TYPE assertion_type, const gchar *purpose,
CK_ATTRIBUTE_TYPE netscape_type, CK_TRUST netscape_trust,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]