gnome-keyring r1189 - in trunk: . daemon daemon/pk



Author: nnielsen
Date: Mon Jul 21 06:07:12 2008
New Revision: 1189
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1189&view=rev

Log:
	* daemon/gkr-daemon.c:
	* daemon/pk/gkr-pk-index.c:
	* daemon/pk/gkr-pk-object-storage.c:
	* daemon/pk/gkr-pk-places.h: (removed)
	* daemon/pk/gkr-pk-root-storage.c:
	* daemon/pk/gkr-pk-root-storage.h:
	* daemon/pk/Makefile.am: Initialize root storage properly.

	* pk/gkr-pk-object.c: Default name for Netscape Trust


Removed:
   trunk/daemon/pk/gkr-pk-places.h
Modified:
   trunk/ChangeLog
   trunk/daemon/gkr-daemon.c
   trunk/daemon/pk/Makefile.am
   trunk/daemon/pk/gkr-pk-index.c
   trunk/daemon/pk/gkr-pk-object-storage.c
   trunk/daemon/pk/gkr-pk-object.c
   trunk/daemon/pk/gkr-pk-root-storage.c
   trunk/daemon/pk/gkr-pk-root-storage.h

Modified: trunk/daemon/gkr-daemon.c
==============================================================================
--- trunk/daemon/gkr-daemon.c	(original)
+++ trunk/daemon/gkr-daemon.c	Mon Jul 21 06:07:12 2008
@@ -36,6 +36,9 @@
 #include "library/gnome-keyring.h"
 
 #include "pk/gkr-pk-object-storage.h"
+#ifdef ROOT_CERTIFICATES
+#include "pk/gkr-pk-root-storage.h"
+#endif
 
 #include "pkcs11/gkr-pkcs11-daemon.h"
 
@@ -458,6 +461,11 @@
 	/* Initialize object storage */
 	if (!gkr_pk_object_storage_initialize ())
 		cleanup_and_exit (1);
+	
+#ifdef ROOT_CERTIFICATES
+	if (!gkr_pk_root_storage_initialize ())
+		cleanup_and_exit (1);
+#endif
 
 	/* Initialize the appropriate components */
 	if (check_run_component ("keyring")) {

Modified: trunk/daemon/pk/Makefile.am
==============================================================================
--- trunk/daemon/pk/Makefile.am	(original)
+++ trunk/daemon/pk/Makefile.am	Mon Jul 21 06:07:12 2008
@@ -27,7 +27,6 @@
 	gkr-pk-netscape-trust.c gkr-pk-netscape-trust.h \
 	gkr-pk-object.c gkr-pk-object.h \
 	gkr-pk-object-storage.c gkr-pk-object-storage.h \
-	gkr-pk-places.h \
 	gkr-pk-privkey.c gkr-pk-privkey.h \
 	gkr-pk-pubkey.c gkr-pk-pubkey.h \
 	gkr-pk-session.c gkr-pk-session.h \

Modified: trunk/daemon/pk/gkr-pk-index.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-index.c	(original)
+++ trunk/daemon/pk/gkr-pk-index.c	Mon Jul 21 06:07:12 2008
@@ -24,7 +24,6 @@
 #include "config.h"
 
 #include "gkr-pk-index.h"
-#include "gkr-pk-places.h"
 
 #include "common/gkr-async.h"
 #include "common/gkr-cleanup.h"

Modified: trunk/daemon/pk/gkr-pk-object-storage.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-object-storage.c	(original)
+++ trunk/daemon/pk/gkr-pk-object-storage.c	Mon Jul 21 06:07:12 2008
@@ -27,7 +27,6 @@
 #include "gkr-pk-index.h"
 #include "gkr-pk-manager.h"
 #include "gkr-pk-object-storage.h"
-#include "gkr-pk-places.h"
 #include "gkr-pk-privkey.h"
 #include "gkr-pk-util.h"
 

Modified: trunk/daemon/pk/gkr-pk-object.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-object.c	(original)
+++ trunk/daemon/pk/gkr-pk-object.c	Mon Jul 21 06:07:12 2008
@@ -27,6 +27,7 @@
 #include "gkr-pk-import.h"
 #include "gkr-pk-index.h"
 #include "gkr-pk-manager.h"
+#include "gkr-pk-netscape-trust.h"
 #include "gkr-pk-object.h"
 #include "gkr-pk-privkey.h"
 #include "gkr-pk-pubkey.h"
@@ -876,6 +877,7 @@
 		
 		/* Come up with a name depending on the type */
 		if (!pv->label) {
+			/* TODO: This should be a virtual function, or class prop */
 			type = G_OBJECT_TYPE (xobj);
 			if (type == GKR_TYPE_PK_CERT) {
 				pv->label = g_strdup (_("Certificate"));
@@ -883,6 +885,8 @@
 				pv->label = g_strdup (_("Private Key"));
 			} else if (type == GKR_TYPE_PK_PUBKEY) {
 				pv->label = g_strdup (_("Public Key"));
+			} else if (type == GKR_TYPE_PK_NETSCAPE_TRUST) {
+				pv->label = g_strdup (_("Trust Association"));
 			} else {
 				g_warning ("no default label for objects of type: %s",
 				           G_OBJECT_TYPE_NAME (xobj));

Modified: trunk/daemon/pk/gkr-pk-root-storage.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-root-storage.c	(original)
+++ trunk/daemon/pk/gkr-pk-root-storage.c	Mon Jul 21 06:07:12 2008
@@ -56,6 +56,7 @@
 struct _GkrPkRootStoragePrivate {
 	gkrid specific_load_request;
 	GkrLocationWatch *watch;
+	GkrPkIndex *index;
 };
 
 #define GKR_PK_ROOT_STORAGE_GET_PRIVATE(o) \
@@ -106,7 +107,7 @@
  	g_return_val_if_fail (type != 0, FALSE);
  	
  	/* We only handle certificates */
- 	if (type == GKR_PKIX_CERTIFICATE)
+ 	if (type != GKR_PKIX_CERTIFICATE)
  		return FALSE;
  	
 	object = prepare_object (ctx->storage, location, digest);
@@ -212,6 +213,31 @@
 	return ret;
 }
 
+static GkrPkIndex* 
+gkr_pk_root_storage_index (GkrPkStorage *storage, GQuark unused)
+{
+ 	GkrPkRootStoragePrivate *pv = GKR_PK_ROOT_STORAGE_GET_PRIVATE (storage);
+ 	GnomeKeyringAttributeList *attrs;
+	GQuark kloc;
+	
+	if (!pv->index) {
+		/* We default to a keyring stored on the computer */
+		kloc = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, 
+		                                "pk-storage.keyring");
+		
+		/* Default attributes for our index */
+		attrs = gnome_keyring_attribute_list_new ();
+		gnome_keyring_attribute_list_append_string (attrs, "user-trust", "trusted");
+		
+		pv->index = gkr_pk_index_open (kloc, "pk-storage", attrs);
+		gnome_keyring_attribute_list_free (attrs);
+		
+		g_return_val_if_fail (pv->index, NULL);
+	}
+	
+	return pv->index;
+}
+
 static void
 gkr_pk_root_storage_init (GkrPkRootStorage *storage)
 {
@@ -234,6 +260,10 @@
 	GkrPkRootStorage *storage = GKR_PK_ROOT_STORAGE (obj);
  	GkrPkRootStoragePrivate *pv = GKR_PK_ROOT_STORAGE_GET_PRIVATE (obj);
  	
+	if (pv->index)
+		g_object_unref (pv->index);
+	pv->index = NULL;
+
 	g_signal_handlers_disconnect_by_func (pv->watch, location_load, storage);
 	g_signal_handlers_disconnect_by_func (pv->watch, location_remove, storage);
  	
@@ -263,6 +293,7 @@
 
 	storage_class->refresh = gkr_pk_root_storage_refresh;
 	storage_class->load = gkr_pk_root_storage_load;
+	storage_class->index = gkr_pk_root_storage_index;
 	
 	gkr_pk_root_storage_parent_class = g_type_class_peek_parent (klass);
 
@@ -273,8 +304,14 @@
  * PUBLIC FUNCTIONS
  */
 
-GkrPkRootStorage*
-gkr_pk_root_storage_new (void)
+gboolean
+gkr_pk_root_storage_initialize (void)
 {
-	return g_object_new (GKR_TYPE_PK_ROOT_STORAGE, NULL);
+	GkrPkStorage *storage;
+	
+	storage = g_object_new (GKR_TYPE_PK_ROOT_STORAGE, NULL);
+	gkr_pk_storage_register (storage, FALSE);
+	g_object_unref (storage);
+	
+	return TRUE;
 }

Modified: trunk/daemon/pk/gkr-pk-root-storage.h
==============================================================================
--- trunk/daemon/pk/gkr-pk-root-storage.h	(original)
+++ trunk/daemon/pk/gkr-pk-root-storage.h	Mon Jul 21 06:07:12 2008
@@ -29,7 +29,7 @@
 
 GType                   gkr_pk_root_storage_get_type          (void) G_GNUC_CONST;
 
-GkrPkRootStorage*       gkr_pk_root_storage_new               (void);
+gboolean                gkr_pk_root_storage_initialize        (void);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]